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

call print start before finishing fetch loop

This commit is contained in:
Simon Voordouw 2017-06-13 13:04:09 +02:00
parent 533988a409
commit 97fb6609ea

View File

@ -1,7 +1,7 @@
#!/usr/bin/lua
local function log(message)
os.execute("logger" .. message)
os.execute("logger " .. message)
print(message)
end
@ -35,8 +35,8 @@ local started = false
log("total lines: " .. total_lines)
local startCode = ''
local endCode = ''
local startCode = nil
local endCode = nil
function countlines(file)
return tonumber(io.popen("wc -l < " .. file):read('*a'))
@ -53,7 +53,10 @@ if table.getn(arg) >= 5 then
endCode = readGCodeArg(5)
end
printer:appendGcode(startCode)
if startCode ~= nil then
log("appending start gcode")
printer:appendGcode(startCode)
end
while(not finished)
do
@ -64,11 +67,6 @@ do
current_line = current_line + 1
line = f:read()
end
if current_line >= total_lines then
printer:appendGcode(endCode)
finished = true
break
end
if not started then
started = true
@ -76,6 +74,17 @@ do
printer:startPrint()
end
if current_line >= total_lines then
log("finished fetching gcode")
if endCode ~= nil then
log("appending end gcode")
printer:appendGcode(endCode)
end
finished = true
break
end
local accepts_new_gcode = false
while (not accepts_new_gcode)