feat: Remove TR# mixsrc when trainer disabled (#2323)
* feat: Remove TR# mixsrc when trainer disabled When trainer mode is not enabled, there is no point showing the TR# mixer sources. Once you enable a trainer option, they will become visible again. * fix: Add missing "Input" check for B&W radios * fix(cpn): Trainer mode default is off * chore(cpn): If trainer mode off, hide TR/PPM srcs * (cpn) Refresh all source lists on change of trainer mode Co-authored-by: elecpower <neilh713@tpg.com.au>
This commit is contained in:
co-authored by
elecpower
parent
41cfeee5b0
commit
3969b2b7e3
@@ -177,7 +177,7 @@ void ModelData::clear()
|
||||
for (unsigned i = 0; i < CPN_MAX_SENSORS; i++)
|
||||
sensorData[i].clear();
|
||||
|
||||
trainerMode = TRAINER_MODE_MASTER_JACK;
|
||||
trainerMode = TRAINER_MODE_OFF;
|
||||
|
||||
const char * layoutId = "Layout2P1"; // currently all using same default though might change for NV14
|
||||
RadioLayout::init(layoutId, customScreens);
|
||||
|
||||
@@ -333,6 +333,9 @@ bool RawSource::isAvailable(const ModelData * const model, const GeneralSettings
|
||||
if (type == SOURCE_TYPE_VIRTUAL_INPUT && !model->isInputValid(index))
|
||||
return false;
|
||||
|
||||
if (type == SOURCE_TYPE_PPM && model->trainerMode == TRAINER_MODE_OFF)
|
||||
return false;
|
||||
|
||||
if (type == SOURCE_TYPE_CUSTOM_SWITCH && model->logicalSw[index].isEmpty())
|
||||
return false;
|
||||
|
||||
|
||||
@@ -247,6 +247,7 @@ ModulePanel::ModulePanel(QWidget * parent, ModelData & model, ModuleData & modul
|
||||
ui->trainerMode->setField(model.trainerMode);
|
||||
connect(ui->trainerMode, &AutoComboBox::currentDataChanged, this, [=] () {
|
||||
update();
|
||||
emit updateItemModels();
|
||||
emit modified();
|
||||
});
|
||||
}
|
||||
@@ -1538,6 +1539,7 @@ SetupPanel::SetupPanel(QWidget * parent, ModelData & model, GeneralSettings & ge
|
||||
modules[CPN_MAX_MODULES] = new ModulePanel(this, model, model.moduleData[CPN_MAX_MODULES], generalSettings, firmware, -1, panelFilteredModels);
|
||||
ui->modulesLayout->addWidget(modules[CPN_MAX_MODULES]);
|
||||
connect(modules[CPN_MAX_MODULES], &ModulePanel::modified, this, &SetupPanel::modified);
|
||||
connect(modules[CPN_MAX_MODULES], &ModulePanel::updateItemModels, this, &SetupPanel::onModuleUpdateItemModels);
|
||||
}
|
||||
|
||||
disableMouseScrolling();
|
||||
|
||||
@@ -55,7 +55,12 @@ void insertExpo(uint8_t idx)
|
||||
ExpoData * expo = expoAddress(idx);
|
||||
memmove(expo+1, expo, (MAX_EXPOS-(idx+1))*sizeof(ExpoData));
|
||||
memclear(expo, sizeof(ExpoData));
|
||||
expo->srcRaw = (s_currCh > 4 ? MIXSRC_Rud - 1 + s_currCh : MIXSRC_Rud - 1 + channelOrder(s_currCh));
|
||||
for (int i = s_currCh; i < INPUTSRC_LAST; i++) {
|
||||
expo->srcRaw = (s_currCh > 4 ? MIXSRC_Rud - 1 + i: MIXSRC_Rud - 1 + channelOrder(i));
|
||||
if (isSourceAvailableInInputs(expo->srcRaw)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
expo->curve.type = CURVE_REF_EXPO;
|
||||
expo->mode = 3; // pos+neg
|
||||
expo->chn = s_currCh - 1;
|
||||
|
||||
@@ -230,6 +230,9 @@ bool isSourceAvailable(int source)
|
||||
if (source >= MIXSRC_FIRST_RESERVE && source <= MIXSRC_LAST_RESERVE)
|
||||
return false;
|
||||
|
||||
if (source >= MIXSRC_FIRST_TRAINER && source <= MIXSRC_LAST_TRAINER)
|
||||
return g_model.trainerData.mode > 0;
|
||||
|
||||
if (source >= MIXSRC_FIRST_TELEM && source <= MIXSRC_LAST_TELEM) {
|
||||
div_t qr = div(source - MIXSRC_FIRST_TELEM, 3);
|
||||
if (qr.rem == 0)
|
||||
@@ -289,7 +292,7 @@ bool isSourceAvailableInInputs(int source)
|
||||
}
|
||||
|
||||
if (source >= MIXSRC_FIRST_TRAINER && source <= MIXSRC_LAST_TRAINER)
|
||||
return true;
|
||||
return g_model.trainerData.mode > 0;
|
||||
|
||||
if (source >= MIXSRC_FIRST_TELEM && source <= MIXSRC_LAST_TELEM) {
|
||||
div_t qr = div(source - MIXSRC_FIRST_TELEM, 3);
|
||||
|
||||
Reference in New Issue
Block a user