From ed6ced95e8ad06df692d773a75f139048f5cfc95 Mon Sep 17 00:00:00 2001 From: rusefillc Date: Sat, 16 Nov 2024 21:34:08 -0500 Subject: [PATCH] lua getConsumptionGramPerSecond --- firmware/controllers/lua/lua_hooks.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/firmware/controllers/lua/lua_hooks.cpp b/firmware/controllers/lua/lua_hooks.cpp index fa371f897a..96d2d34e85 100644 --- a/firmware/controllers/lua/lua_hooks.cpp +++ b/firmware/controllers/lua/lua_hooks.cpp @@ -700,6 +700,16 @@ 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 + lua_register(lState, "getConsumedGrams", [](lua_State* l) { + lua_pushnumber(l, engine->module()->getConsumedGrams()); + return 1; + }); + lua_register(lState, "getConsumptionGramPerSecond", [](lua_State* l) { + lua_pushnumber(l, engine->module()->getConsumptionGramPerSecond()); + return 1; + }); +#endif // EFI_VEHICLE_SPEED lua_register(lState, "table3d", [](lua_State* l) { auto humanTableIdx = luaL_checkinteger(l, 1); auto x = luaL_checknumber(l, 2);