mirror of
https://github.com/Doodle3D/doodle3d-firmware.git
synced 2024-09-27 21:58:38 +02:00
Compare commits
18 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
924285b51e | ||
|
d453818455 | ||
|
550e151153 | ||
|
2ee6b05e61 | ||
|
c3e4ec88a8 | ||
|
59c71a34ba | ||
|
e5de852087 | ||
|
02fc0ea91b | ||
|
634465fdd6 | ||
|
1bbb327178 | ||
|
fdbc07b377 | ||
|
c536fe3221 | ||
|
db259bbfc6 | ||
|
22b6abfd8b | ||
|
2883a066ef | ||
|
8adc74876e | ||
|
753672e164 | ||
|
0acc20f498 |
@ -1,4 +1,13 @@
|
|||||||
Changelog
|
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)
|
# 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 '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.
|
- Added support for the Renkforce RF100 printer.
|
||||||
|
@ -1 +1 @@
|
|||||||
0.11.0-a
|
0.11.0
|
@ -48,6 +48,36 @@ function M.temperature(request, response)
|
|||||||
end
|
end
|
||||||
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)
|
function M.progress(request, response)
|
||||||
local argId = request:get("id")
|
local argId = request:get("id")
|
||||||
local printer,msg = printerUtils.createPrinterOrFail(argId, response)
|
local printer,msg = printerUtils.createPrinterOrFail(argId, response)
|
||||||
@ -56,11 +86,7 @@ function M.progress(request, response)
|
|||||||
-- NOTE: despite their names, `currentLine` is still the error indicator and `bufferedLines` the message in such case.
|
-- 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 currentLine,bufferedLines,totalLines,bufferSize,maxBufferSize,seqNumber,seqTotal = printer:getProgress()
|
||||||
|
|
||||||
local idfile = io.open('/tmp/currentprint')
|
local printId = getCurrentPrint()
|
||||||
local printId
|
|
||||||
if idfile ~= nil then
|
|
||||||
printId = idfile:read('*a')
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
response:addData('id', argId)
|
response:addData('id', argId)
|
||||||
@ -166,14 +192,13 @@ function M.stop_POST(request, response)
|
|||||||
local printer,msg = printerUtils.createPrinterOrFail(argId, response)
|
local printer,msg = printerUtils.createPrinterOrFail(argId, response)
|
||||||
if not printer or not printer:hasSocket() then return end
|
if not printer or not printer:hasSocket() then return end
|
||||||
|
|
||||||
|
stopFetch()
|
||||||
|
|
||||||
if(argGcode == nil) then
|
if(argGcode == nil) then
|
||||||
argGcode = ""
|
argGcode = ""
|
||||||
end
|
end
|
||||||
local rv,msg = printer:stopPrint(argGcode)
|
local rv,msg = printer:stopPrint(argGcode)
|
||||||
|
|
||||||
io.popen("killall print-fetch")
|
|
||||||
io.popen("rm /tmp/currentprint /tmp/startcode /tmp/endcode")
|
|
||||||
|
|
||||||
|
|
||||||
response:addData('id', argId)
|
response:addData('id', argId)
|
||||||
if rv then
|
if rv then
|
||||||
@ -200,32 +225,24 @@ local function addSequenceNumbering(printer, response)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function M.fetch_POST(request, response)
|
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)
|
local printer,msg = printerUtils.createPrinterOrFail(argId, response)
|
||||||
if not printer or not printer:hasSocket() then return end
|
if not printer or not printer:hasSocket() then return end
|
||||||
|
|
||||||
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
|
|
||||||
end
|
|
||||||
|
|
||||||
local state = printer:getState()
|
local state = printer:getState()
|
||||||
if state ~= "idle" then
|
if state ~= "idle" then
|
||||||
response:setError("printer is not idle")
|
response:setFail("printer is not idle")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
log:verbose(MOD_ABBR, " clearing all gcode for " .. printer:getId())
|
log:verbose(MOD_ABBR, " clearing all gcode for " .. printer:getId())
|
||||||
response:addData('gcode_clear',true)
|
stopFetch()
|
||||||
local rv,msg = printer:clearGcode()
|
local rv,msg = printer:clearGcode()
|
||||||
|
|
||||||
if rv == false then
|
if rv == false then
|
||||||
@ -257,7 +274,6 @@ function M.fetch_POST(request, response)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
endCodeFile:write(endCode)
|
endCodeFile:write(endCode)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local socket = printer:getId()
|
local socket = printer:getId()
|
||||||
@ -275,14 +291,9 @@ function M.fetch_POST(request, response)
|
|||||||
response:setError("no id supplied")
|
response:setError("no id supplied")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local cpfile = io.open("/tmp/currentprint", 'w+')
|
setCurrentPrint(id)
|
||||||
if cpfile == nil then
|
|
||||||
response:setError("could not save id")
|
|
||||||
return
|
|
||||||
end
|
|
||||||
cpfile:write(id)
|
|
||||||
cpfile:close()
|
|
||||||
|
|
||||||
|
log:info(MOD_ABBR, " starting fetch print. id: " .. id .. " server: " .. gcodeServer)
|
||||||
io.popen("print-fetch " .. socket .. " " .. gcodeServer .. " " .. id .. gcodeFiles)
|
io.popen("print-fetch " .. socket .. " " .. gcodeServer .. " " .. id .. gcodeFiles)
|
||||||
|
|
||||||
response:setSuccess()
|
response:setSuccess()
|
||||||
@ -300,20 +311,12 @@ end
|
|||||||
-- a fail with a (formal, i.e., parseable) status argument will be returned;
|
-- 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)
|
-- additionally, current sequence number and total will be returned (both are -1 if they have not been set)
|
||||||
function M.print_POST(request, response)
|
function M.print_POST(request, response)
|
||||||
local controllerIP = accessManager.getController()
|
if not accessManager.hasControl(request.remoteAddress) then
|
||||||
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")
|
response:setFail("No control access")
|
||||||
return
|
return
|
||||||
|
else
|
||||||
|
accessManager.setController(request.remoteAddress)
|
||||||
end
|
end
|
||||||
|
|
||||||
local argId = request:get("id")
|
local argId = request:get("id")
|
||||||
local argGcode = request:get("gcode")
|
local argGcode = request:get("gcode")
|
||||||
local argClear = utils.toboolean(request:get("clear"))
|
local argClear = utils.toboolean(request:get("clear"))
|
||||||
@ -329,6 +332,8 @@ function M.print_POST(request, response)
|
|||||||
local printer,msg = printerUtils.createPrinterOrFail(argId, response)
|
local printer,msg = printerUtils.createPrinterOrFail(argId, response)
|
||||||
if not printer or not printer:hasSocket() then return end
|
if not printer or not printer:hasSocket() then return end
|
||||||
|
|
||||||
|
stopFetch()
|
||||||
|
|
||||||
response:addData('id', argId)
|
response:addData('id', argId)
|
||||||
|
|
||||||
if argGcode == nil or argGcode == '' then
|
if argGcode == nil or argGcode == '' then
|
||||||
|
Loading…
Reference in New Issue
Block a user