summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugeniy E. Mikhailov <evgmik@gmail.com>2021-03-03 12:12:03 -0500
committerEugeniy E. Mikhailov <evgmik@gmail.com>2021-03-03 12:12:03 -0500
commit9d02b07fef4a2679fc8e50e0340d72dace0f1e57 (patch)
tree35133dfc98228260bf830ff620e33a52ce33e6df
parent5cc18dc0df7eb13c537ad46ba5f3411e0d396be4 (diff)
downloadnodeMCU_rf_source_lmx2487-9d02b07fef4a2679fc8e50e0340d72dace0f1e57.tar.gz
nodeMCU_rf_source_lmx2487-9d02b07fef4a2679fc8e50e0340d72dace0f1e57.zip
Fixing bugs spotted by Jonathan
-rwxr-xr-x[-rw-r--r--]lmx2487lib.lua16
1 files changed, 8 insertions, 8 deletions
diff --git a/lmx2487lib.lua b/lmx2487lib.lua
index 1312ccf..1034e0f 100644..100755
--- a/lmx2487lib.lua
+++ b/lmx2487lib.lua
@@ -17,16 +17,17 @@ end
function get_lmx2487register(register)
-- register labeled 0, 1, 2, ..., 7
- print("register " .. register .. " is set to " .. lmx2487_registers[register+1])
- return lmx2487_registers[register+1]
+ local value = (lmx2487_registers[register+1])
+ print("register " .. register .. " is set to " .. value)
+ return value
end
-function send_register_lmx2487( register)
- if ( lmx2487_need_update[register] ) then
- print("sending register " .. register .. " with value " .. lmx2487_registers[register])
+function send_register_lmx2487(register)
+ if ( lmx2487_need_update[register +1] ) then
+ print("sending register " .. register .. " with value " .. get_lmx2487register( register ) )
-- do hardware talking
- microwire_send_data( get_lmx2487register( register )
- lmx2487_need_update[register]=false
+ microwire_send_data( get_lmx2487register( register ) )
+ lmx2487_need_update[register+1]=false
end
end
@@ -53,4 +54,3 @@ function set_lmx2487_board_to_default_state()
update_lmx2487state()
end
-