mirror of
https://github.com/Doodle3D/doodle3d-firmware.git
synced 2024-12-22 11:03:48 +01:00
Handling multiline settings. Added start and end gcode
This commit is contained in:
parent
aeb669cc99
commit
24b773bd6f
@ -156,6 +156,18 @@ M.printer_autoWarmUpCommand = {
|
|||||||
description = ''
|
description = ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
M.printer_startgcode = {
|
||||||
|
default = ';Generated with Doodle3D\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 X-100 Y-100 E0 ;zero the extruded length again and make center the start position\nG1 F9000\nG90 ;absolute positioning\nM117 Printing Doodle... ;display message (20 characters to clear whole screen)',
|
||||||
|
type = 'string',
|
||||||
|
description = ''
|
||||||
|
}
|
||||||
|
|
||||||
|
M.printer_endgcode = {
|
||||||
|
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\nM117 Done ;display message (20 characters to clear whole screen)',
|
||||||
|
type = 'string',
|
||||||
|
description = ''
|
||||||
|
}
|
||||||
|
|
||||||
M.doodle3d_objectHeight = {
|
M.doodle3d_objectHeight = {
|
||||||
default = 20,
|
default = 20,
|
||||||
type = 'int',
|
type = 'int',
|
||||||
|
@ -16,7 +16,6 @@ local baseconfig = require('conf_defaults')
|
|||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
|
|
||||||
--- UCI config name (i.e. file under /etc/config)
|
--- UCI config name (i.e. file under /etc/config)
|
||||||
local UCI_CONFIG_NAME = 'wifibox'
|
local UCI_CONFIG_NAME = 'wifibox'
|
||||||
|
|
||||||
@ -61,6 +60,10 @@ end
|
|||||||
-- @return A value usable to write to UCI.
|
-- @return A value usable to write to UCI.
|
||||||
local function toUciValue(v, vType)
|
local function toUciValue(v, vType)
|
||||||
if vType == 'bool' then return v and '1' or '0' end
|
if vType == 'bool' then return v and '1' or '0' end
|
||||||
|
if(vType == 'string') then
|
||||||
|
v = v:gsub('[\n\r]', '\\n')
|
||||||
|
end
|
||||||
|
|
||||||
return tostring(v)
|
return tostring(v)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -78,6 +81,9 @@ local function fromUciValue(v, vType)
|
|||||||
return (v == '1') and true or false
|
return (v == '1') and true or false
|
||||||
elseif vType == 'float' or vType == 'int' then
|
elseif vType == 'float' or vType == 'int' then
|
||||||
return tonumber(v)
|
return tonumber(v)
|
||||||
|
elseif vType == 'string' then
|
||||||
|
v = v:gsub('\\n', '\n')
|
||||||
|
return v
|
||||||
else
|
else
|
||||||
return v
|
return v
|
||||||
end
|
end
|
||||||
@ -133,7 +139,7 @@ function M.get(key)
|
|||||||
|
|
||||||
local v = base.default
|
local v = base.default
|
||||||
local uciV = fromUciValue(uci:get(UCI_CONFIG_NAME, UCI_CONFIG_SECTION, key), base.type)
|
local uciV = fromUciValue(uci:get(UCI_CONFIG_NAME, UCI_CONFIG_SECTION, key), base.type)
|
||||||
|
|
||||||
local actualV = v
|
local actualV = v
|
||||||
if uciV ~= nil then actualV = uciV end
|
if uciV ~= nil then actualV = uciV end
|
||||||
|
|
||||||
@ -200,9 +206,9 @@ function M.set(key, value)
|
|||||||
elseif base.type == 'int' or base.type == 'float' then
|
elseif base.type == 'int' or base.type == 'float' then
|
||||||
value = tonumber(value)
|
value = tonumber(value)
|
||||||
end
|
end
|
||||||
|
|
||||||
if fromUciValue(current, base.type) == value then return true end
|
if fromUciValue(current, base.type) == value then return true end
|
||||||
|
|
||||||
if value ~= nil then
|
if value ~= nil then
|
||||||
local valid,m = isValid(value, base)
|
local valid,m = isValid(value, base)
|
||||||
if (valid) then
|
if (valid) then
|
||||||
|
Loading…
Reference in New Issue
Block a user