diff --git a/firmware/controllers/actuators/electronic_throttle.cpp b/firmware/controllers/actuators/electronic_throttle.cpp index c03474ed97..a0755205de 100644 --- a/firmware/controllers/actuators/electronic_throttle.cpp +++ b/firmware/controllers/actuators/electronic_throttle.cpp @@ -669,7 +669,7 @@ static EtbImpl etb1; static EtbImpl etb2; static_assert(ETB_COUNT == 2); -static EtbController* etbControllers[] = { &etb1, &etb2 }; +EtbController* etbControllers[] = { &etb1, &etb2 }; struct EtbThread final : public PeriodicController<512> { EtbThread() : PeriodicController("ETB", PRIO_ETB, ETB_LOOP_FREQUENCY) {} diff --git a/firmware/controllers/algo/engine.h b/firmware/controllers/algo/engine.h index d1f1507ae5..3bd1d5c689 100644 --- a/firmware/controllers/algo/engine.h +++ b/firmware/controllers/algo/engine.h @@ -40,7 +40,6 @@ #include "gear_detector.h" #include "advance_map.h" #include "fan_control.h" -#include "electronic_throttle_impl.h" #ifndef EFI_UNIT_TEST #error EFI_UNIT_TEST must be defined! @@ -167,7 +166,7 @@ public: PinRepository pinRepository; - EtbController *etbControllers[ETB_COUNT] = {nullptr}; + IEtbController *etbControllers[ETB_COUNT] = {nullptr}; IFuelComputer *fuelComputer = nullptr; type_list< diff --git a/firmware/controllers/lua/lua_hooks.cpp b/firmware/controllers/lua/lua_hooks.cpp index b7013ac8fd..e42c39c804 100644 --- a/firmware/controllers/lua/lua_hooks.cpp +++ b/firmware/controllers/lua/lua_hooks.cpp @@ -23,6 +23,10 @@ using namespace luaaa; // Some functions lean on existing FSIO implementation #include "fsio_impl.h" +#if EFI_PROD_CODE +#include "electronic_throttle_impl.h" +#endif + static int lua_readpin(lua_State* l) { auto msg = luaL_checkstring(l, 1); #if EFI_PROD_CODE @@ -533,13 +537,16 @@ void configureRusefiLuaHooks(lua_State* l) { engine->engineState.luaAdjustments.fuelMult = luaL_checknumber(l, 1); return 0; }); +#if EFI_PROD_CODE lua_register(l, "setEtbAdd", [](lua_State* l) { auto luaAdjustment = luaL_checknumber(l, 1); for (int i = 0 ; i < ETB_COUNT; i++) { - engine->etbControllers[i]->luaAdjustment = luaAdjustment; + extern EtbController* etbControllers[]; + etbControllers[i]->luaAdjustment = luaAdjustment; } return 0; }); +#endif // EFI_PROD_CODE lua_register(l, "setClutchUpState", [](lua_State* l) { engine->engineState.luaAdjustments.clutchUpState = lua_toboolean(l, 1);