2013-07-28 05:01:58 +02:00
--[[--
TODO : finish documentation
2013-07-26 02:17:05 +02:00
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 )
2013-09-27 18:25:16 +02:00
2013-07-26 02:17:05 +02:00
NOTE that the all - caps definitions will be changed into configuration keys , or moved to a different location
] ] --
2013-08-29 01:40:51 +02:00
local printer = require ( ' util.printer ' )
2013-07-17 08:25:24 +02:00
2013-07-26 02:17:05 +02:00
local M = { }
2013-07-17 17:43:33 +02:00
2013-07-17 08:25:24 +02:00
--NOTE: pcall protects from invocation exceptions, which is what we need except
--during debugging. This flag replaces them with a normal call so we can inspect stack traces.
2013-07-26 10:18:55 +02:00
M.DEBUG_PCALLS = false
2013-07-17 08:25:24 +02:00
2013-07-24 18:49:07 +02:00
--This enables debugging of the REST API from the command-line, specify the path and optionally the request method as follows: 'p=/mod/func rq=POST'
M.DEBUG_API = true
2013-07-17 08:25:24 +02:00
--REST responses will contain 'module' and 'function' keys describing what was requested
M.API_INCLUDE_ENDPOINT_INFO = false
2013-07-26 10:18:55 +02:00
M.API_BASE_URL_PATH = ' doodle3d.com ' -- includes any base path if necessary (e.g. 'localhost/~user')
2013-07-17 08:25:24 +02:00
2013-07-26 02:17:05 +02:00
M.network_ap_ssid = {
2013-09-18 21:16:54 +02:00
default = ' Doodle3D-%%MAC_ADDR_TAIL%% ' ,
2013-07-17 17:43:33 +02:00
type = ' string ' ,
2013-09-18 21:16:54 +02:00
description = ' Access Point mode SSID (name) ' ,
2013-07-17 17:43:33 +02:00
min = 1 ,
max = 32
}
2013-07-26 02:17:05 +02:00
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+ '
}
2013-10-14 14:01:22 +02:00
M.network_ap_key = {
2013-10-17 15:28:57 +02:00
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 "
2013-10-17 15:28:57 +02:00
elseif value : len ( ) > 63 then
2013-10-18 16:16:05 +02:00
return false , " too long "
2013-10-17 15:28:57 +02:00
else
return true
end
end
2013-10-14 14:01:22 +02:00
}
2013-07-26 02:17:05 +02:00
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-07-17 08:25:24 +02:00
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 = ' ' ,
2013-09-27 18:25:16 +02:00
isValid = function ( value )
2013-08-29 01:40:51 +02:00
local printers = printer.supportedPrinters ( )
2013-09-27 18:25:16 +02:00
return printers [ value ] ~= nil
2013-08-29 01:40:51 +02:00
end
2013-08-28 14:29:13 +02:00
}
2013-10-26 03:20:26 +02:00
M.printer_bed_width = {
default = 220 ,
type = ' int ' ,
description = ' ' ,
min = 0
}
M.printer_bed_height = {
default = 220 ,
type = ' int ' ,
description = ' ' ,
min = 0
}
2013-08-28 14:29:13 +02:00
M.printer_baudrate = {
default = ' 115200 ' ,
2013-07-17 08:25:24 +02:00
type = ' int ' ,
2013-08-28 14:29:13 +02:00
description = ' ' ,
2013-09-27 18:25:16 +02:00
isValid = function ( value )
2013-08-29 01:40:51 +02:00
local baudrates = printer.supportedBaudRates ( )
2013-09-27 18:25:16 +02:00
return baudrates [ tostring ( value ) ] ~= nil
2013-08-29 01:40:51 +02:00
end
2013-07-26 02:17:05 +02:00
}
2013-08-28 14:29:13 +02:00
M.printer_temperature = {
default = 230 ,
2013-07-26 02:17:05 +02:00
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 ' ,
2013-07-26 02:17:05 +02:00
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 ,
2013-07-28 05:01:58 +02:00
type = ' bool ' ,
2013-08-04 11:26:47 +02:00
description = ' Print the first layer slowly to get a more stable start '
2013-07-26 02:17:05 +02:00
}
2013-09-27 18:25:16 +02:00
M.printer_heatup_enabled = {
default = true ,
type = ' bool ' ,
description = ' '
}
M.printer_heatup_temperature = {
2013-09-25 12:06:28 +02:00
default = 180 ,
type = ' int ' ,
description = ' '
2013-07-26 02:17:05 +02:00
}
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 = ' '
}
2013-07-26 02:17:05 +02:00
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-09-18 21:16:54 +02:00
default = false ,
2013-09-18 12:13:07 +02:00
type = ' bool ' ,
description = ' '
}
2013-08-28 17:12:41 +02:00
M.printer_startgcode = {
2013-10-22 16:00:37 +02:00
default = ' ;Generated with Doodle3D \n M109 S{printingTemp} ;set target temperature \n ;M190 S{printingBedTemp} ;set target bed temperature \n G21 ;metric values \n G91 ;relative positioning \n M107 ;start with the fan off \n G28 X0 Y0 ;move X/Y to min endstops \n G28 Z0 ;move Z to min endstops \n G1 Z15 F9000 ;move the platform down 15mm \n G92 E0 ;zero the extruded length \n G1 F200 E10 ;extrude 10mm of feed stock \n G92 E0 ;zero the extruded length again \n G92 E0 ;zero the extruded length again \n G1 F9000 \n G90 ;absolute positioning \n M117 Printing Doodle... ;display message (20 characters to clear whole screen) ' ,
2013-08-28 17:12:41 +02:00
type = ' string ' ,
description = ' '
}
M.printer_endgcode = {
2013-10-22 16:00:37 +02:00
default = ' M107 ;fan off \n G91 ;relative positioning \n G1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure \n G1 Z+0.5 E-5 X-20 Y-20 F9000 ;move Z up a bit and retract filament even more \n G28 X0 Y0 ;move X/Y to min endstops, so the head is out of the way \n M84 ;disable axes / steppers \n G90 ;absolute positioning \n M104 S{preheatTemp} \n ;M140 S{preheatBedTemp} \n M117 Done ;display message (20 characters to clear whole screen) ' ,
2013-08-28 17:12:41 +02:00
type = ' string ' ,
description = ' '
}
2013-09-18 12:13:07 +02:00
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
}
2013-07-17 08:25:24 +02:00
return M