more B6
This commit is contained in:
parent
1abbba6848
commit
d97dd668a2
|
@ -47,10 +47,10 @@ end
|
|||
|
||||
canRxAdd(ECU_BUS, MOTOR_1, onMotor1)
|
||||
canRxAdd(ECU_BUS, MOTOR_BRE, drop)
|
||||
canRxAdd(ECU_BUS, MOTOR_2_648, sendMotor2)
|
||||
canRxAdd(ECU_BUS, MOTOR_2_648, drop)
|
||||
canRxAdd(ECU_BUS, MOTOR_3, onMotor3)
|
||||
canRxAdd(ECU_BUS, MOTOR_5, drop)
|
||||
canRxAdd(ECU_BUS, MOTOR_6, silentlyRelayFromECU)
|
||||
canRxAdd(ECU_BUS, MOTOR_6, drop)
|
||||
canRxAdd(ECU_BUS, MOTOR_7, drop)
|
||||
canRxAdd(ECU_BUS, ACC_GRA, drop)
|
||||
canRxAdd(ECU_BUS, MOTOR_INFO, drop)
|
||||
|
@ -87,11 +87,22 @@ canRxAdd(ECU_BUS, EPB_1, drop)
|
|||
canRxAdd(ECU_BUS, 1394, drop)
|
||||
canRxAdd(ECU_BUS, 1056, drop)
|
||||
|
||||
canRxAdd(ECU_BUS, 1478, drop)
|
||||
--canRxAdd(ECU_BUS, 1478, drop)
|
||||
--canRxAdd(ECU_BUS, 1490, drop)
|
||||
--canRxAdd(ECU_BUS, 1888, drop)
|
||||
--canRxAdd(ECU_BUS, 1360, drop)
|
||||
|
||||
counter440 = 0
|
||||
function onTcu440(bus, id, dlc, data)
|
||||
isShiftActive = getBitRange(data, 0, 1)
|
||||
setBitRange(data, 0, 1, 0)
|
||||
isShiftActive2 = getBitRange(data, 0, 1)
|
||||
txCan(ECU_BUS, id, 0, data)
|
||||
|
||||
if counter440 % 70 == 0 then
|
||||
-- print("TCU " .. isShiftActive .. isShiftActive2)
|
||||
end
|
||||
end
|
||||
|
||||
function verboseRelayFromECU(bus, id, dlc, data)
|
||||
onEcuTimer : reset ()
|
||||
|
@ -101,6 +112,9 @@ function verboseRelayFromECU(bus, id, dlc, data)
|
|||
end
|
||||
|
||||
canRxAddMask(ECU_BUS, 0, 0, verboseRelayFromECU)
|
||||
|
||||
canRxAdd(ECU_BUS, 1360, drop)
|
||||
canRxAdd(TCU_BUS, TCU_1088_440, onTcu440)
|
||||
canRxAddMask(TCU_BUS, 0, 0, silentlyRelayFromTCU)
|
||||
|
||||
everySecondTimer = Timer.new()
|
||||
|
@ -122,8 +136,10 @@ function onTick()
|
|||
_10msPeriodTimer : reset()
|
||||
sendMotorBre()
|
||||
sendAccGra()
|
||||
sendMotor2()
|
||||
sendMotor3()
|
||||
sendMotor5()
|
||||
sendMotor6()
|
||||
sendMotor7()
|
||||
end
|
||||
end
|
||||
|
|
|
@ -52,3 +52,7 @@ Lenkhilfe_2=978
|
|||
Klima_1=1504
|
||||
BSG_Last=1392
|
||||
EPB_1=1472
|
||||
|
||||
|
||||
TCU_1088_440 = 0x440
|
||||
TCU_1344_540 = 0x540
|
|
@ -106,4 +106,22 @@ function sendMotor3()
|
|||
setBitRange(canMotor3, 24, 12, math.floor(desired_wheel_torque / 0.39))
|
||||
canMotor3[8] = tps / 0.4
|
||||
txCan(TCU_BUS, MOTOR_3, 0, canMotor3)
|
||||
end
|
||||
|
||||
motor6Data = { 0x00, 0x00, 0x00, 0x7E, 0xFE, 0xFF, 0xFF, 0x00 }
|
||||
motor6Counter = 0
|
||||
function sendMotor6()
|
||||
motor6Counter = (motor6Counter + 1) % 16
|
||||
|
||||
engineTorque = fakeTorque * 0.9
|
||||
actualTorque = fakeTorque
|
||||
feedbackGearbox = 255
|
||||
|
||||
motor6Data[2] = math.floor(engineTorque / 0.39)
|
||||
motor6Data[3] = math.floor(actualTorque / 0.39)
|
||||
motor6Data[6] = math.floor(feedbackGearbox / 0.39)
|
||||
setBitRange(motor6Data, 60, 4, motor6Counter)
|
||||
|
||||
xorChecksum(motor6Data, 1)
|
||||
txCan(TCU_BUS, MOTOR_6, 0, motor6Data)
|
||||
end
|
Loading…
Reference in New Issue