Update B6-temp.md

This commit is contained in:
rusefillc 2022-09-17 23:48:14 -04:00 committed by GitHub
parent a6daefaa56
commit e70454024b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions

View File

@ -8,6 +8,8 @@ MOTOR_6 = 0x488
MOTOR_7 = 0x588 MOTOR_7 = 0x588
fuelCounter = 0;
function xorChecksum(data, targetIndex) function xorChecksum(data, targetIndex)
local index = 1 local index = 1
local result = 0 local result = 0
@ -95,6 +97,7 @@ totalTcuMessages = 0
motor1Data = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } motor1Data = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
canMotorInfo = { 0x00, 0x00, 0x00, 0x14, 0x1C, 0x93, 0x48, 0x14 } canMotorInfo = { 0x00, 0x00, 0x00, 0x14, 0x1C, 0x93, 0x48, 0x14 }
canMotor3 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } canMotor3 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
motor5Data = { 0x1C, 0x08, 0xF3, 0x55, 0x19, 0x00, 0x06, 0xAD}
motor6Data = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } motor6Data = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
motor7Data = { 0x1A, 0x66, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00 } motor7Data = { 0x1A, 0x66, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00 }
@ -146,6 +149,10 @@ function onMotor3(bus, id, dlc, data)
txCan(TCU_BUS, id, 0, canMotor3) txCan(TCU_BUS, id, 0, canMotor3)
end end
function onMotor5(bus, id, dlc, data)
txCan(TCU_BUS, id, 0, motor5Data)
end
function printAndDrop(bus, id, dlc, data) function printAndDrop(bus, id, dlc, data)
print('Dropping ' ..arrayToString(data)) print('Dropping ' ..arrayToString(data))
end end
@ -164,7 +171,7 @@ 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, printAndDrop) canRxAdd(ECU_BUS, MOTOR_5, onMotor3)
canRxAdd(ECU_BUS, MOTOR_INFO, printAndDrop) canRxAdd(ECU_BUS, MOTOR_INFO, printAndDrop)
canRxAdd(ECU_BUS, MOTOR_6, printAndDrop) canRxAdd(ECU_BUS, MOTOR_6, printAndDrop)
canRxAdd(ECU_BUS, MOTOR_7, printAndDrop) canRxAdd(ECU_BUS, MOTOR_7, printAndDrop)
@ -181,6 +188,8 @@ function onTick()
everySecondTimer : reset() everySecondTimer : reset()
print("Total from ECU " ..totalEcuMessages .." from TCU " ..totalTcuMessages) print("Total from ECU " ..totalEcuMessages .." from TCU " ..totalTcuMessages)
fuelCounter = fuelCounter + 20
canMotorInfoCounter = (canMotorInfoCounter + 1) % 8 canMotorInfoCounter = (canMotorInfoCounter + 1) % 8
motor7Data[1] = 0x90 + (canMotorInfoCounter * 2) motor7Data[1] = 0x90 + (canMotorInfoCounter * 2)