From 8d7eecc53966e59433e473df88c711ec01ccebed Mon Sep 17 00:00:00 2001 From: Wouter R Date: Fri, 22 Nov 2013 17:25:21 +0100 Subject: [PATCH 01/26] Bump image version to 0.9.10. --- src/FIRMWARE-VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/FIRMWARE-VERSION b/src/FIRMWARE-VERSION index 7e310ba..56f3151 100644 --- a/src/FIRMWARE-VERSION +++ b/src/FIRMWARE-VERSION @@ -1 +1 @@ -0.9.9 +0.9.10 From b633eb4d4650c3d80a8ddb1064506c3ef78ef4ec Mon Sep 17 00:00:00 2001 From: Wouter R Date: Sat, 23 Nov 2013 14:26:48 +0100 Subject: [PATCH 02/26] Add ReleaseNotes.md as (temporary) way to record concise changelogs for image releases. --- ReleaseNotes.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 ReleaseNotes.md diff --git a/ReleaseNotes.md b/ReleaseNotes.md new file mode 100644 index 0000000..af72cc5 --- /dev/null +++ b/ReleaseNotes.md @@ -0,0 +1,11 @@ +# 0.9.10 (22th nov 2013): +- fixed a major issue with makerbots preventing to print anything but small prints +- slightly improved usage of makerbot type profiles +- added option to reset settings to defaults (important to use after updating to allow new defaults to be used) +Note: there are known deficiencies in start/end gcode for makerbots + +# 0.9.9 (7th nov 2013) +- fixed issue sometimes causing ultimakers to reset continually + +# 0.9.8 (30th oct 2013) +- initial release From c23c8d9e7c3b939e11c952a6403e89648f944df9 Mon Sep 17 00:00:00 2001 From: peteruithoven Date: Thu, 28 Nov 2013 17:48:00 +0100 Subject: [PATCH 03/26] Config subsection system, enabling printer profiles and even material profiles --- src/conf_defaults.lua | 43 +++++++++++--------------- src/subconf_defaults.lua | 52 +++++++++++++++++++++++++++++++ src/util/settings.lua | 66 ++++++++++++++++++++++++++++++++-------- 3 files changed, 124 insertions(+), 37 deletions(-) create mode 100644 src/subconf_defaults.lua diff --git a/src/conf_defaults.lua b/src/conf_defaults.lua index bb10f01..9211bba 100644 --- a/src/conf_defaults.lua +++ b/src/conf_defaults.lua @@ -11,7 +11,7 @@ -- - _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. @@ -92,12 +92,15 @@ M.printer_type = { return printers[value] ~= nil end } + M.printer_bed_width = { default = 220, + subSection = 'printer_type', type = 'int', description = '', min = 0 } + M.printer_bed_height = { default = 220, type = 'int', @@ -105,6 +108,20 @@ M.printer_bed_height = { min = 0 } +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)', + type = 'string', + subSection = 'printer_type', + description = '' +} + +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)', + type = 'string', + subSection = 'printer_type', + description = '' +} + M.printer_baudrate = { default = '115200', type = 'int', @@ -227,30 +244,6 @@ M.printer_enableTraveling = { description = '' } -M.printer_startcode_marlin = { - default = ';Generated with Doodle3D\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)', - type = 'string', - description = '' -} - -M.printer_endcode_marlin = { - 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)', - type = 'string', - description = '' -} - -M.printer_startcode_x3g = { - default = '(**** CONFIGURATION MACROS ****)\n;@printer r2x\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 ****)', - type = 'string', - description = '' -} - -M.printer_endcode_x3g = { - default = '(******* 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*******)', - type = 'string', - description = '' -} - M.printer_maxObjectHeight = { default = 150, type = 'int', diff --git a/src/subconf_defaults.lua b/src/subconf_defaults.lua new file mode 100644 index 0000000..303903d --- /dev/null +++ b/src/subconf_defaults.lua @@ -0,0 +1,52 @@ +--- +-- This file contains all subsection default values +-- 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) +-- 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 M = {} + +-- Ultimaker +M.ultimaker_printer_bed_width = { + default = 420 +} +M.ultimaker_printer_bed_height = { + default = 420 +} +M.ultimaker_printer_startcode = { + default = ';Generated with Doodle3D (ultimaker)\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)', +} +M.ultimaker_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)', +} + +-- Makerbot +M.makerbot_generic_printer_startcode = { + default = '(**** 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.makerbot_generic_printer_endcode = { + default = '(******* 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.makerbot_replicator2_printer_startcode = { + default = '(**** 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.makerbot_replicator2_printer_endcode = { + default = '(******* 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.makerbot_thingomatic_printer_startcode = { + default = '(**** 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.makerbot_thingomatic_printer_endcode = { + default = '(******* 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*******)', +} + +return M diff --git a/src/util/settings.lua b/src/util/settings.lua index 38fdcd0..d7059fb 100644 --- a/src/util/settings.lua +++ b/src/util/settings.lua @@ -7,6 +7,7 @@ local uci = require('uci').cursor() local utils = require('util.utils') local baseconfig = require('conf_defaults') +local subconfig = require('subconf_defaults') local utils = require('util.utils') local log = require('util.logger') @@ -136,23 +137,53 @@ local function getBaseKeyTable(key) return type(base) == 'table' and base.default ~= nil and base or nil end +--- Looks up the table in @{subconf_defaults}.lua corresponding to a key. +-- @string key The key for which to return the base table. +-- @treturn table The base table for key, or nil if it does not exist. +local function getSubBaseKeyTable(key) + local base = subconfig[key] + return type(base) == 'table' and base.default ~= nil and base or nil +end + --- Returns the value of the requested key if it exists. -- @p key The key to return the associated value for. -- @return The associated value, beware (!) that this may be boolean false for keys of 'bool' type. function M.get(key) + log:info("settings:get: "..utils.dump(key)) key = replaceDots(key) local base = getBaseKeyTable(key) if not base then return nil,ERR_NO_SUCH_KEY end - - 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 - - return actualV + + local section = UCI_CONFIG_SECTION; + if base.subSection ~= nil then + log:info(" base.subSection: "..utils.dump(base.subSection)) + section = M.get(base.subSection) + end + log:info(" section: "..utils.dump(section)) + + local uciV = fromUciValue(uci:get(UCI_CONFIG_NAME, section, key), base.type) + log:info(" uciV: "..utils.dump(uciV)) + + if uciV ~= nil then + log:info(" returning uciV: "..utils.dump(uciV)) + return uciV + elseif base.subSection ~= nil then + log:info(" base.subSection: "..utils.dump(base.subSection)) + log:info(" section: "..utils.dump(section)) + log:info(" key: "..utils.dump(key)) + local subsectionBaseKey = section.."_"..key + local subsectionBase = getSubBaseKeyTable(subsectionBaseKey) + log:info(" subsection base key: "..utils.dump(subsectionBaseKey)) + log:info(" subsection base: "..utils.dump(subsectionKey)) + if subsectionBase ~= nil and subsectionBase.default ~= nil then + log:info(" returning subsection base default: "..utils.dump(subsectionBase.default)) + return subsectionBase.default + end + end + log:info(" returning default: "..utils.dump(base.default)) + return base.default end --- Returns all configuration keys with their current values. @@ -206,7 +237,7 @@ function M.set(key, value) if M.isDefault(key) and value == nil then return true end -- key is default already --log:info(" not default") - local current = uci:get(UCI_CONFIG_NAME, UCI_CONFIG_SECTION, key) + --log:info(" base.type: "..utils.dump(base.type)) if base.type == 'bool' then if value ~= "" then @@ -227,12 +258,23 @@ function M.set(key, value) return nil,m end - if fromUciValue(current, base.type) == value then return true end + --local current = uci:get(UCI_CONFIG_NAME, UCI_CONFIG_SECTION, key) + local current = M.get(key) + --if fromUciValue(current, base.type) == value then return true end + if current == value then return true end + + local section = UCI_CONFIG_SECTION; + if base.subSection ~= nil then + log:info(" base.subSection: "..utils.dump(base.subSection)) + section = M.get(base.subSection) + uci:set(UCI_CONFIG_NAME, section, UCI_CONFIG_TYPE) + end + log:info(" section: "..utils.dump(section)) if value ~= nil then - uci:set(UCI_CONFIG_NAME, UCI_CONFIG_SECTION, key, toUciValue(value, base.type)) + uci:set(UCI_CONFIG_NAME, section, key, toUciValue(value, base.type)) else - uci:delete(UCI_CONFIG_NAME, UCI_CONFIG_SECTION, key) + uci:delete(UCI_CONFIG_NAME, section, key) end uci:commit(UCI_CONFIG_NAME) From 33e58e53794cf11f5bdc52a5fc18f6b82b77b72d Mon Sep 17 00:00:00 2001 From: peteruithoven Date: Fri, 29 Nov 2013 11:03:27 +0100 Subject: [PATCH 04/26] Easier subsection default system --- src/conf_defaults.lua | 10 +++++++- src/subconf_defaults.lua | 52 ---------------------------------------- src/util/settings.lua | 16 ++++++------- 3 files changed, 16 insertions(+), 62 deletions(-) delete mode 100644 src/subconf_defaults.lua diff --git a/src/conf_defaults.lua b/src/conf_defaults.lua index 9211bba..3bc187b 100644 --- a/src/conf_defaults.lua +++ b/src/conf_defaults.lua @@ -100,23 +100,31 @@ M.printer_bed_width = { description = '', min = 0 } - M.printer_bed_height = { default = 220, + subSection = 'printer_type', type = 'int', description = '', min = 0 } +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_makerbot_generic = default_makerbot_startcode, + default_makerbot_replicator2 = default_makerbot_startcode, + default_makerbot_thingomatic = default_makerbot_startcode, type = 'string', subSection = 'printer_type', description = '' } +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_makerbot_generic = default_makerbot_endcode, + default_makerbot_replicator2 = default_makerbot_endcode, + default_makerbot_thingomatic = default_makerbot_endcode, type = 'string', subSection = 'printer_type', description = '' diff --git a/src/subconf_defaults.lua b/src/subconf_defaults.lua deleted file mode 100644 index 303903d..0000000 --- a/src/subconf_defaults.lua +++ /dev/null @@ -1,52 +0,0 @@ ---- --- This file contains all subsection default values --- 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) --- 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 M = {} - --- Ultimaker -M.ultimaker_printer_bed_width = { - default = 420 -} -M.ultimaker_printer_bed_height = { - default = 420 -} -M.ultimaker_printer_startcode = { - default = ';Generated with Doodle3D (ultimaker)\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)', -} -M.ultimaker_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)', -} - --- Makerbot -M.makerbot_generic_printer_startcode = { - default = '(**** 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.makerbot_generic_printer_endcode = { - default = '(******* 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.makerbot_replicator2_printer_startcode = { - default = '(**** 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.makerbot_replicator2_printer_endcode = { - default = '(******* 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.makerbot_thingomatic_printer_startcode = { - default = '(**** 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.makerbot_thingomatic_printer_endcode = { - default = '(******* 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*******)', -} - -return M diff --git a/src/util/settings.lua b/src/util/settings.lua index d7059fb..f6292e4 100644 --- a/src/util/settings.lua +++ b/src/util/settings.lua @@ -140,10 +140,10 @@ end --- Looks up the table in @{subconf_defaults}.lua corresponding to a key. -- @string key The key for which to return the base table. -- @treturn table The base table for key, or nil if it does not exist. -local function getSubBaseKeyTable(key) +--[[local function getSubBaseKeyTable(key) local base = subconfig[key] return type(base) == 'table' and base.default ~= nil and base or nil -end +end]]-- --- Returns the value of the requested key if it exists. @@ -173,13 +173,11 @@ function M.get(key) log:info(" base.subSection: "..utils.dump(base.subSection)) log:info(" section: "..utils.dump(section)) log:info(" key: "..utils.dump(key)) - local subsectionBaseKey = section.."_"..key - local subsectionBase = getSubBaseKeyTable(subsectionBaseKey) - log:info(" subsection base key: "..utils.dump(subsectionBaseKey)) - log:info(" subsection base: "..utils.dump(subsectionKey)) - if subsectionBase ~= nil and subsectionBase.default ~= nil then - log:info(" returning subsection base default: "..utils.dump(subsectionBase.default)) - return subsectionBase.default + log:info(" subDefault key: "..utils.dump("default_"..section)) + local subDefault = base["default_"..section] + if subDefault ~= nil then + log:info(" returning subsection default: "..utils.dump(subDefault)) + return subDefault end end log:info(" returning default: "..utils.dump(base.default)) From b1bc8f5dedfc64d04f45a81cdd722e2135d3a6ee Mon Sep 17 00:00:00 2001 From: peteruithoven Date: Fri, 29 Nov 2013 12:59:51 +0100 Subject: [PATCH 05/26] Reset now clears all sections except system --- src/util/settings.lua | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/util/settings.lua b/src/util/settings.lua index f6292e4..94e8253 100644 --- a/src/util/settings.lua +++ b/src/util/settings.lua @@ -284,11 +284,21 @@ end -- @treturn bool|nil True if everything went well, nil in case of error. function M.resetAll() log:info("settings:resetAll") - for k,_ in pairs(baseconfig) do - if not k:match('^[A-Z_]*$') then --TEMP: skip 'constants', which should be moved anyway - M.reset(k) end + + local allSections = uci:get_all(UCI_CONFIG_NAME) + + for key,value in pairs(allSections) do + if key ~= "system" and not key:match('^[A-Z_]*$') then --TEMP: skip 'constants', which should be moved anyway + log:info(" section: "..utils.dump(key)) + uci:delete(UCI_CONFIG_NAME,key) + end end + uci:commit(UCI_CONFIG_NAME) + + local allSections = uci:get_all(UCI_CONFIG_NAME) + log:info(" >allSections: "..utils.dump(allSections)) + return true end From c432325b895dc854a03189e9ba07fc524a7088aa Mon Sep 17 00:00:00 2001 From: peteruithoven Date: Fri, 29 Nov 2013 13:00:09 +0100 Subject: [PATCH 06/26] Added specific API:config/reset endpoint --- src/rest/api/api_config.lua | 14 ++++++++++++++ src/util/settings.lua | 29 +++++++++++++++++++++++++---- 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/src/rest/api/api_config.lua b/src/rest/api/api_config.lua index 5a230a8..27aeaef 100644 --- a/src/rest/api/api_config.lua +++ b/src/rest/api/api_config.lua @@ -88,7 +88,21 @@ function M.all_GET(request, response) end end +function M.reset_POST(request, response) + --log:info("API:reset"); + if not operationsAccessOrFail(request, response) then return end + response:setSuccess() + + for k,v in pairs(request:getAll()) do + --log:info(" "..k..": "..v); + local r,m = settings.reset(k); + if r ~= nil then response:addData(k, "ok") + else response:addData(k, "could not reset key ('" .. m .. "')") end + end +end + function M.resetall_POST(request, response) + if not operationsAccessOrFail(request, response) then return end response:setSuccess() settings.resetAll() diff --git a/src/util/settings.lua b/src/util/settings.lua index 94e8253..d3be53e 100644 --- a/src/util/settings.lua +++ b/src/util/settings.lua @@ -4,6 +4,7 @@ -- if no value is stored in the UCI config. The UCI config file is `/etc/config/wifibox`. -- The default values guarantee there will always be a set of reasonable settings -- to use and provide a clear overview of all existing configuration keys as well. +-- uci api: http://wiki.openwrt.org/doc/techref/uci, http://luci.subsignal.org/api/luci/modules/luci.model.uci.html local uci = require('uci').cursor() local utils = require('util.utils') local baseconfig = require('conf_defaults') @@ -284,9 +285,9 @@ end -- @treturn bool|nil True if everything went well, nil in case of error. function M.resetAll() log:info("settings:resetAll") - end local allSections = uci:get_all(UCI_CONFIG_NAME) + log:info(" allSections: "..utils.dump(allSections)) for key,value in pairs(allSections) do if key ~= "system" and not key:match('^[A-Z_]*$') then --TEMP: skip 'constants', which should be moved anyway @@ -306,10 +307,30 @@ end -- @string key The key to reset. -- @treturn bool|nil True if everything went well, nil in case of error. function M.reset(key) - log:info("settings:reset") + log:info("settings:reset: "..utils.dump(key)) + + --uci:foreach(UCI_CONFIG_NAME,UCI_CONFIG_TYPE) + --uci:delete(UCI_CONFIG_NAME, UCI_CONFIG_SECTION, key) + + key = replaceDots(key) + local base = getBaseKeyTable(key) + if not base then return nil,ERR_NO_SUCH_KEY end + + local section = UCI_CONFIG_SECTION; + if base.subSection ~= nil then + log:info(" base.subSection: "..utils.dump(base.subSection)) + section = M.get(base.subSection) + end + log:info(" section: "..utils.dump(section)) + + local uciV = fromUciValue(uci:get(UCI_CONFIG_NAME, section, key), base.type) + log:info(" uciV: "..utils.dump(uciV)) + + uci:delete(UCI_CONFIG_NAME, section, key) + + local uciV = fromUciValue(uci:get(UCI_CONFIG_NAME, section, key), base.type) + log:info(" >uciV: "..utils.dump(uciV)) - --log:info(" key: "..utils.dump(key)) - uci:delete(UCI_CONFIG_NAME, UCI_CONFIG_SECTION, key) uci:commit(UCI_CONFIG_NAME) return true end From 462360712bdf89a1616bd665b06a043046193439 Mon Sep 17 00:00:00 2001 From: peteruithoven Date: Fri, 29 Nov 2013 13:12:31 +0100 Subject: [PATCH 07/26] comments --- src/rest/api/api_config.lua | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/rest/api/api_config.lua b/src/rest/api/api_config.lua index 27aeaef..bdd0023 100644 --- a/src/rest/api/api_config.lua +++ b/src/rest/api/api_config.lua @@ -88,6 +88,12 @@ function M.all_GET(request, response) end end +--- Reset specific setting to default value +-- When an setting has a subSection only the setting in it's current subSection is reset. +-- For example you want to reset setting _printer.startcode_ +-- and it has it's _subSection_ set to 'printer_type' +-- and printer.type is set to 'ultimaker' then +-- only the printer.startcode under the ultimaker subsection is removed. function M.reset_POST(request, response) --log:info("API:reset"); if not operationsAccessOrFail(request, response) then return end @@ -101,6 +107,7 @@ function M.reset_POST(request, response) end end +--- Reset all settings to default value function M.resetall_POST(request, response) if not operationsAccessOrFail(request, response) then return end response:setSuccess() From e160f5b94fac615320b423a0eb48061ef1f4377c Mon Sep 17 00:00:00 2001 From: peteruithoven Date: Fri, 29 Nov 2013 13:28:54 +0100 Subject: [PATCH 08/26] Updated api info url --- src/rest/response.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rest/response.lua b/src/rest/response.lua index 01e5121..84665f2 100644 --- a/src/rest/response.lua +++ b/src/rest/response.lua @@ -91,7 +91,7 @@ function M:setError(msg) self.body.status = 'error' if msg ~= '' then self.body.msg = msg end - self:addData('more_info', 'http://' .. defaults.API_BASE_URL_PATH .. '/wiki/wiki/communication-api') + self:addData('more_info', 'http://' .. defaults.API_BASE_URL_PATH .. '/api') end --- Adds a data item to the response, this will be included under the `data` item of the json text. From 042f33c11a1517992bb8cc092fbe1792e61664a9 Mon Sep 17 00:00:00 2001 From: Wouter R Date: Fri, 29 Nov 2013 19:38:26 +0100 Subject: [PATCH 09/26] Log all the things! Closes #78 (on client: https://github.com/Doodle3D/doodle3d-client/issues/78). Bump fimware version to 0.9.11 (to avoid accidentally overwriting previous image). --- src/FIRMWARE-VERSION | 2 +- src/rest/api/api_info.lua | 72 ++++++++++++++++++++++++++++++++------- 2 files changed, 61 insertions(+), 13 deletions(-) diff --git a/src/FIRMWARE-VERSION b/src/FIRMWARE-VERSION index 56f3151..8225a4b 100644 --- a/src/FIRMWARE-VERSION +++ b/src/FIRMWARE-VERSION @@ -1 +1 @@ -0.9.10 +0.9.11 diff --git a/src/rest/api/api_info.lua b/src/rest/api/api_info.lua index 6645064..dc938fa 100644 --- a/src/rest/api/api_info.lua +++ b/src/rest/api/api_info.lua @@ -12,7 +12,18 @@ local LOG_COLLECT_DIRNAME = 'wifibox-logs' local LOG_COLLECT_DIR = TMP_DIR .. '/' .. LOG_COLLECT_DIRNAME local WIFIBOX_LOG_FILENAME = 'wifibox.log' local WIFIBOX_LOG_FILE = TMP_DIR .. '/' .. WIFIBOX_LOG_FILENAME + local SYSLOG_FILENAME = 'syslog' +local PROCESS_LIST_FILENAME = 'processes' +local MEMINFO_FILENAME = 'meminfo' +local MOUNTS_FILENAME = 'mounts' +local DISKFREE_FILENAME = 'diskfree' + +local UCI_CONFIG_FILES_TO_SAVE = { 'dhcp', 'firewall', 'network', 'system', 'wifibox', 'wireless' } + +local USB_DIRTREE_COMMAND = "ls -R /sys/devices/platform/ehci-platform/usb1 | grep \":$\" | sed -e 's/:$//' -e 's/[^-][^\\/]*\\//--/g' -e 's/^/ /' -e 's/-/|/'" +local USB_DIRTREE_FILENAME = 'sys_devices_platform_ehci-platform_usb1.tree' + local PRINT3D_BASEPATH = '/tmp' local PRINT3D_LOG_FILENAME_PREFIX = 'print3d-' local PRINT3D_LOG_FILENAME_SUFFIX = '.log' @@ -33,30 +44,60 @@ end -- TODO: redirect stdout+stderr; handle errors function M.logfiles(request, response) - local rv,msg = lfs.mkdir(LOG_COLLECT_DIR) - local rv,msg = lfs.chdir(TMP_DIR) + local rv,sig,code,msg = nil,nil,nil,nil + + rv,msg = lfs.mkdir(LOG_COLLECT_DIR) + rv,msg = lfs.chdir(TMP_DIR) --[[ create temporary files ]]-- - local rv,sig,code = redirectedExecute('cp ' .. WIFIBOX_LOG_FILE .. ' ' .. LOG_COLLECT_DIR) + -- copy wifibox API-script log + rv,sig,code = redirectedExecute('cp ' .. WIFIBOX_LOG_FILE .. ' ' .. LOG_COLLECT_DIR) - local rv,sig,code = os.execute('logread > ' .. LOG_COLLECT_DIR .. '/' .. SYSLOG_FILENAME) + -- capture syslog + rv,sig,code = os.execute('logread > ' .. LOG_COLLECT_DIR .. '/' .. SYSLOG_FILENAME) + -- capture running processes + rv,sig,code = os.execute('ps -w > ' .. LOG_COLLECT_DIR .. '/' .. PROCESS_LIST_FILENAME) + + -- capture info on RAM memory + rv,sig,code = os.execute('cat /proc/meminfo > ' .. LOG_COLLECT_DIR .. '/' .. MEMINFO_FILENAME) + + -- capture info on mounted file systems + rv,sig,code = os.execute('mount > ' .. LOG_COLLECT_DIR .. '/' .. MOUNTS_FILENAME) + + -- capture info on free disk space + rv,sig,code = os.execute('df -h > ' .. LOG_COLLECT_DIR .. '/' .. DISKFREE_FILENAME) + + -- list directory structure for primary USB controller + rv,sig,code = os.execute(USB_DIRTREE_COMMAND .. ' > ' .. LOG_COLLECT_DIR .. '/' .. USB_DIRTREE_FILENAME) + + -- copy relevant openwrt configuration files + rv,msg = lfs.mkdir(LOG_COLLECT_DIR .. '/config') + for _,v in pairs(UCI_CONFIG_FILES_TO_SAVE) do + local tgtFile = LOG_COLLECT_DIR .. '/config/' .. v + rv,sig,code = redirectedExecute('cp ' .. '/etc/config/' .. v .. ' ' .. tgtFile) + if v == 'wireless' then + rv,sig,code = os.execute("sed \"s/option key '.*'/option key '...'/g\" " .. tgtFile .. " > " .. tgtFile .. '.2') + end + end + + -- collect and copy print3d server logs for file in lfs.dir(PRINT3D_BASEPATH) do if file:find(PRINT3D_LOG_FILENAME_PREFIX) == 1 and file:find(PRINT3D_LOG_FILENAME_SUFFIX) ~= nil then local srcLogFile = PRINT3D_BASEPATH .. '/' .. file local tgtLogFile = LOG_COLLECT_DIR .. '/' .. file - local rv,sig,code = redirectedExecute('cp ' .. srcLogFile .. ' ' .. tgtLogFile) + rv,sig,code = redirectedExecute('cp ' .. srcLogFile .. ' ' .. tgtLogFile) end end - local rv,sig,code = redirectedExecute('tar czf ' .. LOG_COLLECT_ARCHIVE_FILE .. ' ' .. LOG_COLLECT_DIRNAME) --returns 0 success, 1 error + rv,sig,code = redirectedExecute('tar czf ' .. LOG_COLLECT_ARCHIVE_FILE .. ' ' .. LOG_COLLECT_DIRNAME) --returns 0 success, 1 error --[[ add response content ]]-- - local rv,msg = response:setBinaryFileData(LOG_COLLECT_ARCHIVE_FILE, LOG_COLLECT_ARCHIVE_FILENAME, 'application/x-compressed') + rv,msg = response:setBinaryFileData(LOG_COLLECT_ARCHIVE_FILE, LOG_COLLECT_ARCHIVE_FILENAME, 'application/x-compressed') if not rv then response:setError("could not set binary data from file '" .. LOG_COLLECT_ARCHIVE_FILE .. "' (" .. msg .. ")") else @@ -69,17 +110,24 @@ function M.logfiles(request, response) for file in lfs.dir(LOG_COLLECT_DIR) do if file:find(PRINT3D_LOG_FILENAME_PREFIX) == 1 and file:find(PRINT3D_LOG_FILENAME_SUFFIX) ~= nil then local tgtLogFile = LOG_COLLECT_DIR .. '/' .. file - local rv,sig,code = redirectedExecute('rm ' .. tgtLogFile) + rv,sig,code = redirectedExecute('rm ' .. tgtLogFile) end end - local rv,sig,code = redirectedExecute('rm ' .. LOG_COLLECT_DIR .. '/' .. WIFIBOX_LOG_FILENAME) + rv,sig,code = redirectedExecute('rm ' .. LOG_COLLECT_DIR .. '/config/*') + rv,msg = lfs.rmdir(LOG_COLLECT_DIR .. '/config') - local rv,sig,code = redirectedExecute('rm ' .. LOG_COLLECT_DIR .. '/' .. SYSLOG_FILENAME) + rv,sig,code = redirectedExecute('rm ' .. LOG_COLLECT_DIR .. '/' .. USB_DIRTREE_FILENAME) + rv,sig,code = redirectedExecute('rm ' .. LOG_COLLECT_DIR .. '/' .. DISKFREE_FILENAME) + rv,sig,code = redirectedExecute('rm ' .. LOG_COLLECT_DIR .. '/' .. MOUNTS_FILENAME) + rv,sig,code = redirectedExecute('rm ' .. LOG_COLLECT_DIR .. '/' .. MEMINFO_FILENAME) + rv,sig,code = redirectedExecute('rm ' .. LOG_COLLECT_DIR .. '/' .. PROCESS_LIST_FILENAME) + rv,sig,code = redirectedExecute('rm ' .. LOG_COLLECT_DIR .. '/' .. SYSLOG_FILENAME) + rv,sig,code = redirectedExecute('rm ' .. LOG_COLLECT_DIR .. '/' .. WIFIBOX_LOG_FILENAME) - local rv,msg = lfs.rmdir(LOG_COLLECT_DIR) + rv,msg = lfs.rmdir(LOG_COLLECT_DIR) - local rv,sig,code = redirectedExecute('rm ' .. LOG_COLLECT_ARCHIVE_FILE) + rv,sig,code = redirectedExecute('rm ' .. LOG_COLLECT_ARCHIVE_FILE) end function M.access(request, response) From 25c0c1a1fa5933bd534264f6d6493bbb90cdc8b3 Mon Sep 17 00:00:00 2001 From: Wouter R Date: Fri, 29 Nov 2013 20:47:17 +0100 Subject: [PATCH 10/26] Amend last commit. --- src/rest/api/api_info.lua | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/rest/api/api_info.lua b/src/rest/api/api_info.lua index dc938fa..d4d9831 100644 --- a/src/rest/api/api_info.lua +++ b/src/rest/api/api_info.lua @@ -76,10 +76,12 @@ function M.logfiles(request, response) -- copy relevant openwrt configuration files rv,msg = lfs.mkdir(LOG_COLLECT_DIR .. '/config') for _,v in pairs(UCI_CONFIG_FILES_TO_SAVE) do + local srcFile = '/etc/config/' .. v local tgtFile = LOG_COLLECT_DIR .. '/config/' .. v - rv,sig,code = redirectedExecute('cp ' .. '/etc/config/' .. v .. ' ' .. tgtFile) - if v == 'wireless' then - rv,sig,code = os.execute("sed \"s/option key '.*'/option key '...'/g\" " .. tgtFile .. " > " .. tgtFile .. '.2') + if v ~= 'wireless' then + rv,sig,code = redirectedExecute('cp ' .. srcFile .. ' ' .. tgtFile) + else + rv,sig,code = os.execute("sed \"s/option key '.*'/option key '...'/g\" " .. srcFile .. " > " .. tgtFile) end end From ce043de28e65471e8b1cd64dce9206d3b3dca33e Mon Sep 17 00:00:00 2001 From: Wouter R Date: Fri, 29 Nov 2013 21:14:59 +0100 Subject: [PATCH 11/26] =?UTF-8?q?Workaround=20for=20issue=2066=20(https://?= =?UTF-8?q?github.com/Doodle3D/doodle3d-client/issues/66).=20Remove=20?= =?UTF-8?q?=E2=80=98-s=E2=80=99=20flag=20in=20wifibox=20init=20script=20to?= =?UTF-8?q?=20prevent=20duplicates=20log=20messages.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 3 ++- post-install.sh | 1 + src/script/dhcpcheck_init | 16 ++++++++++++++++ src/script/wifibox_init | 2 +- 4 files changed, 20 insertions(+), 2 deletions(-) create mode 100755 src/script/dhcpcheck_init diff --git a/Makefile b/Makefile index 5cb4b83..f47d81e 100644 --- a/Makefile +++ b/Makefile @@ -100,7 +100,8 @@ define Package/wifibox/install $(INSTALL_BIN) $(WIFIBOX_BASE_DIR)/script/d3d-updater.lua $(1)/$(TGT_LUA_DIR_SUFFIX)/script $(LN) -s /$(TGT_LUA_DIR_SUFFIX)/script/d3d-updater.lua $(1)/bin/d3d-updater - $(INSTALL_BIN) $(WIFIBOX_BASE_DIR)/script/wifibox_init $(1)/etc/init.d/wifibox # copy directly to init dir (required for post-inst enabling) + $(INSTALL_BIN) $(WIFIBOX_BASE_DIR)/script/wifibox_init $(1)/etc/init.d/wifibox + $(INSTALL_BIN) $(WIFIBOX_BASE_DIR)/script/dhcpcheck_init $(1)/etc/init.d/dhcpcheck $(INSTALL_BIN) $(WIFIBOX_BASE_DIR)/script/d3dapi $(1)/$(TGT_LUA_DIR_SUFFIX)/script $(INSTALL_BIN) $(WIFIBOX_BASE_DIR)/script/signin.sh $(1)/$(TGT_LUA_DIR_SUFFIX)/script diff --git a/post-install.sh b/post-install.sh index 6bf66ca..2ece974 100644 --- a/post-install.sh +++ b/post-install.sh @@ -74,6 +74,7 @@ echo "/root/sketches" >> /etc/sysupgrade.conf $IPKG_INSTROOT/etc/init.d/wifibox enable $IPKG_INSTROOT/etc/init.d/wifibox start +$IPKG_INSTROOT/etc/init.d/dhcpcheck enable if [ -z "$IPKG_INSTROOT" ]; then echo "Enabling wifi device..." diff --git a/src/script/dhcpcheck_init b/src/script/dhcpcheck_init new file mode 100755 index 0000000..11b05c5 --- /dev/null +++ b/src/script/dhcpcheck_init @@ -0,0 +1,16 @@ +#!/bin/sh /etc/rc.common + +# start after all other scripts +START=99 + +LOGGER="logger -t dhcpcheck -p 6" + +boot() { + logread | grep "192.168.10.249, lease time 12h" + if [ $? -ne 0 ]; then + $LOGGER "Applying workaround for dhcp/dnsmasq issue. See: https://github.com/Doodle3D/doodle3d-client/issues/66" + /etc/init.d/dnsmasq reload + else + $LOGGER "DHCP configuration is in order, not doing anything" + fi +} diff --git a/src/script/wifibox_init b/src/script/wifibox_init index 9499b85..81f9f81 100755 --- a/src/script/wifibox_init +++ b/src/script/wifibox_init @@ -3,7 +3,7 @@ # start after networking START=22 -LOGGER="logger -s -t autowifi -p 6" +LOGGER="logger -t autowifi -p 6" boot() { sleep 1 From f9f34a42a78f4db98fd335940cf22af40f9d5d57 Mon Sep 17 00:00:00 2001 From: peteruithoven Date: Wed, 4 Dec 2013 14:55:25 +0100 Subject: [PATCH 12/26] Added Ultimaker2 --- src/util/printer.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/src/util/printer.lua b/src/util/printer.lua index 2c8fa43..1b67de3 100644 --- a/src/util/printer.lua +++ b/src/util/printer.lua @@ -5,6 +5,7 @@ local printDriver = require('print3d') local SUPPORTED_PRINTERS = { rigidbot = "Rigidbot", ultimaker = "Ultimaker", + ultimaker2 = "Ultimaker2", makerbot_replicator2 = "MakerBot Replicator2", makerbot_thingomatic = "MakerBot Thing-o-matic", printrbot = "Printrbot", From d1c2b08a1f679d21e3458713d31cdd841008e3a8 Mon Sep 17 00:00:00 2001 From: peteruithoven Date: Wed, 4 Dec 2013 15:42:46 +0100 Subject: [PATCH 13/26] Added Ultimaker2 specific default start and end gcode --- src/conf_defaults.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/conf_defaults.lua b/src/conf_defaults.lua index 3bc187b..0e4d8df 100644 --- a/src/conf_defaults.lua +++ b/src/conf_defaults.lua @@ -111,6 +111,7 @@ M.printer_bed_height = { 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', default_makerbot_generic = default_makerbot_startcode, default_makerbot_replicator2 = default_makerbot_startcode, default_makerbot_thingomatic = default_makerbot_startcode, @@ -122,6 +123,7 @@ M.printer_startcode = { 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)', default_makerbot_generic = default_makerbot_endcode, default_makerbot_replicator2 = default_makerbot_endcode, default_makerbot_thingomatic = default_makerbot_endcode, From c4c9957cb503a82cdc89425f90c30889d9659239 Mon Sep 17 00:00:00 2001 From: Wouter R Date: Wed, 4 Dec 2013 15:44:47 +0100 Subject: [PATCH 14/26] Fix saving sketches over sysupgrade. Closes https://github.com/Doodle3D/doodle3d-client/issues/87. --- post-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/post-install.sh b/post-install.sh index 2ece974..e4f07bb 100644 --- a/post-install.sh +++ b/post-install.sh @@ -68,7 +68,7 @@ EOM fi #preserve saved sketches during firmware update -echo "/root/sketches" >> /etc/sysupgrade.conf +echo "/root/sketches" >> $IPKG_INSTROOT/etc/sysupgrade.conf ### Finally make sure basic configuration is set correctly From 0e601baf2a016137664a3a5f6244ed4f51a990d5 Mon Sep 17 00:00:00 2001 From: peteruithoven Date: Wed, 4 Dec 2013 16:16:21 +0100 Subject: [PATCH 15/26] Enabling traveling by default --- src/conf_defaults.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/conf_defaults.lua b/src/conf_defaults.lua index 0e4d8df..6e523d8 100644 --- a/src/conf_defaults.lua +++ b/src/conf_defaults.lua @@ -249,7 +249,7 @@ M.printer_retraction_amount = { } M.printer_enableTraveling = { - default = false, + default = true, type = 'bool', description = '' } From 7ee1d9b47a8b5da91a4a6d80d5e799baeffa6d5b Mon Sep 17 00:00:00 2001 From: peteruithoven Date: Wed, 4 Dec 2013 17:13:33 +0100 Subject: [PATCH 16/26] Remove an deprecated dependancy --- src/util/settings.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/src/util/settings.lua b/src/util/settings.lua index d3be53e..28c21b5 100644 --- a/src/util/settings.lua +++ b/src/util/settings.lua @@ -8,7 +8,6 @@ local uci = require('uci').cursor() local utils = require('util.utils') local baseconfig = require('conf_defaults') -local subconfig = require('subconf_defaults') local utils = require('util.utils') local log = require('util.logger') From c33cc73b851d036504c712b4f5ad30335ce34eb8 Mon Sep 17 00:00:00 2001 From: Wouter R Date: Wed, 4 Dec 2013 17:40:43 +0100 Subject: [PATCH 17/26] Add option to update/install to not retain any files in flash memory. --- src/rest/api/api_update.lua | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/rest/api/api_update.lua b/src/rest/api/api_update.lua index 44e843d..37fccb0 100644 --- a/src/rest/api/api_update.lua +++ b/src/rest/api/api_update.lua @@ -2,7 +2,7 @@ local wifi = require('network.wlanconfig') local netconf = require('network.netconfig') local settings = require('util.settings') --- NOTE: the module 'detects' command-line invocation by existence of 'arg', so we have to make sure it is not defined. +-- NOTE: the updater module 'detects' command-line invocation by existence of 'arg', so we have to make sure it is not defined. argStash = arg arg = nil local updater = require('script.d3d-updater') @@ -140,18 +140,21 @@ function M.download_POST(request, response) end -- if successful, this call won't return since the device will flash its memory and reboot +-- accepts: version (string, will try to use most recent if not specified) +-- accepts: no_retain (bool, device will be completely cleaned if true (aka '-n' flag to sysupgrade)) function M.install_POST(request, response) local argVersion = request:get("version") + local argNoRetain = request:get("no_retain") log:info("API:update/install") if not operationsAccessOrFail(request, response) then return end updater.setLogger(log) updater.setState(updater.STATE.INSTALLING,"") - + local ssid = wifi.getSubstitutedSsid(settings.get('network.ap.ssid')) local rv,msg = netconf.enableAccessPoint(ssid) - + if not argVersion then local success,status,msg = updater.getStatus() if not success then @@ -174,7 +177,7 @@ function M.install_POST(request, response) return end - local rv,msg = updater.flashImageVersion(vEnt) + local rv,msg = updater.flashImageVersion(vEnt, argNoRetain) if not rv then updater.setState(updater.STATE.INSTALL_FAILED, "installation failed (" .. msg .. ")") From 1e106da3d290ac3cada2fdacce7726fb2d006567 Mon Sep 17 00:00:00 2001 From: peteruithoven Date: Thu, 5 Dec 2013 16:24:43 +0100 Subject: [PATCH 18/26] Added makerbot_replicator2x --- src/util/printer.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/src/util/printer.lua b/src/util/printer.lua index 1b67de3..5ff1f80 100644 --- a/src/util/printer.lua +++ b/src/util/printer.lua @@ -7,6 +7,7 @@ local SUPPORTED_PRINTERS = { ultimaker = "Ultimaker", ultimaker2 = "Ultimaker2", makerbot_replicator2 = "MakerBot Replicator2", + makerbot_replicator2x = "MakerBot Replicator2x", makerbot_thingomatic = "MakerBot Thing-o-matic", printrbot = "Printrbot", bukobot = "Bukobot", From 29faf69457c5e57535a617f3728c94ad6c0f8495 Mon Sep 17 00:00:00 2001 From: peteruithoven Date: Thu, 5 Dec 2013 16:49:34 +0100 Subject: [PATCH 19/26] Using default makerbot gcodes for replicator2x --- src/conf_defaults.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/conf_defaults.lua b/src/conf_defaults.lua index 6e523d8..26fecf1 100644 --- a/src/conf_defaults.lua +++ b/src/conf_defaults.lua @@ -114,6 +114,7 @@ M.printer_startcode = { 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', default_makerbot_generic = default_makerbot_startcode, default_makerbot_replicator2 = default_makerbot_startcode, + default_makerbot_replicator2x = default_makerbot_startcode, default_makerbot_thingomatic = default_makerbot_startcode, type = 'string', subSection = 'printer_type', @@ -126,6 +127,7 @@ M.printer_endcode = { 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)', default_makerbot_generic = default_makerbot_endcode, default_makerbot_replicator2 = default_makerbot_endcode, + default_makerbot_replicator2x = default_makerbot_endcode, default_makerbot_thingomatic = default_makerbot_endcode, type = 'string', subSection = 'printer_type', From 52a2d69bdd792413765a4936b9bae37e8c1f3e1f Mon Sep 17 00:00:00 2001 From: peteruithoven Date: Thu, 5 Dec 2013 16:50:37 +0100 Subject: [PATCH 20/26] Added "Generated with Doodle3D (ultimaker2)" to default ultimaker2 start gcode --- src/conf_defaults.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/conf_defaults.lua b/src/conf_defaults.lua index 26fecf1..44d3eff 100644 --- a/src/conf_defaults.lua +++ b/src/conf_defaults.lua @@ -111,7 +111,7 @@ M.printer_bed_height = { 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', + default_ultimaker2 = ';Generated with Doodle3D (ultimaker2)\nM109 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', default_makerbot_generic = default_makerbot_startcode, default_makerbot_replicator2 = default_makerbot_startcode, default_makerbot_replicator2x = default_makerbot_startcode, From 34491670b84b10687a39f3b3426bdfcbf6958047 Mon Sep 17 00:00:00 2001 From: Rick Companje Date: Thu, 5 Dec 2013 17:31:32 +0100 Subject: [PATCH 21/26] added printer/listall to API --- src/conf_defaults.lua | 27 +++++++++++++++++---------- src/rest/api/api_printer.lua | 9 +++++++++ 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/conf_defaults.lua b/src/conf_defaults.lua index 44d3eff..fa015db 100644 --- a/src/conf_defaults.lua +++ b/src/conf_defaults.lua @@ -93,15 +93,22 @@ M.printer_type = { end } -M.printer_bed_width = { - default = 220, +M.printer_dimensions_x = { + default = 200, subSection = 'printer_type', type = 'int', description = '', min = 0 } -M.printer_bed_height = { - default = 220, +M.printer_dimensions_y = { + default = 200, + subSection = 'printer_type', + type = 'int', + description = '', + min = 0 +} +M.printer_dimensions_z = { + default = 200, subSection = 'printer_type', type = 'int', description = '', @@ -256,12 +263,12 @@ M.printer_enableTraveling = { description = '' } -M.printer_maxObjectHeight = { - default = 150, - type = 'int', - description = 'Maximum height that will be printed', - min = 0 -} +-- M.printer_maxObjectHeight = { +-- default = 150, +-- type = 'int', +-- description = 'Maximum height that will be printed', +-- min = 0 +-- } M.printer_screenToMillimeterScale = { default = 0.3, diff --git a/src/rest/api/api_printer.lua b/src/rest/api/api_printer.lua index 4b584a4..d784ae9 100644 --- a/src/rest/api/api_printer.lua +++ b/src/rest/api/api_printer.lua @@ -89,6 +89,15 @@ function M.state(request, response, onlyReturnState) return true end +-- retrieve a list of 3D printers currently supported +function M.listall(request, response) + response:setSuccess() + response:addData('printers', printerUtils.supportedPrinters()) + return true +end + + + function M.heatup_POST(request, response) if not accessManager.hasControl(request.remoteAddress) then From 0308ac4b5d4597496717fec01b246acc13ea7201 Mon Sep 17 00:00:00 2001 From: Wouter R Date: Fri, 6 Dec 2013 15:10:07 +0100 Subject: [PATCH 22/26] Bump package version. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index f47d81e..402d8b5 100644 --- a/Makefile +++ b/Makefile @@ -15,7 +15,7 @@ IncludeWithNewlines = $(subst # Name and release number of this package PKG_NAME := wifibox -PKG_VERSION := 0.1.0 +PKG_VERSION := 0.1.1 PKG_RELEASE := 7 # This specifies the directory where we're going to build the program. From f534b7cf91d175583a5082e2673e51a0d945e763 Mon Sep 17 00:00:00 2001 From: peteruithoven Date: Mon, 9 Dec 2013 21:12:16 +0100 Subject: [PATCH 23/26] Less config logging --- src/util/settings.lua | 33 +++++---------------------------- 1 file changed, 5 insertions(+), 28 deletions(-) diff --git a/src/util/settings.lua b/src/util/settings.lua index 28c21b5..f5a85a5 100644 --- a/src/util/settings.lua +++ b/src/util/settings.lua @@ -150,7 +150,7 @@ end]]-- -- @p key The key to return the associated value for. -- @return The associated value, beware (!) that this may be boolean false for keys of 'bool' type. function M.get(key) - log:info("settings:get: "..utils.dump(key)) + --log:info("settings:get: "..utils.dump(key)) key = replaceDots(key) local base = getBaseKeyTable(key) @@ -158,29 +158,21 @@ function M.get(key) local section = UCI_CONFIG_SECTION; if base.subSection ~= nil then - log:info(" base.subSection: "..utils.dump(base.subSection)) section = M.get(base.subSection) end - log:info(" section: "..utils.dump(section)) local uciV = fromUciValue(uci:get(UCI_CONFIG_NAME, section, key), base.type) - log:info(" uciV: "..utils.dump(uciV)) - if uciV ~= nil then - log:info(" returning uciV: "..utils.dump(uciV)) + -- returning value from uci return uciV elseif base.subSection ~= nil then - log:info(" base.subSection: "..utils.dump(base.subSection)) - log:info(" section: "..utils.dump(section)) - log:info(" key: "..utils.dump(key)) - log:info(" subDefault key: "..utils.dump("default_"..section)) local subDefault = base["default_"..section] if subDefault ~= nil then - log:info(" returning subsection default: "..utils.dump(subDefault)) + -- returning subsection default value return subDefault end end - log:info(" returning default: "..utils.dump(base.default)) + -- returning default value return base.default end @@ -263,11 +255,9 @@ function M.set(key, value) local section = UCI_CONFIG_SECTION; if base.subSection ~= nil then - log:info(" base.subSection: "..utils.dump(base.subSection)) section = M.get(base.subSection) uci:set(UCI_CONFIG_NAME, section, UCI_CONFIG_TYPE) end - log:info(" section: "..utils.dump(section)) if value ~= nil then uci:set(UCI_CONFIG_NAME, section, key, toUciValue(value, base.type)) @@ -286,19 +276,14 @@ function M.resetAll() log:info("settings:resetAll") local allSections = uci:get_all(UCI_CONFIG_NAME) - log:info(" allSections: "..utils.dump(allSections)) for key,value in pairs(allSections) do if key ~= "system" and not key:match('^[A-Z_]*$') then --TEMP: skip 'constants', which should be moved anyway - log:info(" section: "..utils.dump(key)) uci:delete(UCI_CONFIG_NAME,key) end end uci:commit(UCI_CONFIG_NAME) - local allSections = uci:get_all(UCI_CONFIG_NAME) - log:info(" >allSections: "..utils.dump(allSections)) - return true end @@ -306,7 +291,7 @@ end -- @string key The key to reset. -- @treturn bool|nil True if everything went well, nil in case of error. function M.reset(key) - log:info("settings:reset: "..utils.dump(key)) + --log:info("settings:reset: "..utils.dump(key)) --uci:foreach(UCI_CONFIG_NAME,UCI_CONFIG_TYPE) --uci:delete(UCI_CONFIG_NAME, UCI_CONFIG_SECTION, key) @@ -317,19 +302,11 @@ function M.reset(key) local section = UCI_CONFIG_SECTION; if base.subSection ~= nil then - log:info(" base.subSection: "..utils.dump(base.subSection)) section = M.get(base.subSection) end - log:info(" section: "..utils.dump(section)) - - local uciV = fromUciValue(uci:get(UCI_CONFIG_NAME, section, key), base.type) - log:info(" uciV: "..utils.dump(uciV)) uci:delete(UCI_CONFIG_NAME, section, key) - local uciV = fromUciValue(uci:get(UCI_CONFIG_NAME, section, key), base.type) - log:info(" >uciV: "..utils.dump(uciV)) - uci:commit(UCI_CONFIG_NAME) return true end From 5ccbf6836268641d39a2f3e93e89715767e76adb Mon Sep 17 00:00:00 2001 From: peteruithoven Date: Mon, 9 Dec 2013 21:15:02 +0100 Subject: [PATCH 24/26] Unsilencing network connection attempts --- src/main.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.lua b/src/main.lua index ce2a413..7649424 100644 --- a/src/main.lua +++ b/src/main.lua @@ -172,7 +172,7 @@ local function init(environment) s, msg = wifi.init() if not s then return s, msg end - s, msg = netconf.init(wifi, true) + s, msg = netconf.init(wifi, false) if not s then return s, msg end return true From c69420b5b3850330312612b5671c3941f1c3f053 Mon Sep 17 00:00:00 2001 From: peteruithoven Date: Wed, 11 Dec 2013 16:57:44 +0100 Subject: [PATCH 25/26] IE aggressively caches ajax calls, adding this header makes it behaivior consistent with other browsers --- src/rest/response.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/src/rest/response.lua b/src/rest/response.lua index 84665f2..72e8474 100644 --- a/src/rest/response.lua +++ b/src/rest/response.lua @@ -149,6 +149,7 @@ function M:send() printHeaderLine("Status", self.httpStatusCode .. " " .. self.httpStatusText) printHeaderLine("Content-Type", self.contentType) printHeaderLine("Access-Control-Allow-Origin", "*") + printHeaderLine("Expires", "-1") if self.binaryData == nil then io.write("\r\n") From 021ec46e790c342065a7efe364517121ccc27f35 Mon Sep 17 00:00:00 2001 From: peteruithoven Date: Wed, 11 Dec 2013 17:30:16 +0100 Subject: [PATCH 26/26] Don't log network password --- src/network/netconfig.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/netconfig.lua b/src/network/netconfig.lua index e4a0d38..a126cd5 100644 --- a/src/network/netconfig.lua +++ b/src/network/netconfig.lua @@ -321,7 +321,7 @@ end -- @tparam boolean recreate If true, a new UCI configuration based on scan data will always be created, otherwise an attempt will be made to use an existing configuration. -- @return True on success or nil+msg on error. function M.associateSsid(ssid, passphrase, recreate) - log:info("netconfig:associateSsid: "..(ssid or "")..", "..(passphrase or "")..", "..(recreate or "")) + log:info("netconfig:associateSsid: "..(ssid or "")..", "..(recreate or "")) M.setStatus(M.CONNECTING,"Connecting...");