Skip to content

Commit

Permalink
Merge pull request #458 from klutvott123/handle-signed-values
Browse files Browse the repository at this point in the history
Handle signed values
  • Loading branch information
haslinghuis authored Nov 13, 2022
2 parents 4ad07d1 + 138c7d4 commit 700c8c3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/SCRIPTS/BF/ui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ local function processMspReply(cmd,rx_buf)
raw_val = bit32.lshift(raw_val, (idx-1)*8)
f.value = bit32.bor(f.value, raw_val)
end
local bits = #f.vals * 8
if f.min < 0 and bit32.btest(f.value, bit32.lshift(1, bits - 1)) then
f.value = f.value - (2 ^ bits)
end
f.value = f.value/(f.scale or 1)
end
end
Expand Down

0 comments on commit 700c8c3

Please sign in to comment.