mirror of https://github.com/FOME-Tech/fome-fw.git
Mark is asking for VIN number field #3967
This commit is contained in:
parent
898f844a7e
commit
3d329639ea
|
@ -26,6 +26,13 @@ using namespace luaaa;
|
||||||
#include "electronic_throttle_impl.h"
|
#include "electronic_throttle_impl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static int lua_vin(lua_State* l) {
|
||||||
|
auto zeroBasedCharIndex = luaL_checkinteger(l, 1);
|
||||||
|
char value = engineConfiguration->vinNumber[zeroBasedCharIndex];
|
||||||
|
lua_pushnumber(l, value);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
static int lua_readpin(lua_State* l) {
|
static int lua_readpin(lua_State* l) {
|
||||||
auto msg = luaL_checkstring(l, 1);
|
auto msg = luaL_checkstring(l, 1);
|
||||||
#if EFI_PROD_CODE
|
#if EFI_PROD_CODE
|
||||||
|
@ -585,6 +592,7 @@ void configureRusefiLuaHooks(lua_State* l) {
|
||||||
configureRusefiLuaUtilHooks(l);
|
configureRusefiLuaUtilHooks(l);
|
||||||
|
|
||||||
lua_register(l, "readPin", lua_readpin);
|
lua_register(l, "readPin", lua_readpin);
|
||||||
|
lua_register(l, "vin", lua_vin);
|
||||||
lua_register(l, "getAuxAnalog", lua_getAuxAnalog);
|
lua_register(l, "getAuxAnalog", lua_getAuxAnalog);
|
||||||
lua_register(l, "getSensorByIndex", lua_getSensorByIndex);
|
lua_register(l, "getSensorByIndex", lua_getSensorByIndex);
|
||||||
lua_register(l, "getSensor", lua_getSensorByName);
|
lua_register(l, "getSensor", lua_getSensorByName);
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
/*
|
||||||
|
* test_lua_vin.cpp
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "pch.h"
|
||||||
|
#include "rusefi_lua.h"
|
||||||
|
#include "lua_lib.h"
|
||||||
|
|
||||||
|
|
||||||
|
TEST(LuaVin, Test) {
|
||||||
|
EngineTestHelper eth(TEST_CRANK_ENGINE);
|
||||||
|
|
||||||
|
strcpy(engineConfiguration->vinNumber, "GM123");
|
||||||
|
|
||||||
|
const char* realdata = TWO_BYTES_MSB R"(
|
||||||
|
|
||||||
|
function testFunc()
|
||||||
|
return vin(0)
|
||||||
|
end)";
|
||||||
|
|
||||||
|
EXPECT_NEAR_M3(testLuaReturnsNumberOrNil(realdata).value_or(0), 0x47);
|
||||||
|
}
|
|
@ -41,6 +41,7 @@ TESTS_SRC_CPP = \
|
||||||
tests/lua/test_lua_hooks.cpp \
|
tests/lua/test_lua_hooks.cpp \
|
||||||
tests/lua/test_lua_Leiderman_Khlystov.cpp \
|
tests/lua/test_lua_Leiderman_Khlystov.cpp \
|
||||||
tests/lua/test_can_filter.cpp \
|
tests/lua/test_can_filter.cpp \
|
||||||
|
tests/lua/test_lua_vin.cpp \
|
||||||
tests/sensor/test_cj125.cpp \
|
tests/sensor/test_cj125.cpp \
|
||||||
tests/test_change_engine_type.cpp \
|
tests/test_change_engine_type.cpp \
|
||||||
tests/util/test_scaled_channel.cpp \
|
tests/util/test_scaled_channel.cpp \
|
||||||
|
|
Loading…
Reference in New Issue