B6 progress
This commit is contained in:
parent
e37d53e271
commit
b0a09a2171
|
@ -2,17 +2,17 @@
|
|||
#include "rusefi_lua.h"
|
||||
#include "lua_lib.h"
|
||||
|
||||
#define VAG_CHECKSUM "function xorChecksum(data) \
|
||||
#define VAG_CHECKSUM8 "function xorChecksum8(data) \
|
||||
return data[1] ~ data[2] ~ data[3] ~ data[4] ~ data[5] ~ data[6] ~ data[7] \
|
||||
end"
|
||||
|
||||
|
||||
TEST(LuaVag, Checksum) {
|
||||
const char* realdata = VAG_CHECKSUM R"(
|
||||
const char* realdata = VAG_CHECKSUM8 R"(
|
||||
|
||||
function testFunc()
|
||||
data = { 0xE0, 0x20, 0x20, 0x7E, 0xFE, 0xFF, 0xFF, 0x60 }
|
||||
return xorChecksum(data)
|
||||
return xorChecksum8(data)
|
||||
end
|
||||
)";
|
||||
|
||||
|
@ -179,4 +179,20 @@ TEST(LuaVag, unpackMotor3_iat) {
|
|||
EXPECT_NEAR_M3(testLuaReturnsNumberOrNil(script).value_or(0), 25.5);
|
||||
}
|
||||
|
||||
#define realMotor6Packet "\ndata = { 0x3D, 0x54, 0x69, 0x7E, 0xFE, 0xFF, 0xFF, 0x80}\n "
|
||||
|
||||
#define VAG_CHECKSUM1 "function xorChecksum1(data) \
|
||||
return data[8] ~ data[2] ~ data[3] ~ data[4] ~ data[5] ~ data[6] ~ data[7] \
|
||||
end"
|
||||
|
||||
|
||||
TEST(LuaVag, ChecksumMotor6) {
|
||||
const char* realdata = VAG_CHECKSUM1 realMotor6Packet R"(
|
||||
|
||||
function testFunc()
|
||||
return xorChecksum1(data)
|
||||
end
|
||||
)";
|
||||
|
||||
EXPECT_NEAR_M3(testLuaReturnsNumberOrNil(realdata).value_or(0), 0x3D);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue