From ae37c269b874b0e744a322fc1f8f3eb353712805 Mon Sep 17 00:00:00 2001 From: rusefillc Date: Sat, 30 Nov 2024 17:27:38 -0500 Subject: [PATCH] Lua: onCanRx parameter value to be use Lua-indexing #7110 only docs --- firmware/controllers/lua/lua_hooks.cpp | 2 +- firmware/util/efilib.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/firmware/controllers/lua/lua_hooks.cpp b/firmware/controllers/lua/lua_hooks.cpp index 313f9bc1f9..1bdecfa6dd 100644 --- a/firmware/controllers/lua/lua_hooks.cpp +++ b/firmware/controllers/lua/lua_hooks.cpp @@ -85,7 +85,7 @@ static int getSensor(lua_State* l, SensorType type) { } static int lua_getAuxAnalog(lua_State* l) { - // todo: shall we use HUMAN_INDEX since UI goes from 1 and Lua loves going from 1? + // todo: shall we use HUMAN_OFFSET since UI goes from 1 and Lua loves going from 1? auto zeroBasedSensorIndex = luaL_checkinteger(l, 1); auto type = static_cast(zeroBasedSensorIndex + static_cast(SensorType::AuxAnalog1)); diff --git a/firmware/util/efilib.h b/firmware/util/efilib.h index c2fd656e15..78228d6bcb 100644 --- a/firmware/util/efilib.h +++ b/firmware/util/efilib.h @@ -32,6 +32,7 @@ inline uint32_t SWAP_UINT32(uint32_t x) #define BIT(n) (UINT32_C(1) << (n)) +// also known as 'HUMAN_INDEX' #define HUMAN_OFFSET 1 // human-readable IDs start from 1 while computer-readable indices start from 0