Module subType fixes

This commit is contained in:
Bertrand Songis
2019-09-03 21:04:37 +02:00
parent 6457ad245f
commit 82577ed621
4 changed files with 42 additions and 32 deletions
+5 -5
View File
@@ -86,7 +86,7 @@ static int luaModelSetInfo(lua_State *L)
Get RF module parameters
`rfProtocol` values:
`subType` values:
* -1 OFF
* 0 D16
* 1 D8
@@ -97,7 +97,7 @@ Get RF module parameters
@retval nil requested module does not exist
@retval table module parameters:
* `rfProtocol` (number) protocol index
* `subType` (number) protocol index
* `modelId` (number) receiver number
* `firstChannel` (number) start channel (0 is CH1)
* `channelsCount` (number) number of channels sent to module
@@ -110,7 +110,7 @@ static int luaModelGetModule(lua_State *L)
if (idx < NUM_MODULES) {
ModuleData & module = g_model.moduleData[idx];
lua_newtable(L);
lua_pushtableinteger(L, "rfProtocol", module.rfProtocol);
lua_pushtableinteger(L, "subType", module.subType);
lua_pushtableinteger(L, "modelId", g_model.header.modelId[idx]);
lua_pushtableinteger(L, "firstChannel", module.channelsStart);
lua_pushtableinteger(L, "channelsCount", module.channelsCount + 8);
@@ -145,8 +145,8 @@ static int luaModelSetModule(lua_State *L)
for (lua_pushnil(L); lua_next(L, -2); lua_pop(L, 1)) {
luaL_checktype(L, -2, LUA_TSTRING); // key is string
const char * key = luaL_checkstring(L, -2);
if (!strcmp(key, "rfProtocol")) {
module.rfProtocol = luaL_checkinteger(L, -1);
if (!strcmp(key, "subType")) {
module.subType = luaL_checkinteger(L, -1);
}
else if (!strcmp(key, "modelId")) {
g_model.header.modelId[idx] = luaL_checkinteger(L, -1);