mirror of
https://github.com/opentx/opentx.git
synced 2025-07-23 08:15:17 +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();
|
||||
used = true;
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -638,7 +638,7 @@ static int luaModelSetModule(lua_State *L)
|
|||
module.rfProtocol = luaL_checkinteger(L, -1);
|
||||
}
|
||||
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")) {
|
||||
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];
|
||||
if (modelId != 0) {
|
||||
for (uint8_t i=0; i<MAX_MODELS; i++) {
|
||||
if (i != index) {
|
||||
for (uint8_t j=0; j<NUM_MODULES; j++) {
|
||||
if (i == index && module == j) {
|
||||
continue;
|
||||
}
|
||||
else if (modelId == modelHeaders[i].modelId[j]) {
|
||||
if (modelId == modelHeaders[i].modelId[j]) {
|
||||
POPUP_WARNING(STR_MODELIDUSED);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -421,9 +420,10 @@ void modelDefault(uint8_t id)
|
|||
g_model.externalModule = MODULE_TYPE_PPM;
|
||||
#endif
|
||||
|
||||
#if defined(PXX) && defined(CPUARM)
|
||||
modelHeaders[id].modelId[1] = g_model.header.modelId[1] = 0;
|
||||
modelHeaders[id].modelId[0] = g_model.header.modelId[0] = id+1;
|
||||
#if defined(CPUARM)
|
||||
for (int i=0; i<NUM_MODULES; i++) {
|
||||
modelHeaders[id].modelId[i] = g_model.header.modelId[i] = id+1;
|
||||
}
|
||||
checkModelIdUnique(id, 0);
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue