Update B6-temp.md

This commit is contained in:
rusefillc 2022-09-17 22:26:47 -04:00 committed by GitHub
parent e4c7a8aa76
commit a6daefaa56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 70 additions and 66 deletions

View File

@ -61,7 +61,7 @@ function setTwoBytes(data, offset, value)
value = math.floor(value)
data[offset + 2] = value >> 8
data[offset + 1] = value & 0xff
end
end
hexstr = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, "A", "B", "C", "D", "E", "F" }
@ -121,11 +121,11 @@ function onMotor1(bus, id, dlc, data)
motor1Data[7] = torqueLoss / 0.39
motor1Data[8] = requestedTorque / 0.39
print ('fakeTorque ' .. fakeTorque)
print ('engineTorque ' .. engineTorque .. ' RPM ' .. rpm)
print ('innerTorqWithoutExt ' .. innerTorqWithoutExt .. ' tps ' .. tps)
print ('fakeTorque ' ..fakeTorque)
print ('engineTorque ' ..engineTorque ..' RPM ' ..rpm)
print ('innerTorqWithoutExt ' ..innerTorqWithoutExt ..' tps ' ..tps)
print ('torqueLoss ' .. torqueLoss .. ' requestedTorque ' .. requestedTorque)
print ('torqueLoss ' ..torqueLoss ..' requestedTorque ' ..requestedTorque)
txCan(TCU_BUS, id, 0, motor1Data)
end
@ -134,8 +134,10 @@ function onMotor3(bus, id, dlc, data)
iat = getBitRange(data, 8, 8) * 0.75 - 48
pps = getBitRange(data, 16, 8) * 0.40
tps = getBitRange(data, 56, 8) * 0.40
print ('pps ' .. pps .. ' tps ' .. tps .. ' iat ' .. iat)
print ('pps ' ..pps ..' tps ' ..tps ..' iat ' ..iat)
desired_wheel_torque = fakeTorque
canMotor3[2] = (iat + 48) / 0.75
canMotor3[3] = tps / 0.4
canMotor3[5] = 0x20
@ -159,13 +161,13 @@ function onAnythingFromTCU(bus, id, dlc, data)
end
-- VAG Motor_1 just as example
canRxAdd(ECU_BUS, MOTOR_1, onMotor1)
canRxAdd(ECU_BUS, MOTOR_1, onMotor1)
canRxAdd(ECU_BUS, MOTOR_3, onMotor3)
-- canRxAdd(ECU_BUS, MOTOR_5, printAndDrop)
canRxAdd(ECU_BUS, MOTOR_INFO, printAndDrop)
canRxAdd(ECU_BUS, MOTOR_6, printAndDrop)
-- canRxAdd(ECU_BUS, MOTOR_7, printAndDrop)
canRxAdd(ECU_BUS, MOTOR_3, onMotor3)
canRxAdd(ECU_BUS, MOTOR_5, printAndDrop)
canRxAdd(ECU_BUS, MOTOR_INFO, printAndDrop)
canRxAdd(ECU_BUS, MOTOR_6, printAndDrop)
canRxAdd(ECU_BUS, MOTOR_7, printAndDrop)
-- last option: unconditional forward of all remaining messages
canRxAddMask(ECU_BUS, 0, 0, onAnythingFromECU)
@ -187,4 +189,6 @@ function onTick()
end
end
```