check if printer is idle before fetching

This commit is contained in:
Simon Voordouw 2017-06-19 16:13:07 +02:00
parent a5bf23c95c
commit a9c2f6096c
1 changed files with 6 additions and 0 deletions

View File

@ -203,6 +203,12 @@ function M.fetch_POST(request, response)
return
end
local state = printer:getState()
if state ~= "idle" then
response:setError("printer is not idle")
return
end
log:verbose(MOD_ABBR, " clearing all gcode for " .. printer:getId())
response:addData('gcode_clear',true)