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
7c759a61
Commit
7c759a61
authored
Apr 11, 2015
by
Vowstar
Browse files
Merge pull request #352 from electronic-dudeness/master
fixed floating point problem in bcd conversions
parents
263179ea
4437c468
Changes
1
Hide whitespace changes
Inline
Side-by-side
lua_modules/ds3231/ds3231.lua
View file @
7c759a61
...
@@ -16,11 +16,11 @@ local id = 0
...
@@ -16,11 +16,11 @@ local id = 0
local
dev_addr
=
0x68
local
dev_addr
=
0x68
local
function
decToBcd
(
val
)
local
function
decToBcd
(
val
)
return
((
val
/
10
*
16
)
+
(
val
%
10
))
return
((
((
val
/
10
)
-
((
val
/
10
)
%
1
))
*
16
)
+
(
val
%
10
))
end
end
local
function
bcdToDec
(
val
)
local
function
bcdToDec
(
val
)
return
((
val
/
16
*
10
)
+
(
val
%
16
))
return
((
((
val
/
16
)
-
((
val
/
16
)
%
1
))
*
10
)
+
(
val
%
16
))
end
end
-- initialize i2c
-- initialize i2c
...
...
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