From 9d02b07fef4a2679fc8e50e0340d72dace0f1e57 Mon Sep 17 00:00:00 2001 From: "Eugeniy E. Mikhailov" Date: Wed, 3 Mar 2021 12:12:03 -0500 Subject: Fixing bugs spotted by Jonathan --- lmx2487lib.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) mode change 100644 => 100755 lmx2487lib.lua diff --git a/lmx2487lib.lua b/lmx2487lib.lua old mode 100644 new mode 100755 index 1312ccf..1034e0f --- 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 - -- cgit v1.2.3