0
0
mirror of https://github.com/Doodle3D/doodle3d-firmware.git synced 2024-12-22 02:53:49 +01:00

stop fetch program in printer/{fetch,print}. Fixes issue #74

This commit is contained in:
Simon Voordouw 2017-07-06 14:11:59 +02:00
parent 2883a066ef
commit 22b6abfd8b

View File

@ -71,6 +71,9 @@ local function getCurrentPrint()
end end
end end
local function stopFetch()
io.popen("killall print-fetch")
end
function M.progress(request, response) function M.progress(request, response)
local argId = request:get("id") local argId = request:get("id")
@ -186,7 +189,7 @@ 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
io.popen("killall print-fetch") stopFetch()
io.popen("rm /tmp/startcode /tmp/endcode") io.popen("rm /tmp/startcode /tmp/endcode")
setCurrentPrint(nil) setCurrentPrint(nil)
@ -246,7 +249,7 @@ function M.fetch_POST(request, response)
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
@ -344,6 +347,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