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

Fixes to getMacAddress() and to adding gcode.

This commit is contained in:
Wouter R 2013-07-29 19:22:09 +02:00
parent 3bc22c19fe
commit eddb7f7d0d
2 changed files with 7 additions and 1 deletions

View File

@ -102,6 +102,9 @@ function M.getMacAddress()
local macText = utils.readFile('/sys/class/net/' .. deviceName .. '/address')
local out = ''
-- Hack to prevent failure in case the MAC address could not be obtained.
if not macText or macText == '' then return "000000000000" end
for i = 0, 5 do
local bt = string.sub(macText, i*3+1, i*3+2)
out = out .. bt

View File

@ -72,7 +72,10 @@ local function addToGcodeFile(gcode)
log:debug("appending " .. gcode:len() .. " bytes of gcode to " .. GCODE_TMP_FILE)
gcf:write(gcode)
gcf:write("\n")
gcf:close()
return true
end
-- assumes printerPath exists, returns true if successful, false if command file already exists and is non-empty (i.e. printer busy),
@ -210,7 +213,7 @@ function M.print_POST(request, response)
response:addData('msg', msg)
return
else
response:addData('gcode_append',gcode:len())
response:addData('gcode_append',argGcode:len())
end
if argIsLast == true then