only:helping lua scripts

This commit is contained in:
Andrey 2023-07-09 21:29:34 -04:00
parent 0e3fbbc145
commit b8b9a3da07
3 changed files with 6 additions and 5 deletions

View File

@ -57,9 +57,10 @@ function arrayToString(arr) \
while arr[index] ~= nil do \
str = str..\" \"..toHexString(math.floor(arr[index])) \
index = index + 1\
end\
return str\
end\
end \
return str \
end \
\
\
"

View File

@ -20,7 +20,7 @@ TEST(LuaKia, packRpm) {
rpm = 990
function testFunc()
canEngine = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
setTwoBytes(canEngine, 2, 4 * rpm)
setTwoBytesLsb(canEngine, 2, 4 * rpm)
print(arrayToString(canEngine))
expected = { 0x00, 0x00, 0x78, 0x0F, 0x00, 0x00, 0x00, 0x00 }

View File

@ -46,7 +46,7 @@ TEST(LuaVag, packMotor1) {
canMotor1 = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
canMotor1[2] = engineTorque / 0.39
setTwoBytes(canMotor1, 2, rpm / 0.25)
setTwoBytesLsb(canMotor1, 2, rpm / 0.25)
canMotor1[5] = innerTorqWithoutExt / 0.4
canMotor1[6] = tps / 0.4
canMotor1[7] = torqueLoss / 0.39