0
0
mirror of https://github.com/Doodle3D/doodle3d-firmware.git synced 2024-11-14 17:57:57 +01:00

add end and start-gcode parameters to printer/fetch API

This commit is contained in:
Simon Voordouw 2017-06-12 17:21:09 +02:00
parent b2590e4142
commit 5607ab96ad

View File

@ -216,10 +216,23 @@ function M.fetch_POST(request, response)
return
end
local gcodeFiles = " "
local startCode = request:get("start_code")
if startCode != nil then
gcodeFiles = gcodeFiles .. '/tmp/startcode '
io.open('/tmp/startcode', 'w+').write(startCode)
end
local endCode = request:get("end_code")
if endCode != nil then
gcodeFiles = gcodeFiles .. '/tmp/endcode '
io.open('/tmp/endcode', 'w+').write(endCode)
end
local socket = printer:getId()
local remote = settings.get('gcode_server')
local id = request:get("id")
io.popen("print-fetch " .. socket .. " " .. remote .. " " .. id)
io.popen("print-fetch " .. socket .. " " .. remote .. " " .. id .. gcodeFiles)
response:setSuccess()
end