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

Supporting M109 temp format. Also returning last modified time using LuaFileSystem library.

This commit is contained in:
peteruithoven 2013-08-07 17:50:30 +02:00
parent 4239044c54
commit b8e0acb16b

View File

@ -1,3 +1,4 @@
local lfs = require('lfs')
local log = require('util.logger') local log = require('util.logger')
local utils = require('util.utils') local utils = require('util.utils')
local settings = require('util.settings') local settings = require('util.settings')
@ -151,15 +152,36 @@ function M.temperature(request, response)
f:close() f:close()
local hotend, hotendTarget, bed, bedTarget = tempText:match('T:(.*)%s+/(.*)%s+B:(.*)%s/(.*)%s+@.*') local hotend, hotendTarget, bed, bedTarget = tempText:match('T:(.*)%s+/(.*)%s+B:(.*)%s/(.*)%s+@.*')
log:debug(" hotend: ")
log:debug(hotend)
response:setSuccess() response:setSuccess()
if withRaw then response:addData('raw', tempText) end if withRaw then response:addData('raw', tempText) end
-- After pressing print it waits until it's at the right temperature.
-- it then stores temperature in the following format
-- T:204.5 E:0 W:?
if(hotend == nil) then
local hotend = tempText:match('T:([%d%.]*).*')
log:debug(" >hotend: ")
log:debug(hotend)
response:addData('hotend', hotend)
else
response:addData('hotend', hotend) response:addData('hotend', hotend)
response:addData('bed', bed) response:addData('bed', bed)
response:addData('hotend_target', hotendTarget) response:addData('hotend_target', hotendTarget)
response:addData('bed_target', bedTarget) response:addData('bed_target', bedTarget)
end end
-- get last modified time
local file_attr = lfs.attributes(ultipath .. '/' .. TEMPERATURE_FILE)
local last_mod = file_attr.modification
response:addData('last_mod', last_mod)
end
--requires id(int) --requires id(int)
function M.busy(request, response) function M.busy(request, response)
local argId,devpath,ultipath = getPrinterDataOrFail(request, response) local argId,devpath,ultipath = getPrinterDataOrFail(request, response)