0
0
mirror of https://github.com/Doodle3D/doodle3d-firmware.git synced 2024-06-26 03:21:22 +02:00

Handling multiline settings. Added start and end gcode

This commit is contained in:
peteruithoven 2013-08-28 17:12:41 +02:00
parent aeb669cc99
commit 24b773bd6f
2 changed files with 22 additions and 4 deletions

View File

@ -156,6 +156,18 @@ M.printer_autoWarmUpCommand = {
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 = {
default = 20,
type = 'int',

View File

@ -16,7 +16,6 @@ local baseconfig = require('conf_defaults')
local M = {}
--- UCI config name (i.e. file under /etc/config)
local UCI_CONFIG_NAME = 'wifibox'
@ -61,6 +60,10 @@ end
-- @return A value usable to write to UCI.
local function toUciValue(v, vType)
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)
end
@ -78,6 +81,9 @@ local function fromUciValue(v, vType)
return (v == '1') and true or false
elseif vType == 'float' or vType == 'int' then
return tonumber(v)
elseif vType == 'string' then
v = v:gsub('\\n', '\n')
return v
else
return v
end
@ -133,7 +139,7 @@ function M.get(key)
local v = base.default
local uciV = fromUciValue(uci:get(UCI_CONFIG_NAME, UCI_CONFIG_SECTION, key), base.type)
local actualV = v
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
value = tonumber(value)
end
if fromUciValue(current, base.type) == value then return true end
if value ~= nil then
local valid,m = isValid(value, base)
if (valid) then