0
0
mirror of https://github.com/Doodle3D/doodle3d-firmware.git synced 2024-11-16 18:47:57 +01:00

Compare commits

..

No commits in common. "master" and "0.10.12-a" have entirely different histories.

10 changed files with 24 additions and 298 deletions

View File

@ -126,10 +126,6 @@ define Package/wifibox/install
$(INSTALL_BIN) $(WIFIBOX_BASE_DIR)/script/signin.sh $(1)/$(TGT_LUA_DIR_SUFFIX)/script
$(CP) $(WIFIBOX_BASE_DIR)/script/logrotate-wifibox.conf $(1)/etc/logrotate.d/wifibox.conf
$(INSTALL_BIN) $(WIFIBOX_BASE_DIR)/script/print-fetch.lua $(1)/$(TGT_LUA_DIR_SUFFIX)/script
$(LN) -s /$(TGT_LUA_DIR_SUFFIX)/script/print-fetch.lua $(1)/bin/print-fetch
$(CP) $(WIFIBOX_BASE_DIR)/script/wifibox.uci.config $(1)/etc/config/wifibox # copy base configuration to uci config dir
$(CP) $(WIFIBOX_BASE_DIR)/FIRMWARE-VERSION $(1)/etc/wifibox-version

View File

@ -12,18 +12,6 @@ Make sure the 'ldoc' program is installed on your machine and the LDOC variable
On OSX, this can be accomplished by installing it through luarocks (run `sudo luarocks install ldoc`). Luarocks can be installed using [MacPorts](http://www.macports.org/). After installing that, the command would be `sudo port install luarocks`.
Command line interface
----------------------
The Doodle3D API can be called using a terminal:
```d3dapi p=/network/scan r=GET```
Where the p parameter is the module you want to call and r is the method.
Post request can be send using the same method:
```d3dapi p=/printer/print r=POST```
Parameters: TODO
Debugging Lua
-------------

View File

@ -1,25 +1,4 @@
Changelog
# 0.11.0 (12 jul 2017)
# 0.11.0-c (10 jul 2017)
- fix: Also closing file descriptor after removing current print file (commit 550e151)
# 0.11.0-b (6 jul 2017)
- show id of current print in d3dapi/info/status when printing in 'fetch' mode.
- code reuse and cleanup for control, kill and status
# 0.11.0-a (23 jun 2017)
- Added 'fetch' functionality to let the WiFi-Box print from a remote server. This enables the WiFi-Box to print large g-code files. (yeah!)
- Added support for the Renkforce RF100 printer.
- Changed 'default startcode' to prevent Ultimaker 2 series to bump into platform [#21](https://github.com/Doodle3D/WiFi-Box/issues/21) when Ultimaker (original) is selected.
- Changed default nozzle temperature from 230 to 210 °C.
- Fixed corrupted endcode for delta printers.
- Changed default endcode to cooldown to 0 after print instead of cooling down to preheat temperature.
# 0.10.12
# 0.10.12-b (12 jan 2017)
- Post install update to config for changes in 0.10.10 (fixes print3d logging)
# 0.10.12-a (26 jul 2016)
- Added Ultimaker Original Plus (Thanks Remco)
- Added extra usb drivers

View File

@ -138,11 +138,6 @@ else
uci set wifibox.general.system_log_level='info'
uci -q delete wifibox.system.loglevel # remove key used in older versions (<=0.10.8a) if it exists
# update wifibox's config for config changes in 0.10.10
uci set wifibox.system.log_path='/tmp'
uci set wifibox.system.api_log_filename='wifibox.log'
uci set wifibox.system.p3d_log_basename='print3d'
crontab -l 2> /dev/null | grep logrotate\.conf > /dev/null
if [ $? -ne 0 ]; then
# add line, method from http://askubuntu.com/a/58582

View File

@ -1 +1 @@
0.11.0
0.10.12-a

View File

@ -128,7 +128,6 @@ M.printer_dimensions_x = {
default_minifactory = 150,
default_lulzbot_taz_4 = 298,
default_ultimaker2go = 120,
default_renkforce_rf100 = 100,
default_doodle_dream = 120,
default_wanhao_duplicator4 = 210,
default_colido_2_0_plus = 230,
@ -149,7 +148,6 @@ M.printer_dimensions_y = {
default_minifactory = 150,
default_lulzbot_taz_4 = 275,
default_ultimaker2go = 120,
default_renkforce_rf100 = 100,
default_doodle_dream = 120,
default_wanhao_duplicator4 = 140,
default_colido_2_0_plus = 150,
@ -166,7 +164,6 @@ M.printer_dimensions_z = {
default__3Dison_plus = 150,
default_lulzbot_taz_4 = 250,
default_ultimaker2go = 112,
default_renkforce_rf100 = 100,
default_doodle_dream = 80,
default_wanhao_duplicator4 = 140,
default_colido_2_0_plus = 140,
@ -197,7 +194,6 @@ M.printer_heatedbed = {
M.printer_filamentThickness = {
default = 2.89,
default_doodle_dream = 1.75,
default_renkforce_rf100 = 1.75,
default_wanhao_duplicator4 = 1.75,
default_craftbot_plus = 1.75,
type = 'float',
@ -211,7 +207,7 @@ local default_deltabot_startcode = ';Generated with Doodle3D (deltabot)\nM109 S{
local default_ultimaker2_startcode = ';Generated with Doodle3D (ultimaker2)\nM10000\nM10000\nM10001 X8 Y28 SDoodle3D heat up...\nM109 S{printingTemp} ;set target temperature \n{if heatedBed}M190 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\nM10000\nM10000\nM10001 X8 Y28 SDoodle3D printing...\n'
local default_ultimaker_original_plus_startcode = ';Generated with Doodle3D (Ultimaker Original Plus)\n{if heatedBed}M190 S{printingBedTemp}\nM109 S{printingTemp}\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.printer_startcode = {
default = ';Generated with Doodle3D (default)\nM109 S{printingTemp} ;set target temperature \n{if heatedBed}M190 S{printingBedTemp} ;set target bed temperature\nG21 ;metric values\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\nG91 ;relative positioning\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 = ';Generated with Doodle3D (default)\nM109 S{printingTemp} ;set target temperature \n{if heatedBed}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 = default_ultimaker2_startcode,
default_ultimaker2go = default_ultimaker2_startcode,
default__3Dison_plus = ';@printer {printerType}\nM136 (enable build)\nM73 P0\nG21\nG90\nM103\n;M109 S50 T0\nM140 S50 T0\nM104 S{printingTemp} T0\n;M134 T0\nM135 T0\nM104 S{printingTemp} T0\nG162 X Y F2000(home XY axes maximum)\nG161 Z F900(home Z axis minimum)\nG92 X113.5 Y74 Z-5 A0 B0 (set Z to -5)\nG1 Z0.0 F900(move Z to 0)\nG161 Z F100(home Z axis minimum)\nM132 X Y Z A B (Recall stored home offsets for XYZAB axis)\nG1 Z50 F3300\nG130 X20 Y20 A20 B20 (Lower stepper Vrefs while heating)\nM133 T0\nM6 T0\nG130 X127 Y127 A127 B127 (Set Stepper motor Vref to defaults)\nG0 Z0.2 F3000\nG1 Z0 F100 A10 ;extrude 10mm\nG92 X227 Y148 Z0 A0 ;reset again\nG1 X227 Y148 Z0',
@ -229,14 +225,14 @@ M.printer_startcode = {
description = ''
}
local default_makerbot_endcode = 'G92 A0 B0 ;reset extruder position to prevent retraction\nM18 A B(Turn off A and B Steppers)\nG162 Z F900\nG162 X Y F2000\nM18 X Y Z(Turn off steppers after a build)\n{if heatedBed}M140 S0 T0\nM104 S0 T0\nM72 P1 ( Play Ta-Da song )\nM137 (build end notification)'
local default_deltabot_endcode = '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 ;move to home\nM84 ;disable axes / steppers\nG90 ;absolute positioning\nM109 S0 ; hot end off\n{if heatedBed}M140 S0\nM117 Done ;display message (20 characters to clear whole screen)'
local default_ultimaker2_endcode = 'M10000\nM10000\nM10001 X20 Y28 SDoodle3D done!\nM107 ;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 S0\n{if heatedBed}M140 S0\n'
local default_makerbot_endcode = 'G92 A0 B0 ;reset extruder position to prevent retraction\nM18 A B(Turn off A and B Steppers)\nG162 Z F900\nG162 X Y F2000\nM18 X Y Z(Turn off steppers after a build)\n{if heatedBed}M140 S{preheatBedTemp} T0\nM104 S{preheatTemp} T0\nM72 P1 ( Play Ta-Da song )\nM137 (build end notification)'
local default_deltabot_endcode = 'M107 ;fan offG91 ;relative positioningG1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressureG1 Z+0.5 E-5 X-20 Y-20 F9000 ;move Z up a bit and retract filament even moreG28 ;move to homeM84 ;disable axes / steppersG90 ;absolute positioningM109 S0 ; hot end off{if heatedBed}M140 S{preheatBedTemp}M117 Done ;display message (20 characters to clear whole screen)'
local default_ultimaker2_endcode = 'M10000\nM10000\nM10001 X20 Y28 SDoodle3D done!\nM107 ;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}\n{if heatedBed}M140 S{preheatBedTemp}\n'
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 S0\n{if heatedBed}M140 S0\nM117 Done ;display message (20 characters to clear whole screen)',
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{if heatedBed}M140 S{preheatBedTemp}\nM117 Done ;display message (20 characters to clear whole screen)',
default_ultimaker2 = default_ultimaker2_endcode,
default_ultimaker2go = default_ultimaker2_endcode,
default__3Dison_plus = 'M73 P100\nG92 A0 B0 ;reset extruder position to prevent retraction\nM18 A B(Turn off A and B Steppers)\nG1 Z155 F900\nG162 X Y F2000\nM18 X Y Z(Turn off steppers after a build)\nM140 S0 T0\nM104 S0 T0\nM73 P100 (end build progress )\nM72 P1 ( Play Ta-Da song )\nM137 (build end notification)\n',
default__3Dison_plus = 'M73 P100\nG92 A0 B0 ;reset extruder position to prevent retraction\nM18 A B(Turn off A and B Steppers)\nG1 Z155 F900\nG162 X Y F2000\nM18 X Y Z(Turn off steppers after a build)\nM140 S35 T0\nM104 S180 T0\nM73 P100 (end build progress )\nM72 P1 ( Play Ta-Da song )\nM137 (build end notification)\n',
default_makerbot_generic = default_makerbot_endcode,
default_makerbot_replicator2 = default_makerbot_endcode,
default_makerbot_replicator2x = default_makerbot_endcode,
@ -245,7 +241,7 @@ M.printer_endcode = {
default_delta_rostockmax = default_deltabot_endcode,
default_deltamaker = default_deltabot_endcode,
default_kossel = default_deltabot_endcode,
default_craftbot_plus = '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\nM109 S0\n{if heatedBed}M140 S0\nM117 Done ;display message (20 characters to clear whole screen)',
default_craftbot_plus = '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\nM109 S{preheatTemp}\n{if heatedBed}M140 S{preheatBedTemp}\nM117 Done ;display message (20 characters to clear whole screen)',
type = 'string',
subSection = 'printer_type',
description = ''
@ -262,7 +258,7 @@ M.printer_baudrate = {
}
M.printer_temperature = {
default = 210,
default = 230,
type = 'int',
description = 'printing temperature',
min = 0
@ -334,19 +330,19 @@ M.printer_bottomEnableTraveling = {
}
M.printer_heatup_enabled = {
default = false,
default = true,
type = 'bool',
description = ''
}
M.printer_heatup_temperature = {
default = 0,
default = 180,
type = 'int',
description = ''
}
M.printer_heatup_bed_temperature = {
default = 0,
default = 70,
type = 'int',
description = ''
}
@ -422,10 +418,4 @@ M.doodle3d_update_baseUrl = {
description = ''
}
M.gcode_server = {
default = 'http://gcodeserver.doodle3d.com',
type = 'string',
description =''
}
return M

View File

@ -48,36 +48,6 @@ function M.temperature(request, response)
end
end
local function setCurrentPrint(id)
local cpfileName = "/tmp/current-print"
if id == nil then
io.popen('rm ' .. cpfileName):close()
return true
end
local cpfile = io.open(cpfileName, 'w+')
if cpfile == nil then
return false
end
cpfile:write(id)
cpfile:close()
return true
end
local function getCurrentPrint()
local idfile = io.open('/tmp/current-print')
if idfile ~= nil then
return idfile:read('*a')
end
end
local function stopFetch()
log:verbose(MOD_ABBR, "stopping print-fetch and removing start/endgcode")
io.popen("killall print-fetch"):close()
io.popen("rm /tmp/startcode /tmp/endcode"):close()
setCurrentPrint(nil)
end
function M.progress(request, response)
local argId = request:get("id")
local printer,msg = printerUtils.createPrinterOrFail(argId, response)
@ -86,13 +56,7 @@ function M.progress(request, response)
-- NOTE: despite their names, `currentLine` is still the error indicator and `bufferedLines` the message in such case.
local currentLine,bufferedLines,totalLines,bufferSize,maxBufferSize,seqNumber,seqTotal = printer:getProgress()
local printId = getCurrentPrint()
response:addData('id', argId)
if printId ~= nil then
response:addData('current_print', printId)
end
if currentLine then
response:setSuccess()
response:addData('current_line', currentLine)
@ -192,14 +156,11 @@ function M.stop_POST(request, response)
local printer,msg = printerUtils.createPrinterOrFail(argId, response)
if not printer or not printer:hasSocket() then return end
stopFetch()
if(argGcode == nil) then
argGcode = ""
end
local rv,msg = printer:stopPrint(argGcode)
response:addData('id', argId)
if rv then
response:setSuccess()
@ -224,81 +185,6 @@ local function addSequenceNumbering(printer, response)
end
end
function M.fetch_POST(request, response)
if not accessManager.hasControl(request.remoteAddress) then
response:setFail("No control access")
return
else
accessManager.setController(request.remoteAddress)
end
local printer,msg = printerUtils.createPrinterOrFail(argId, response)
if not printer or not printer:hasSocket() then return end
local state = printer:getState()
if state ~= "idle" then
response:setFail("printer is not idle")
return
end
log:verbose(MOD_ABBR, " clearing all gcode for " .. printer:getId())
stopFetch()
local rv,msg = printer:clearGcode()
if rv == false then
response:addData('status', msg)
response:setFail("could not clear gcode (" .. msg .. ")")
elseif rv == nil then
response:setError(msg)
return
end
local gcodeFiles = " "
local startCode = request:get("start_code")
if startCode ~= nil then
gcodeFiles = gcodeFiles .. '/tmp/startcode '
local startCodeFile = io.open('/tmp/startcode', 'w+')
if startCodeFile == nil then
response:setError("could not open startCode file for writing")
return
end
startCodeFile:write(startCode)
end
local endCode = request:get("end_code")
if endCode ~= nil then
gcodeFiles = gcodeFiles .. '/tmp/endcode '
local endCodeFile = io.open('/tmp/endcode', 'w+')
if endCodeFile == nil then
response:setError("could not open endcode file for writing")
return
end
endCodeFile:write(endCode)
end
local socket = printer:getId()
if socket == nil then
response:setError("no socket found")
return
end
local gcodeServer = settings.get('gcode.server')
if gcodeServer == nil then
response:setError("no gcode server configured")
return
end
local id = request:get("id")
if id == nil then
response:setError("no id supplied")
return
end
setCurrentPrint(id)
log:info(MOD_ABBR, " starting fetch print. id: " .. id .. " server: " .. gcodeServer)
io.popen("print-fetch " .. socket .. " " .. gcodeServer .. " " .. id .. gcodeFiles)
response:setSuccess()
end
--requires: gcode(string) (the gcode to be appended)
--accepts: id(string) (the printer ID to append to)
--accepts: clear(bool) (chunks will be concatenated but output file will be cleared first if this argument is true)
@ -311,12 +197,20 @@ end
-- a fail with a (formal, i.e., parseable) status argument will be returned;
-- additionally, current sequence number and total will be returned (both are -1 if they have not been set)
function M.print_POST(request, response)
if not accessManager.hasControl(request.remoteAddress) then
local controllerIP = accessManager.getController()
local hasControl = false
if controllerIP == "" then
accessManager.setController(request.remoteAddress)
hasControl = true
elseif controllerIP == request.remoteAddress then
hasControl = true
end
if not hasControl then
response:setFail("No control access")
return
else
accessManager.setController(request.remoteAddress)
end
local argId = request:get("id")
local argGcode = request:get("gcode")
local argClear = utils.toboolean(request:get("clear"))
@ -332,8 +226,6 @@ function M.print_POST(request, response)
local printer,msg = printerUtils.createPrinterOrFail(argId, response)
if not printer or not printer:hasSocket() then return end
stopFetch()
response:addData('id', argId)
if argGcode == nil or argGcode == '' then

View File

@ -1,112 +0,0 @@
#!/usr/bin/lua
local function log(message)
os.execute("logger " .. message)
print(message)
end
if (table.getn(arg) == 0) then
print("Usage: ./print-fetch {printerSocket} {gcodeServerURL} {id} [startGcode] [endGCode]")
return
end
log("starting gcode fetch program")
package.cpath = package.cpath .. '/usr/lib/lua/?.so'
JSON = (loadfile "/usr/share/lua/wifibox/util/JSON.lua")()
local p3d = require("print3d")
local printer = p3d.getPrinter(arg[1])
if printer == nil then
log("error connecting to printer")
return
end
local gcodeServer = arg[2]
local finished = false
local id = arg[3]
log("gcode file id: " .. id)
log("gcode server: " .. gcodeServer)
local info = JSON:decode(io.popen("wget -qO - " .. gcodeServer .. "/info/" .. id):read("*a"))
if info == nil then
log("could not retrieve file info")
return
end
local current_line = 0
local total_lines = tonumber(info["lines"])
local started = false
log("total lines: " .. total_lines)
local startCode = nil
local endCode = nil
function countlines(file)
return tonumber(io.popen("wc -l < " .. file):read('*a'))
end
function readGCodeArg(argi)
local gcodeFile = arg[argi]
return io.open(gcodeFile):read('*a')
end
if table.getn(arg) >= 5 then
startCode = readGCodeArg(4)
endCode = readGCodeArg(5)
end
if startCode ~= nil then
log("appending start gcode")
printer:appendGcode(startCode)
end
while(not finished)
do
local f = io.popen("wget -qO - " .. gcodeServer .. "/fetch/" .. id .. "/" .. current_line)
local line = f:read()
while line ~= nil do
printer:appendGcode(line, total_lines, { seq_number = -1, seq_total = -1, source = id })
current_line = current_line + 1
line = f:read()
end
if not started then
started = true
print("send print start command")
printer:startPrint()
end
if current_line >= total_lines then
log("finished fetching gcode")
if endCode ~= nil then
log("appending end gcode")
printer:appendGcode(endCode, total_lines, { seq_number = -1, seq_total = -1, source = id })
end
finished = true
break
end
local accepts_new_gcode = false
while (not accepts_new_gcode)
do
local current,buffer,total,bufferSize,maxBufferSize = printer:getProgress()
local percentageBufferSize = bufferSize / maxBufferSize
if percentageBufferSize < 0.8 then
print("buffer below 80% capacity, sending new gcode")
accepts_new_gcode = true
else
print("buffer above 80% capacity")
os.execute("sleep 10")
end
end
end

View File

@ -10,4 +10,3 @@ config settings 'system'
config settings 'general'
option printer_type 'ultimaker'
option gcode_server 'http://gcodeserver.doodle3d.com'

View File

@ -63,8 +63,7 @@ local SUPPORTED_PRINTERS = {
colido_x3045 = "ColiDo X3045",
colido_compact = "ColiDo Compact",
colido_diy = "ColiDo DIY",
craftbot_plus = "CraftBot PLUS",
renkforce_rf100 = "Renkforce RF100"
craftbot_plus = "CraftBot PLUS"
}
local SUPPORTED_BAUDRATES = {
["115200"] = "115200 bps",