fake motor_3 happy drive in the air
This commit is contained in:
parent
c9d25c4a9c
commit
8def2d24a8
|
@ -29,10 +29,26 @@ function onMotor1(bus, id, dlc, data)
|
||||||
sendMotor1()
|
sendMotor1()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
iat = 0
|
||||||
|
pps = 0
|
||||||
|
tps = 0
|
||||||
|
|
||||||
|
motor3counter = 0
|
||||||
|
function onMotor3(bus, id, dlc, data)
|
||||||
|
motor3counter = (motor3counter + 1) % 16
|
||||||
|
totalEcuMessages = totalEcuMessages + 1
|
||||||
|
iat = getBitRange(data, 8, 8) * 0.75 - 48
|
||||||
|
pps = getBitRange(data, 16, 8) * 0.40
|
||||||
|
tps = getBitRange(data, 56, 8) * 0.40
|
||||||
|
if motor3counter % 70 == 0 then
|
||||||
|
-- print ('MOTOR_3 pps ' ..pps ..' tps ' ..tps ..' iat ' ..iat)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
canRxAdd(ECU_BUS, MOTOR_1, onMotor1)
|
canRxAdd(ECU_BUS, MOTOR_1, onMotor1)
|
||||||
canRxAdd(ECU_BUS, MOTOR_BRE, drop)
|
canRxAdd(ECU_BUS, MOTOR_BRE, drop)
|
||||||
canRxAdd(ECU_BUS, MOTOR_2_648, sendMotor2)
|
canRxAdd(ECU_BUS, MOTOR_2_648, sendMotor2)
|
||||||
canRxAdd(ECU_BUS, MOTOR_3, silentlyRelayFromECU)
|
canRxAdd(ECU_BUS, MOTOR_3, onMotor3)
|
||||||
canRxAdd(ECU_BUS, MOTOR_5, drop)
|
canRxAdd(ECU_BUS, MOTOR_5, drop)
|
||||||
canRxAdd(ECU_BUS, MOTOR_6, silentlyRelayFromECU)
|
canRxAdd(ECU_BUS, MOTOR_6, silentlyRelayFromECU)
|
||||||
canRxAdd(ECU_BUS, MOTOR_7, drop)
|
canRxAdd(ECU_BUS, MOTOR_7, drop)
|
||||||
|
@ -106,6 +122,7 @@ function onTick()
|
||||||
_10msPeriodTimer : reset()
|
_10msPeriodTimer : reset()
|
||||||
sendMotorBre()
|
sendMotorBre()
|
||||||
sendAccGra()
|
sendAccGra()
|
||||||
|
sendMotor3()
|
||||||
sendMotor5()
|
sendMotor5()
|
||||||
sendMotor7()
|
sendMotor7()
|
||||||
end
|
end
|
||||||
|
|
|
@ -94,4 +94,16 @@ function sendMotor1()
|
||||||
motor1Data[8] = requestedTorque / 0.39
|
motor1Data[8] = requestedTorque / 0.39
|
||||||
|
|
||||||
txCan(TCU_BUS, MOTOR_1, 0, motor1Data)
|
txCan(TCU_BUS, MOTOR_1, 0, motor1Data)
|
||||||
|
end
|
||||||
|
|
||||||
|
canMotor3 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
|
||||||
|
function sendMotor3()
|
||||||
|
desired_wheel_torque = fakeTorque
|
||||||
|
iat = iat or 30
|
||||||
|
canMotor3[2] = (iat + 48) / 0.75
|
||||||
|
canMotor3[3] = tps / 0.4
|
||||||
|
canMotor3[5] = 0x20
|
||||||
|
setBitRange(canMotor3, 24, 12, math.floor(desired_wheel_torque / 0.39))
|
||||||
|
canMotor3[8] = tps / 0.4
|
||||||
|
txCan(TCU_BUS, MOTOR_3, 0, canMotor3)
|
||||||
end
|
end
|
Loading…
Reference in New Issue