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

API:printer/stop doesn't automatically send endcode, you have to specify it trough a gcode argument

This commit is contained in:
peteruithoven 2013-10-28 17:13:26 +01:00
parent 88a779e8bf
commit 23d077c4ca

View File

@ -119,26 +119,32 @@ function M.stop_POST(request, response)
end end
local argId = request:get("id") local argId = request:get("id")
local argGcode = request:get("gcode")
local printer,msg = printerUtils.createPrinterOrFail(argId, response) local printer,msg = printerUtils.createPrinterOrFail(argId, response)
if not printer then return end if not printer then return end
-- replacing {printingTemp} and {preheatTemp} in endgcode --[[
-- replacing variables in endgcode
local printingTemperature = settings.get('printer.temperature') local printingTemperature = settings.get('printer.temperature')
local printingBedTemperature = settings.get('printer.bed.temperature') local printingBedTemperature = settings.get('printer.bed.temperature')
local preheatTemperature = settings.get('printer.heatup.temperature') local preheatTemperature = settings.get('printer.heatup.temperature')
local preheatBedTemperature = settings.get('printer.heatup.bed.temperature') local preheatBedTemperature = settings.get('printer.heatup.bed.temperature')
local endGcode = settings.get('printer.endgcode') local endCode = settings.get('printer.endcode.marlin')
--log:info(" printingBedTemperature: "..utils.dump(printingBedTemperature)) --log:info(" printingBedTemperature: "..utils.dump(printingBedTemperature))
--log:info(" preheatBedTemperature: "..utils.dump(preheatBedTemperature)) --log:info(" preheatBedTemperature: "..utils.dump(preheatBedTemperature))
--log:info(" endGcode : "..utils.dump(endGcode)) --log:info(" endCode : "..utils.dump(endCode))
endGcode = string.gsub(endGcode,"{printingTemp}",printingTemperature) endCode = string.gsub(endCode,"{printingTemp}",printingTemperature)
endGcode = string.gsub(endGcode,"{printingBedTemp}",printingBedTemperature) endCode = string.gsub(endCode,"{printingBedTemp}",printingBedTemperature)
endGcode = string.gsub(endGcode,"{preheatTemp}",preheatTemperature) endCode = string.gsub(endCode,"{preheatTemp}",preheatTemperature)
endGcode = string.gsub(endGcode,"{preheatBedTemp}",preheatBedTemperature) endCode = string.gsub(endCode,"{preheatBedTemp}",preheatBedTemperature)
--log:info(" >endGcode : "..utils.dump(endGcode)) --log:info(" >endCode : "..utils.dump(endCode))
]]--
local rv,msg = printer:stopPrint(endGcode) if(argGcode == nil) then
argGcode = ""
end
local rv,msg = printer:stopPrint(argGcode)
response:addData('id', argId) response:addData('id', argId)
if rv then response:setSuccess() if rv then response:setSuccess()