This commit is contained in:
rusefillc 2025-01-26 19:16:17 -05:00
parent c1c3840340
commit dd3f4295cf
2 changed files with 9 additions and 2 deletions

View File

@ -1,4 +1,5 @@
-- communication with https://github.com/rusefi/rusefi-hardware/tree/main/GDI-4ch/firmware
-- hpfpbench
busIndex = 1

View File

@ -27,13 +27,19 @@ function arrayToString(arr)
return str
end
function getTwoBytesLSB(data, offset, factor)
return (data[offset + 2] * 256 + data[offset + 1]) * factor
end
function onSensorData(bus, id, dlc, data)
if data[8] ~= 0xDE then
print ("invalid data: " ..arrayToString(data))
return
end
print ("valid data: " ..arrayToString(data))
-- sensor : set(packet / 512)
-- print ("valid data: " ..arrayToString(data))
local pressureBar = getTwoBytesLSB(data, 0, 10)
sensor : set(pressureBar)
print ("valid pressureBar: " ..pressureBar)
end
-- bus index '1' on most rusEFI boards, '1' or '2' on Proteus