mirror of
https://github.com/opentx/opentx.git
synced 2025-07-23 16:25:16 +03:00
Damjan and Kilrah remarks taken into account
This commit is contained in:
parent
9ed37ab21b
commit
bda87be10e
3 changed files with 14 additions and 12 deletions
|
@ -1366,7 +1366,9 @@ void ModelData::setDefaultValues(unsigned int id, const GeneralSettings & settin
|
||||||
clear();
|
clear();
|
||||||
used = true;
|
used = true;
|
||||||
sprintf(name, "MODEL%02d", id+1);
|
sprintf(name, "MODEL%02d", id+1);
|
||||||
moduleData[0].modelId = id+1;
|
for (int i=0; i<C9X_NUM_MODULES; i++) {
|
||||||
|
moduleData[i].modelId = id+1;
|
||||||
|
}
|
||||||
setDefaultMixes(settings);
|
setDefaultMixes(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -638,7 +638,7 @@ static int luaModelSetModule(lua_State *L)
|
||||||
module.rfProtocol = luaL_checkinteger(L, -1);
|
module.rfProtocol = luaL_checkinteger(L, -1);
|
||||||
}
|
}
|
||||||
else if (!strcmp(key, "modelId")) {
|
else if (!strcmp(key, "modelId")) {
|
||||||
g_model.header.modelId[idx] = luaL_checkinteger(L, -1);
|
g_model.header.modelId[idx] = modelHeaders[g_eeGeneral.currModel].modelId[idx] = luaL_checkinteger(L, -1);
|
||||||
}
|
}
|
||||||
else if (!strcmp(key, "firstChannel")) {
|
else if (!strcmp(key, "firstChannel")) {
|
||||||
module.channelsStart = luaL_checkinteger(L, -1);
|
module.channelsStart = luaL_checkinteger(L, -1);
|
||||||
|
|
|
@ -379,17 +379,16 @@ void checkModelIdUnique(uint8_t index, uint8_t module)
|
||||||
uint8_t modelId = g_model.header.modelId[module];
|
uint8_t modelId = g_model.header.modelId[module];
|
||||||
if (modelId != 0) {
|
if (modelId != 0) {
|
||||||
for (uint8_t i=0; i<MAX_MODELS; i++) {
|
for (uint8_t i=0; i<MAX_MODELS; i++) {
|
||||||
|
if (i != index) {
|
||||||
for (uint8_t j=0; j<NUM_MODULES; j++) {
|
for (uint8_t j=0; j<NUM_MODULES; j++) {
|
||||||
if (i == index && module == j) {
|
if (modelId == modelHeaders[i].modelId[j]) {
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else if (modelId == modelHeaders[i].modelId[j]) {
|
|
||||||
POPUP_WARNING(STR_MODELIDUSED);
|
POPUP_WARNING(STR_MODELIDUSED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -421,9 +420,10 @@ void modelDefault(uint8_t id)
|
||||||
g_model.externalModule = MODULE_TYPE_PPM;
|
g_model.externalModule = MODULE_TYPE_PPM;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PXX) && defined(CPUARM)
|
#if defined(CPUARM)
|
||||||
modelHeaders[id].modelId[1] = g_model.header.modelId[1] = 0;
|
for (int i=0; i<NUM_MODULES; i++) {
|
||||||
modelHeaders[id].modelId[0] = g_model.header.modelId[0] = id+1;
|
modelHeaders[id].modelId[i] = g_model.header.modelId[i] = id+1;
|
||||||
|
}
|
||||||
checkModelIdUnique(id, 0);
|
checkModelIdUnique(id, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue