soooo close!

This commit is contained in:
rusefillc 2022-12-30 21:51:07 -05:00
parent 5e181324b5
commit 562ab4a6cd
1 changed files with 11 additions and 13 deletions

View File

@ -175,23 +175,21 @@ end
counter16 = 0 counter16 = 0
function onMotor6(bus, id, dlc, data) function onMotor6(bus, id, dlc, data)
engineTorque = getBitRange(data, 8, 8) * 0.39
actualTorque = getBitRange(data, 16, 8) * 0.39
feedbackGearbox = getBitRange(data, 40, 8) * 0.39
counter16 = (counter16 + 1) % 16 counter16 = (counter16 + 1) % 16
-- engineTorque = getBitRange(data, 8, 8) * 0.39
-- actualTorque = getBitRange(data, 16, 8) * 0.39
-- feedbackGearbox = getBitRange(data, 40, 8) * 0.39
engineTorque = fakeTorque * 0.9
actualTorque = fakeTorque
feedbackGearbox = 255
-- engineTorque = fakeTorque * 0.9 motor6Data[2] = math.floor(engineTorque / 0.39)
-- actualTorque = fakeTorque motor6Data[3] = math.floor(actualTorque / 0.39)
-- feedbackGearbox = 255 motor6Data[6] = math.floor(feedbackGearbox / 0.39)
setBitRange(motor6Data, 60, 4, counter16)
motor6Data[2] = math.floor(engineTorque / 0.39) xorChecksum(motor6Data, 1)
motor6Data[3] = math.floor(actualTorque / 0.39)
motor6Data[6] = math.floor(feedbackGearbox / 0.39)
setBitRange(motor6Data, 60, 4, counter16)
xorChecksum(motor6Data, 1)
txCan(TCU_BUS, id, 0, motor6Data) txCan(TCU_BUS, id, 0, motor6Data)
end end