diff options
-rwxr-xr-x[-rw-r--r--] | lmx2487lib.lua | 16 |
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 - |