passive mim

This commit is contained in:
rusefillc 2024-02-10 18:46:41 -05:00
parent 4ba0afbdc7
commit 95733725d4
2 changed files with 30 additions and 4 deletions

View File

@ -17,3 +17,11 @@ I have PCAN USB dongle to record CANbus traces and a few Proteus units for Man-i
First let's grab a trace and a snapshot of CANbus traffic while engine is not running, both with OEM ECU and with OEM ECU disconnected. We get https://github.com/rusefi/rusefi_documentation/commit/722e81d2b0dd2b1f9661a3e9fd6383087ba4418a#diff-457155f3530fe11dbca1083aa1860f4e3cccc8f2d8b78d81634def58fbc38d9f
Comparing these two files we confirm which packets are clearly originating from the now disconnected OEM ECU https://github.com/rusefi/rusefi_documentation/commit/8575c7292d975c2477ccf070634883f5a9423c7e
## Now let's cut the wires
```
2024-02-10_18_43_23_440: EngineState: LUA: TCU isShiftActive=0 tcuStatus=0 EGSRequirement=0
2024-02-10_18_43_23_440: EngineState: LUA: Total from vehicle 125658 from TCU 15593 dropped=0 replaced 0
2024-02-10_18_43_23_839: EngineState: LUA: TCU isShiftActive=1 tcuStatus=0 EGSRequirement=0
```

View File

@ -12,7 +12,6 @@
-- this controls onCanRx rate as well!
setTickRate(100)
VEHICLE_BUS = 1
TCU_BUS = 2
@ -24,20 +23,39 @@ totalReplaced = 0
function relayFromVehicleToTcu(bus, id, dlc, data)
totalVehicleMessages = totalVehicleMessages + 1
-- print('from ECU ' .. id .. " " .. arrayToString(data) .. " dropped=" .. totalDropped .. " replaced " .. totalReplaced)
txCan(TCU_BUS, id, 0, data) -- relay non-TCU message to TCU
if id < 0x7FF then
txCan(TCU_BUS, id, 0, data) -- relay non-TCU message to TCU
end
end
function relayFromTcuToVehicle(bus, id, dlc, data)
totalTcuMessages = totalTcuMessages + 1
txCan(ECU_BUS, id, 0, data) -- relay non-ECU message to ECU
if id < 0x7FF then
txCan(VEHICLE_BUS, id, 0, data) -- relay non-ECU message to ECU
end
end
counter440 = 0
function onTcu440(bus, id, dlc, data)
isShiftActive = getBitRange(data, 0, 1)
tcuStatus = getBitRange(data, 1, 1)
EGSRequirement = getBitRange(data, 7, 1)
counter440 = counter440 + 1
if counter440 % 40 == 0 then
print("TCU isShiftActive=" ..isShiftActive .." tcuStatus=" ..tcuStatus .." EGSRequirement=" ..EGSRequirement)
end
relayFromTcuToVehicle(bus, id, dlc, data)
end
-- special handling for TCU 440
canRxAdd(TCU_1088_440, onTcu440)
-- last not least everything else
canRxAddMask(VEHICLE_BUS, 0, 0, relayFromVehicleToTcu)
canRxAddMask(TCU_BUS, 0, 0, relayFromTcuToVehicle)
everySecondTimer = Timer.new()
function onTick()
if everySecondTimer:getElapsedSeconds() > 1 then
everySecondTimer:reset()