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

rename remote to gcodeServer for clarity

This commit is contained in:
Simon Voordouw 2017-06-20 15:18:36 +02:00
parent 8eb83ac6a0
commit 6729af7064
2 changed files with 9 additions and 8 deletions

View File

@ -252,8 +252,8 @@ function M.fetch_POST(request, response)
response:setError("no socket found") response:setError("no socket found")
return return
end end
local remote = settings.get('gcode.server') local gcodeServer = settings.get('gcode.server')
if remote == nil then if gcodeServer == nil then
response:setError("no gcode server configured") response:setError("no gcode server configured")
return return
end end
@ -262,7 +262,8 @@ function M.fetch_POST(request, response)
response:setError("no id supplied") response:setError("no id supplied")
return return
end end
io.popen("print-fetch " .. socket .. " " .. remote .. " " .. id .. gcodeFiles) io.popen("print-fetch " .. socket .. " " .. gcodeServer .. " " .. id .. gcodeFiles)
io.open("/tmp/current-print", 'w+').write(id) io.open("/tmp/current-print", 'w+').write(id)
response:setSuccess() response:setSuccess()
end end

View File

@ -6,7 +6,7 @@ local function log(message)
end end
if (table.getn(arg) == 0) then if (table.getn(arg) == 0) then
print("Usage: ./print-fetch {printerSocket} {remoteURL} {id} [startGcode] [endGCode]") print("Usage: ./print-fetch {printerSocket} {gcodeServerURL} {id} [startGcode] [endGCode]")
return return
end end
@ -23,16 +23,16 @@ if printer == nil then
return return
end end
local remote = arg[2] local gcodeServer = arg[2]
local finished = false local finished = false
local id = arg[3] local id = arg[3]
log("gcode file id: " .. id) log("gcode file id: " .. id)
log("gcode server: " .. remote) log("gcode server: " .. gcodeServer)
local info = JSON:decode(io.popen("wget -qO - " .. remote .. "/info/" .. id):read("*a")) local info = JSON:decode(io.popen("wget -qO - " .. gcodeServer .. "/info/" .. id):read("*a"))
local current_line = 0 local current_line = 0
local total_lines = tonumber(info["lines"]) local total_lines = tonumber(info["lines"])
@ -65,7 +65,7 @@ end
while(not finished) while(not finished)
do do
local f = io.popen("wget -qO - " .. remote .. "/fetch/" .. id .. "/" .. current_line) local f = io.popen("wget -qO - " .. gcodeServer .. "/fetch/" .. id .. "/" .. current_line)
local line = f:read() local line = f:read()
while line ~= nil do while line ~= nil do
printer:appendGcode(line, total_lines, { seq_number = -1, seq_total = -1, source = id }) printer:appendGcode(line, total_lines, { seq_number = -1, seq_total = -1, source = id })