Commit 92599171 authored by Arnim Läuger's avatar Arnim Läuger Committed by Marcel Stör
Browse files

Fix float version, auto-detect int/float, OO tmr (#1866)

parent 46f651cc
......@@ -25,7 +25,7 @@ return({
if s.parasite == 1 then break end -- parasite sensor blocks bus during conversion
end
end
tmr.alarm(tmr.create(), 750, tmr.ALARM_SINGLE, function() self:readout() end)
tmr.create():alarm(750, tmr.ALARM_SINGLE, function() self:readout() end)
end,
readTemp = function(self, cb, lpin)
......@@ -83,6 +83,7 @@ return({
t = t * 5000 -- DS18S20, 1 fractional bit
end
if 1/2 == 0 then
-- integer version
local sgn = t<0 and -1 or 1
local tA = sgn*t
......@@ -95,13 +96,15 @@ return({
s.status = 2
end
-- end integer version
-- -- float version
-- if t and (math.floor(t/10000)~=85) then
-- self.temp[s.addr]=t
-- print(encoder.toHex(s.addr), t)
-- s.status = 2
-- end
-- -- end float version
else
-- float version
if t and (math.floor(t/10000)~=85) then
self.temp[s.addr]=t/10000
print(encoder.toHex(s.addr), t)
s.status = 2
end
-- end float version
end
end
next = next or s.status == 0
end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment