0
0
mirror of https://github.com/Doodle3D/doodle3d-firmware.git synced 2024-11-05 22:13:24 +01:00
doodle3d-firmware/src/conf_defaults.lua

280 lines
10 KiB
Lua
Raw Normal View History

---
-- This file contains all valid configuration keys, their default values and optional constraints.
-- The table names are used as configuration key names, where underscores ('`_`') may be used to denote semi-categories.
-- The settings interface replaces periods ('`.`') by underscores so for instance `network.ap.address` will
-- be translated to `network_ap_address`. Multi-word names should be notated as camelCase.
--
-- Valid fields for the tables are:
--
-- - _default_: the default value (used when the key is not set in UCI config)
-- - _type_: used for basic type checking, one of bool, int, float or string
-- - _description_: A descriptive text usable by API clients
-- - _min_, _max_, _regex_: optional constraints (min and max constrain value for numbers, or length for strings)
-- - _isValid_: an optional function which should return true for valid values and false for invalid ones
-- - _subSection: optional: setting name of which current value is used as the uci section where this setting should be loaded from. Otherwise it's retrieved from the generic section. Setting subsection also means it will first try to get a default from subconf_defaults, if that doesn't exsist it will use the regular default
-- The configuration keys themselves document themselves rather well, hence they are not included in the generated documentation.
--
-- NOTE: the all-caps definitions should be changed into configuration keys, or moved to a better location.
local printer = require('util.printer')
local log = require('util.logger')
local utils = require('util.utils')
local M = {}
2013-07-17 17:43:33 +02:00
--- This constant should only be true during development. It replaces `pcall` by regular `call`.
-- Pcall protects the script from invocation exceptions, which is what we need except during debugging.
-- When this flag is true, normal calls will be used so we can inspect stack traces.
M.DEBUG_PCALLS = false
--- This constant enables debugging of the REST API from the command-line by emulating GET/POST requests.
-- Specify the path and optionally the request method as follows: `d3dapi p=/mod/func r=POST`.
M.DEBUG_API = true
--- If enabled, REST responses will contain 'module' and 'function' keys describing what was requested.
M.API_INCLUDE_ENDPOINT_INFO = false
--- This base path is used in @{rest.response}. It includes any base path if necessary (e.g. 'localhost/~user').
M.API_BASE_URL_PATH = 'doodle3d.com'
M.network_ap_ssid = {
default = 'Doodle3D-%%MAC_ADDR_TAIL%%',
2013-07-17 17:43:33 +02:00
type = 'string',
description = 'Access Point mode SSID (name)',
2013-07-17 17:43:33 +02:00
min = 1,
max = 32
}
M.network_ap_address = {
2013-07-17 17:43:33 +02:00
default = '192.168.10.1',
type = 'string',
description = 'Access Point mode IP address',
regex = '%d+\.%d+\.%d+\.%d+'
}
M.network_ap_key = {
default = '',
type = 'string',
description = 'Access Point security key',
isValid = function(value)
if value == "" then
return true;
elseif value:len() < 8 then
2013-10-18 16:16:05 +02:00
return false, "too short"
elseif value:len() > 63 then
2013-10-18 16:16:05 +02:00
return false, "too long"
else
return true
end
end
}
M.network_ap_netmask = {
2013-07-17 17:43:33 +02:00
default = '255.255.255.0',
type = 'string',
description = 'Access Point mode netmask',
regex = '%d+\.%d+\.%d+\.%d+'
}
2013-09-27 18:38:31 +02:00
M.network_cl_wifiboxid = {
default = 'Doodle3D-%%MAC_ADDR_TAIL%%',
type = 'string',
description = 'Client mode WiFi box id',
min = 1,
max = 32
}
2013-08-28 14:29:13 +02:00
M.printer_type = {
default = 'ultimaker',
type = 'string',
description = '',
isValid = function(value)
local printers = printer.supportedPrinters()
return printers[value] ~= nil
end
2013-08-28 14:29:13 +02:00
}
2013-10-26 03:20:26 +02:00
M.printer_bed_width = {
default = 220,
subSection = 'printer_type',
2013-10-26 03:20:26 +02:00
type = 'int',
description = '',
min = 0
}
M.printer_bed_height = {
default = 220,
2013-11-29 11:03:27 +01:00
subSection = 'printer_type',
2013-10-26 03:20:26 +02:00
type = 'int',
description = '',
min = 0
}
2013-08-28 14:29:13 +02:00
2013-11-29 11:03:27 +01:00
local default_makerbot_startcode = '(**** CONFIGURATION MACROS ****)\n;@printer {printerType}\n;@enable progress\n(** This GCode was generated by ReplicatorG 0040 **)\n(* using Skeinforge (50) *)\n(* for a Dual headed Replicator 2 *)\n(* on 2013/10/27 15:07:27 (+0100) *)\n(**** start.gcode for Replicator 2X, single head ****)\nM103 (disable RPM)\nM73 P0 (enable build progress)\nG21 (set units to mm)\nG90 (set positioning to absolute)\nM104 S240 T0 (set extruder temperature) (temp updated by printOMatic)\nM140 S110 T0 (set HBP temperature)\n(**** begin homing ****)\nG162 X Y F2500 (home XY axes maximum)\nG161 Z F1100 (home Z axis minimum)\nG92 Z-5 (set Z to -5)\nG1 Z0.0 (move Z to "0")\nG161 Z F100 (home Z axis minimum)\nM132 X Y Z A B (Recall stored home offsets for XYZAB axis)\n(**** end homing ****)\nG1 X-141 Y-74 Z10 F3300.0 (move to waiting position)\nG130 X20 Y20 Z20 A20 B20 (Lower stepper Vrefs while heating)\nM6 T0 (wait for toolhead, and HBP to reach temperature)\nG130 X127 Y127 Z40 A127 B127 (Set Stepper motor Vref to defaults)\nM108 R3.0 T0\nG0 X-141 Y-74 (Position Nozzle)\nG0 Z0.6 (Position Height)\nM108 R5.0 (Set Extruder Speed)\nM101 (Start Extruder)\nG4 P2000 (Create Anchor)\nG92 X0 Y0\nM106\n(**** end of start.gcode ****)'
M.printer_startcode = {
default = ';Generated with Doodle3D (default)\nM109 S{printingTemp} ;set target temperature \n;M190 S{printingBedTemp} ;set target bed temperature\nG21 ;metric values\nG91 ;relative positioning\nM107 ;start with the fan off\nG28 X0 Y0 ;move X/Y to min endstops\nG28 Z0 ;move Z to min endstops\nG1 Z15 F9000 ;move the platform down 15mm\nG92 E0 ;zero the extruded length\nG1 F200 E10 ;extrude 10mm of feed stock\nG92 E0 ;zero the extruded length again\nG92 E0 ;zero the extruded length again\nG1 F9000\nG90 ;absolute positioning\nM117 Printing Doodle... ;display message (20 characters to clear whole screen)',
default_ultimaker2 = 'M109 S{printingTemp} ;set target temperature \nM190 S{printingBedTemp} ;set target bed temperature\nG21 ;metric values\nG90 ;absolute positioning\nM107 ;start with the fan off\nG28 ; home to endstops\nG1 Z15 F9000 ;move the platform down 15mm\nG92 E0 ;zero the extruded length\nG1 F200 E10 ;extrude 10mm of feed stock\nG92 E0 ;zero the extruded length again\nG1 F9000\nM117 Printing Doodle... ;display message (20 characters to clear whole screen)\n',
2013-11-29 11:03:27 +01:00
default_makerbot_generic = default_makerbot_startcode,
default_makerbot_replicator2 = default_makerbot_startcode,
default_makerbot_replicator2x = default_makerbot_startcode,
2013-11-29 11:03:27 +01:00
default_makerbot_thingomatic = default_makerbot_startcode,
type = 'string',
subSection = 'printer_type',
description = ''
}
2013-11-29 11:03:27 +01:00
local default_makerbot_endcode = '(******* End.gcode*******)\nM73 P100 ( End build progress )\nG0 Z150 ( Send Z axis to bottom of machine )\nM18 ( Disable steppers )\nM104 S0 T0 ( Cool down the Right Extruder )\nG162 X Y F2500 ( Home XY endstops )\nM18 ( Disable stepper motors )\nM70 P5 ( We <3 Making Things!)\nM72 P1 ( Play Ta-Da song )\n(*********end End.gcode*******)'
M.printer_endcode = {
default = 'M107 ;fan off\nG91 ;relative positioning\nG1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure\nG1 Z+0.5 E-5 X-20 Y-20 F9000 ;move Z up a bit and retract filament even more\nG28 X0 Y0 ;move X/Y to min endstops, so the head is out of the way\nM84 ;disable axes / steppers\nG90 ;absolute positioning\nM104 S{preheatTemp}\n;M140 S{preheatBedTemp}\nM117 Done ;display message (20 characters to clear whole screen)',
default_ultimaker2 = 'M107 ;fan off\nG91 ;relative positioning\nG1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure\nG1 Z+5.5 E-5 X-20 Y-20 F9000 ;move Z up a bit and retract filament even more\nG28 ;home the printer\nM84 ;disable axes / steppers\nG90 ;absolute positioning\nM104 S{preheatTemp}\nM140 S{preheatBedTemp}\nM117 Done ;display message (20 characters to clear whole screen)',
2013-11-29 11:03:27 +01:00
default_makerbot_generic = default_makerbot_endcode,
default_makerbot_replicator2 = default_makerbot_endcode,
default_makerbot_replicator2x = default_makerbot_endcode,
2013-11-29 11:03:27 +01:00
default_makerbot_thingomatic = default_makerbot_endcode,
type = 'string',
subSection = 'printer_type',
description = ''
}
2013-08-28 14:29:13 +02:00
M.printer_baudrate = {
default = '115200',
type = 'int',
2013-08-28 14:29:13 +02:00
description = '',
isValid = function(value)
local baudrates = printer.supportedBaudRates()
return baudrates[tostring(value)] ~= nil
end
}
2013-08-28 14:29:13 +02:00
M.printer_temperature = {
default = 230,
type = 'int',
2013-10-22 16:00:37 +02:00
description = 'printing temperature',
min = 0
}
M.printer_bed_temperature = {
default = 70,
type = 'int',
description = 'printing bed temperature',
min = 0
}
M.printer_layerHeight = {
default = 0.2,
type = 'float',
description = '',
min = 0.0
}
M.printer_wallThickness = {
default = 0.5,
type = 'float',
description = '',
min = 0.0
}
M.printer_speed = {
default = 70,
type = 'int',
description = '',
min = 0
}
M.printer_travelSpeed = {
default = 200,
type = 'int',
description = '',
min = 0
}
M.printer_filamentThickness = {
default = 2.89,
type = 'float',
description = '',
min = 0.0
}
M.printer_useSubLayers = {
default = true,
type = 'bool',
description = 'Continuously move platform while printing instead of once per layer'
}
M.printer_firstLayerSlow = {
default = true,
type = 'bool',
description = 'Print the first layer slowly to get a more stable start'
}
M.printer_heatup_enabled = {
default = true,
type = 'bool',
description = ''
}
M.printer_heatup_temperature = {
default = 180,
type = 'int',
description = ''
}
2013-10-22 16:00:37 +02:00
M.printer_heatup_bed_temperature = {
default = 70,
type = 'int',
description = ''
}
2013-08-02 14:00:23 +02:00
M.printer_retraction_enabled = {
default = true,
type = 'bool',
description = ''
}
M.printer_retraction_speed = {
default = 50,
type = 'int',
description = '',
min = 0
}
M.printer_retraction_minDistance = {
default = 5,
type = 'int',
description = '',
min = 0
}
M.printer_retraction_amount = {
default = 3,
type = 'int',
description = '',
min = 0
}
2013-09-18 12:13:07 +02:00
M.printer_enableTraveling = {
2013-12-04 16:16:21 +01:00
default = true,
2013-09-18 12:13:07 +02:00
type = 'bool',
description = ''
}
M.printer_maxObjectHeight = {
default = 150,
2013-08-28 14:29:13 +02:00
type = 'int',
description = 'Maximum height that will be printed',
min = 0
}
2013-09-18 12:13:07 +02:00
M.printer_screenToMillimeterScale = {
default = 0.3,
type = 'float',
description = '',
}
2013-08-28 14:29:13 +02:00
M.doodle3d_simplify_minDistance = {
default = 3,
type = 'int',
description = '',
min = 0
}
return M