no code with us sending MOTOR_INFO
This commit is contained in:
parent
1c3e244d3e
commit
42c45750ea
|
@ -6,6 +6,9 @@
|
|||
-- include utils.lua
|
||||
-- endinclude
|
||||
|
||||
-- include send-methods.lua
|
||||
-- endinclude
|
||||
|
||||
setTickRate(100)
|
||||
|
||||
canRxAdd(ECU_BUS, MOTOR_1, silentlyRelayFromECU)
|
||||
|
@ -16,7 +19,7 @@ canRxAdd(ECU_BUS, MOTOR_5, silentlyRelayFromECU)
|
|||
canRxAdd(ECU_BUS, MOTOR_6, silentlyRelayFromECU)
|
||||
canRxAdd(ECU_BUS, MOTOR_7, silentlyRelayFromECU)
|
||||
canRxAdd(ECU_BUS, ACC_GRA, silentlyRelayFromECU)
|
||||
canRxAdd(ECU_BUS, MOTOR_INFO, silentlyRelayFromECU)
|
||||
canRxAdd(ECU_BUS, MOTOR_INFO, drop)
|
||||
|
||||
canRxAdd(ECU_BUS, Gate_Komf_1, silentlyRelayFromECU)
|
||||
canRxAdd(ECU_BUS, Kombi_1, silentlyRelayFromECU)
|
||||
|
@ -72,6 +75,10 @@ function onTick()
|
|||
if everySecondTimer : getElapsedSeconds() > 1 then
|
||||
everySecondTimer : reset()
|
||||
print("Total from ECU " ..totalEcuMessages .. " totalTcuMessages " .. totalTcuMessages)
|
||||
|
||||
motor5FuelCounter = motor5FuelCounter + 20
|
||||
|
||||
sendMotorInfo()
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
motor5counter = 0
|
||||
motor5FuelCounter = 0
|
||||
|
||||
canMotorInfo02 = { 0x00, 0x00, 0x00, 0x14, 0x1C, 0x93, 0x48, 0x14 }
|
||||
canMotorInfo1 = { 0x99, 0x14, 0x00, 0x7F, 0x00, 0xF0, 0x47, 0x01 }
|
||||
canMotorInfo3 = { 0x9B, 0x14, 0x00, 0x11, 0x1F, 0xE0, 0x0C, 0x46 }
|
||||
canMotorInfoTotalCounter = 0
|
||||
canMotorInfoCounter = 0
|
||||
function sendMotorInfo()
|
||||
canMotorInfoTotalCounter = canMotorInfoTotalCounter + 1
|
||||
canMotorInfoCounter = (canMotorInfoCounter + 1) % 16
|
||||
|
||||
baseByte = canMotorInfoTotalCounter < 6 and 0x80 or 0x90
|
||||
canMotorInfo02[1] = baseByte + (canMotorInfoCounter)
|
||||
canMotorInfo1[1] = baseByte + (canMotorInfoCounter)
|
||||
canMotorInfo3[1] = baseByte + (canMotorInfoCounter)
|
||||
mod4 = canMotorInfoCounter % 4
|
||||
|
||||
if (mod4 == 0 or mod4 == 2) then
|
||||
txCan(TCU_BUS, MOTOR_INFO, 0, canMotorInfo02)
|
||||
elseif (mod4 == 1) then
|
||||
txCan(TCU_BUS, MOTOR_INFO, 0, canMotorInfo1)
|
||||
else
|
||||
txCan(TCU_BUS, MOTOR_INFO, 0, canMotorInfo3)
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue