Merge branch 'rusefi:master' into master

This commit is contained in:
mi-hol 2022-12-28 11:53:40 +01:00 committed by GitHub
commit 3ec21c8130
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 6 deletions

View File

@ -137,6 +137,8 @@ function onMotor1(bus, id, dlc, data)
-- print ('MOTOR_1 torqueLoss ' ..torqueLoss ..' requestedTorque ' ..requestedTorque) -- print ('MOTOR_1 torqueLoss ' ..torqueLoss ..' requestedTorque ' ..requestedTorque)
motor1Data[1] = data[1]
txCan(TCU_BUS, id, 0, motor1Data) txCan(TCU_BUS, id, 0, motor1Data)
end end
@ -175,6 +177,8 @@ function onMotor6(bus, id, dlc, data)
motor6Data[3] = math.floor(actualTorque / 0.39) motor6Data[3] = math.floor(actualTorque / 0.39)
motor6Data[6] = math.floor(feedbackGearbox / 0.39) motor6Data[6] = math.floor(feedbackGearbox / 0.39)
motor6Data[8] = data[8]
xorChecksum(motor6Data, 1) xorChecksum(motor6Data, 1)
txCan(TCU_BUS, id, 0, motor6Data) txCan(TCU_BUS, id, 0, motor6Data)
end end
@ -188,20 +192,22 @@ end
function onAnythingFromECU(bus, id, dlc, data) function onAnythingFromECU(bus, id, dlc, data)
totalEcuMessages = totalEcuMessages + 1 totalEcuMessages = totalEcuMessages + 1
-- txCan(TCU_BUS, id, 0, data) -- relay non-TCU message to TCU -- print("Relaying to TCU " .. id)
txCan(TCU_BUS, id, 0, data) -- relay non-TCU message to TCU
end end
function onAnythingFromTCU(bus, id, dlc, data) function onAnythingFromTCU(bus, id, dlc, data)
totalTcuMessages = totalTcuMessages + 1 totalTcuMessages = totalTcuMessages + 1
-- txCan(ECU_BUS, id, 0, data) -- relay non-ECU message to ECU -- print("Relaying to ECU " .. id)
txCan(ECU_BUS, id, 0, data) -- relay non-ECU message to ECU
end end
canRxAdd(ECU_BUS, MOTOR_1, onMotor1) canRxAdd(ECU_BUS, MOTOR_1, onMotor1)
canRxAdd(ECU_BUS, MOTOR_3, onMotor3) --canRxAdd(ECU_BUS, MOTOR_3, onMotor3)
canRxAdd(ECU_BUS, MOTOR_5, onMotor5) --canRxAdd(ECU_BUS, MOTOR_5, onMotor5)
canRxAdd(ECU_BUS, MOTOR_INFO, silentDrop) --canRxAdd(ECU_BUS, MOTOR_INFO, silentDrop)
canRxAdd(ECU_BUS, MOTOR_6, onMotor6) canRxAdd(ECU_BUS, MOTOR_6, onMotor6)
canRxAdd(ECU_BUS, MOTOR_7, silentDrop) --canRxAdd(ECU_BUS, MOTOR_7, silentDrop)
-- last option: unconditional forward of all remaining messages -- last option: unconditional forward of all remaining messages
canRxAddMask(ECU_BUS, 0, 0, onAnythingFromECU) canRxAddMask(ECU_BUS, 0, 0, onAnythingFromECU)