Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
513c46b4
Commit
513c46b4
authored
Feb 03, 2015
by
Vowstar
Browse files
Merge pull request #165 from Manawyrm/patch-1
Fixed DS18B20 handling because of new floating point handling
parents
a30ff88d
4bde88cd
Changes
1
Show whitespace changes
Inline
Side-by-side
lua_modules/ds18b20/ds18b20.lua
View file @
513c46b4
...
@@ -105,11 +105,10 @@ function readNumber(addr, unit)
...
@@ -105,11 +105,10 @@ function readNumber(addr, unit)
else
else
return
nil
return
nil
end
end
t1
=
t
/
10000
t
=
t
/
10000
t2
=
t
%
10000
-- print("Temperature="..t1.."."..t2.." Centigrade")
-- print("Temperature="..t1.."."..t2.." Centigrade")
-- result = t1.."."..t2
-- result = t1.."."..t2
return
t
1
,
t2
return
t
end
end
tmr
.
wdclr
()
tmr
.
wdclr
()
else
else
...
@@ -122,11 +121,11 @@ function readNumber(addr, unit)
...
@@ -122,11 +121,11 @@ function readNumber(addr, unit)
end
end
function
read
(
addr
,
unit
)
function
read
(
addr
,
unit
)
t
1
,
t2
=
readNumber
(
addr
,
unit
)
t
=
readNumber
(
addr
,
unit
)
if
(
(
t
1
==
nil
)
or
(
t2
==
nil
)
)
then
if
(
t
==
nil
)
then
return
nil
return
nil
else
else
return
t
1
..
"."
..
string.format
(
"%04u"
,
t2
)
return
t
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment