From 0d333248e3b5c82735d5fdeea67c13fa49ea66a7 Mon Sep 17 00:00:00 2001 From: rusefillc Date: Tue, 19 Nov 2024 18:03:55 -0500 Subject: [PATCH] LUA script size severely limited #7085 only:uaefi --- firmware/config/boards/hellen/uaefi/board.mk | 3 +++ firmware/controllers/lua/lua_hooks.cpp | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/firmware/config/boards/hellen/uaefi/board.mk b/firmware/config/boards/hellen/uaefi/board.mk index c7fba87ea5..57bf34995d 100644 --- a/firmware/config/boards/hellen/uaefi/board.mk +++ b/firmware/config/boards/hellen/uaefi/board.mk @@ -28,5 +28,8 @@ ONBOARD_MEMS_TYPE=LIS2DH12 include $(BOARDS_DIR)/hellen/hellen-common100.mk +# we do not have much Lua RAM, let's drop some fancy functions +DDEFS += -DWITH_LUA_CONSUMPTION=FALSE + DDEFS += $(PRIMARY_COMMUNICATION_PORT_USART2) diff --git a/firmware/controllers/lua/lua_hooks.cpp b/firmware/controllers/lua/lua_hooks.cpp index 472917afef..5a27a8f3ab 100644 --- a/firmware/controllers/lua/lua_hooks.cpp +++ b/firmware/controllers/lua/lua_hooks.cpp @@ -700,7 +700,12 @@ void configureRusefiLuaHooks(lua_State* lState) { lua_register(lState, "getSensor", lua_getSensorByName); lua_register(lState, "getSensorRaw", lua_getSensorRaw); lua_register(lState, "hasSensor", lua_hasSensor); -#if EFI_VEHICLE_SPEED + +#ifndef WITH_LUA_CONSUMPTION +#define WITH_LUA_CONSUMPTION TRUE +#endif + +#if EFI_VEHICLE_SPEED && WITH_LUA_CONSUMPTION lua_register(lState, "getConsumedGrams", [](lua_State* l) { lua_pushnumber(l, engine->module()->getConsumedGrams()); return 1;