Lua: onCanRx parameter value to be use Lua-indexing #7110

only docs
This commit is contained in:
rusefillc 2024-11-30 17:27:38 -05:00
parent 0d87acc8a4
commit ae37c269b8
2 changed files with 2 additions and 1 deletions

View File

@ -85,7 +85,7 @@ static int getSensor(lua_State* l, SensorType type) {
} }
static int lua_getAuxAnalog(lua_State* l) { 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 zeroBasedSensorIndex = luaL_checkinteger(l, 1);
auto type = static_cast<SensorType>(zeroBasedSensorIndex + static_cast<int>(SensorType::AuxAnalog1)); auto type = static_cast<SensorType>(zeroBasedSensorIndex + static_cast<int>(SensorType::AuxAnalog1));

View File

@ -32,6 +32,7 @@ inline uint32_t SWAP_UINT32(uint32_t x)
#define BIT(n) (UINT32_C(1) << (n)) #define BIT(n) (UINT32_C(1) << (n))
// also known as 'HUMAN_INDEX'
#define HUMAN_OFFSET 1 #define HUMAN_OFFSET 1
// human-readable IDs start from 1 while computer-readable indices start from 0 // human-readable IDs start from 1 while computer-readable indices start from 0