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
local argId = request:get("id")
local argGcode = request:get("gcode")
local printer,msg = printerUtils.createPrinterOrFail(argId, response)
if not printer then return end
-- replacing {printingTemp} and {preheatTemp} in endgcode
--[[
-- replacing variables in endgcode
local printingTemperature = settings.get('printer.temperature')
local printingBedTemperature = settings.get('printer.bed.temperature')
local preheatTemperature = settings.get('printer.heatup.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(" preheatBedTemperature: "..utils.dump(preheatBedTemperature))
--log:info(" endGcode : "..utils.dump(endGcode))
endGcode = string.gsub(endGcode,"{printingTemp}",printingTemperature)
endGcode = string.gsub(endGcode,"{printingBedTemp}",printingBedTemperature)
endGcode = string.gsub(endGcode,"{preheatTemp}",preheatTemperature)
endGcode = string.gsub(endGcode,"{preheatBedTemp}",preheatBedTemperature)
--log:info(" >endGcode : "..utils.dump(endGcode))
--log:info(" endCode : "..utils.dump(endCode))
endCode = string.gsub(endCode,"{printingTemp}",printingTemperature)
endCode = string.gsub(endCode,"{printingBedTemp}",printingBedTemperature)
endCode = string.gsub(endCode,"{preheatTemp}",preheatTemperature)
endCode = string.gsub(endCode,"{preheatBedTemp}",preheatBedTemperature)
--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)
if rv then response:setSuccess()