i know how to drop a packet, but not how to modify a packet

This commit is contained in:
rusefillc 2023-06-13 18:50:41 -04:00
parent e60e63bc26
commit 2c78093e37
1 changed files with 10 additions and 0 deletions

View File

@ -51,8 +51,18 @@ function onAnythingFromTCU(bus, id, dlc, data)
txCan(ECU_BUS, id, 0, data) -- relay non-ECU message to ECU
end
MOTOR_1 = 0x282
function interceptAndReplaceContent(bus, id, dlc, data)
rpm = 200
data[3] = rpm
-- send adjusted packet into the other bus
txCan(TCU_BUS, MOTOR_1, 0, data)
end
-- VAG Motor_1 just as example
-- canRxAdd(ECU_BUS, 0x280, printAndDrop)
-- canRxAdd(ECU_BUS, MOTOR_1, interceptAndReplaceContent)
-- last option: unconditional forward of all remaining messages
canRxAddMask(ECU_BUS, 0, 0, onAnythingFromECU)