diff --git a/firmware/controllers/lua/lua_hooks_util.cpp b/firmware/controllers/lua/lua_hooks_util.cpp index 55b49a01b1..c70bdc9136 100644 --- a/firmware/controllers/lua/lua_hooks_util.cpp +++ b/firmware/controllers/lua/lua_hooks_util.cpp @@ -51,4 +51,13 @@ void configureRusefiLuaUtilHooks(lua_State* l) { */ } - +void * hackEngineConfigurationPointer(void *ptr) { + // we know that 'engineConfiguration' was null at the time of initialization in unit tests +#if EFI_UNIT_TEST + intptr_t offset = (intptr_t)ptr; + void * valuePtr = (void *)engineConfiguration + offset; + return valuePtr; +#else + return ptr; +#endif +} diff --git a/firmware/controllers/lua/value_lookup.h b/firmware/controllers/lua/value_lookup.h index 0b50cd3ca5..94fd5152c6 100644 --- a/firmware/controllers/lua/value_lookup.h +++ b/firmware/controllers/lua/value_lookup.h @@ -27,3 +27,5 @@ plain_get_float_s * findFloat(const char *name); float getConfigValueByName(const char *name); void setConfigValueByName(const char *name, float value); float getOutputValueByName(const char *name); + +void * hackEngineConfigurationPointer(void *ptr);