diff --git a/companion/src/firmwares/customfunctiondata.cpp b/companion/src/firmwares/customfunctiondata.cpp index c93e0965b..9313ace5a 100644 --- a/companion/src/firmwares/customfunctiondata.cpp +++ b/companion/src/firmwares/customfunctiondata.cpp @@ -55,6 +55,8 @@ QString CustomFunctionData::funcToString(const ModelData * model) const return tr("Trainer THR"); else if (func == FuncTrainerAIL) return tr("Trainer AIL"); + else if (func == FuncTrainerChannels) + return tr("Trainer Channels"); else if (func == FuncInstantTrim) return tr("Instant Trim"); else if (func == FuncPlaySound) diff --git a/companion/src/firmwares/customfunctiondata.h b/companion/src/firmwares/customfunctiondata.h index 2ffce6688..9150035c5 100644 --- a/companion/src/firmwares/customfunctiondata.h +++ b/companion/src/firmwares/customfunctiondata.h @@ -41,6 +41,7 @@ enum AssignFunc { FuncTrainerELE, FuncTrainerTHR, FuncTrainerAIL, + FuncTrainerChannels, FuncInstantTrim, FuncPlaySound, FuncPlayHaptic, diff --git a/companion/src/firmwares/opentx/opentxeeprom.cpp b/companion/src/firmwares/opentx/opentxeeprom.cpp index 9632be9e4..21e067a2d 100644 --- a/companion/src/firmwares/opentx/opentxeeprom.cpp +++ b/companion/src/firmwares/opentx/opentxeeprom.cpp @@ -1395,6 +1395,7 @@ class CustomFunctionsConversionTable: public ConversionTable { addConversion(FuncTrainerELE, val); addConversion(FuncTrainerTHR, val); addConversion(FuncTrainerAIL, val); + addConversion(FuncTrainerChannels, val); val++; addConversion(FuncInstantTrim, val++); @@ -1515,7 +1516,7 @@ class ArmCustomFunctionField: public TransformedField { *((uint16_t *)_param) = fn.param; *((uint8_t *)(_param+3)) = fn.func - FuncOverrideCH1; } - else if (fn.func >= FuncTrainer && fn.func <= FuncTrainerAIL) { + else if (fn.func >= FuncTrainer && fn.func <= FuncTrainerChannels) { *((uint8_t *)(_param+3)) = fn.func - FuncTrainer; } else if (fn.func >= FuncSetTimer1 && fn.func <= FuncSetTimer3) { @@ -1582,7 +1583,7 @@ class ArmCustomFunctionField: public TransformedField { fn.func = AssignFunc(fn.func + index); fn.param = (int)value; } - else if (fn.func >= FuncTrainer && fn.func <= FuncTrainerAIL) { + else if (fn.func >= FuncTrainer && fn.func <= FuncTrainerChannels) { fn.func = AssignFunc(fn.func + index); fn.param = value; } diff --git a/companion/src/modeledit/customfunctions.cpp b/companion/src/modeledit/customfunctions.cpp index c30454bdc..fdba765d8 100644 --- a/companion/src/modeledit/customfunctions.cpp +++ b/companion/src/modeledit/customfunctions.cpp @@ -70,7 +70,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, GenericPanel(parent, model, generalSettings, firmware), functions(model ? model->customFn : generalSettings.customFn), mediaPlayerCurrent(-1), - mediaPlayer(NULL) + mediaPlayer(nullptr) { Stopwatch s1("CustomFunctionsPanel - populate"); lock = true; @@ -84,7 +84,7 @@ CustomFunctionsPanel::CustomFunctionsPanel(QWidget * parent, ModelData * model, if (!firmware->getCapability(VoicesAsNumbers)) { tracksSet = getFilesSet(getSoundsPath(generalSettings), QStringList() << "*.wav" << "*.WAV", firmware->getCapability(VoicesMaxLength)); for (int i=0; igetBoard())) { scriptsSet = getFilesSet(g.profile[g.id()].sdPath() + "/SCRIPTS/FUNCTIONS", QStringList() << "*.lua", firmware->getCapability(VoicesMaxLength)); for (int i=0; i=FuncOverrideCH1 && func<=FuncOverrideCH32) { + if (func >= FuncOverrideCH1 && func <= FuncOverrideCH32) { if (model) { int channelsMax = model->getChannelsMax(true); fswtchParam[i]->setDecimals(0); @@ -403,7 +403,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified) widgetsMask |= CUSTOM_FUNCTION_NUMERIC_PARAM | CUSTOM_FUNCTION_ENABLE; } } - else if (func==FuncLogs) { + else if (func == FuncLogs) { fswtchParam[i]->setDecimals(1); fswtchParam[i]->setMinimum(0); fswtchParam[i]->setMaximum(25.5); @@ -413,13 +413,13 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified) fswtchParam[i]->setValue(cfn.param/10.0); widgetsMask |= CUSTOM_FUNCTION_NUMERIC_PARAM; } - else if (func>=FuncAdjustGV1 && func<=FuncAdjustGVLast) { + else if (func >= FuncAdjustGV1 && func <= FuncAdjustGVLast) { int gvidx = func - FuncAdjustGV1; if (modified) cfn.adjustMode = fswtchGVmode[i]->currentIndex(); fswtchGVmode[i]->setCurrentIndex(cfn.adjustMode); widgetsMask |= CUSTOM_FUNCTION_GV_MODE | CUSTOM_FUNCTION_ENABLE; - if (cfn.adjustMode==FUNC_ADJUST_GVAR_CONSTANT || cfn.adjustMode==FUNC_ADJUST_GVAR_INCDEC) { + if (cfn.adjustMode == FUNC_ADJUST_GVAR_CONSTANT || cfn.adjustMode == FUNC_ADJUST_GVAR_INCDEC) { if (modified) cfn.param = fswtchParam[i]->value() * model->gvarData[gvidx].multiplierSet(); if (IS_ARM(getCurrentBoard())) { @@ -454,13 +454,13 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified) widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM; } } - else if (func==FuncReset) { + else if (func == FuncReset) { if (modified) cfn.param = fswtchParamT[i]->currentData().toInt(); populateFuncParamCB(fswtchParamT[i], func, cfn.param); widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM | CUSTOM_FUNCTION_ENABLE; } - else if (func>=FuncSetTimer1 && func<=FuncSetTimer3) { + else if (func >= FuncSetTimer1 && func <= FuncSetTimer3) { if (modified) cfn.param = fswtchParamTime[i]->timeInSeconds(); RawSourceRange range = RawSource(SOURCE_TYPE_SPECIAL, func - FuncSetTimer1 + 2).getRange(model, generalSettings); @@ -468,39 +468,39 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified) fswtchParamTime[i]->setTime(cfn.param); widgetsMask |= CUSTOM_FUNCTION_TIME_PARAM | CUSTOM_FUNCTION_ENABLE; } - else if (func>=FuncSetFailsafeInternalModule && func<=FuncBindExternalModule) { + else if (func >= FuncSetFailsafeInternalModule && func <= FuncBindExternalModule) { widgetsMask |= CUSTOM_FUNCTION_ENABLE; } - else if (func==FuncVolume) { + else if (func == FuncVolume) { if (modified) cfn.param = fswtchParamT[i]->currentData().toInt(); populateFuncParamCB(fswtchParamT[i], func, cfn.param); widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM | CUSTOM_FUNCTION_ENABLE; } - else if (func==FuncPlaySound || func==FuncPlayHaptic || func==FuncPlayValue || func==FuncPlayPrompt || func==FuncPlayBoth || func==FuncBackgroundMusic) { + else if (func == FuncPlaySound || func == FuncPlayHaptic || func == FuncPlayValue || func == FuncPlayPrompt || func == FuncPlayBoth || func == FuncBackgroundMusic) { if (func != FuncBackgroundMusic) { widgetsMask |= CUSTOM_FUNCTION_REPEAT; fswtchRepeat[i]->update(); } - if (func==FuncPlayValue) { + if (func == FuncPlayValue) { if (modified) cfn.param = fswtchParamT[i]->currentData().toInt(); populateFuncParamCB(fswtchParamT[i], func, cfn.param); widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM | CUSTOM_FUNCTION_REPEAT; } - else if (func==FuncPlayPrompt || func==FuncPlayBoth) { + else if (func == FuncPlayPrompt || func == FuncPlayBoth) { if (firmware->getCapability(VoicesAsNumbers)) { fswtchParam[i]->setDecimals(0); fswtchParam[i]->setSingleStep(1); fswtchParam[i]->setMinimum(0); - if (func==FuncPlayPrompt) { + if (func == FuncPlayPrompt) { widgetsMask |= CUSTOM_FUNCTION_NUMERIC_PARAM | CUSTOM_FUNCTION_REPEAT | CUSTOM_FUNCTION_GV_TOOGLE; } else { widgetsMask |= CUSTOM_FUNCTION_NUMERIC_PARAM | CUSTOM_FUNCTION_REPEAT; fswtchParamGV[i]->setChecked(false); } - fswtchParam[i]->setMaximum(func==FuncPlayBoth ? 254 : 255); + fswtchParam[i]->setMaximum(func == FuncPlayBoth ? 254 : 255); if (modified) { if (fswtchParamGV[i]->isChecked()) { fswtchParam[i]->setMinimum(1); @@ -533,7 +533,7 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified) } } } - else if (func==FuncBackgroundMusic) { + else if (func == FuncBackgroundMusic) { widgetsMask |= CUSTOM_FUNCTION_FILE_PARAM; if (modified) { Helpers::getFileComboBoxValue(fswtchParamArmT[i], cfn.paramarm, firmware->getCapability(VoicesMaxLength)); @@ -543,27 +543,27 @@ void CustomFunctionsPanel::refreshCustomFunction(int i, bool modified) widgetsMask |= CUSTOM_FUNCTION_PLAY; } } - else if (func==FuncPlaySound) { + else if (func == FuncPlaySound) { if (modified) cfn.param = (uint8_t)fswtchParamT[i]->currentIndex(); populateFuncParamCB(fswtchParamT[i], func, cfn.param); widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM; } - else if (func==FuncPlayHaptic) { + else if (func == FuncPlayHaptic) { if (modified) cfn.param = (uint8_t)fswtchParamT[i]->currentIndex(); populateFuncParamCB(fswtchParamT[i], func, cfn.param); widgetsMask |= CUSTOM_FUNCTION_SOURCE_PARAM; } } - else if (func==FuncPlayScript) { + else if (func == FuncPlayScript) { widgetsMask |= CUSTOM_FUNCTION_FILE_PARAM; if (modified) { Helpers::getFileComboBoxValue(fswtchParamArmT[i], cfn.paramarm, 8); } Helpers::populateFileComboBox(fswtchParamArmT[i], scriptsSet, cfn.paramarm); } - else if (func==FuncBacklight && IS_TARANIS_PLUS(getCurrentBoard())) { + else if (func == FuncBacklight && IS_TARANIS_PLUS(getCurrentBoard())) { if (modified) cfn.param = (uint8_t)fswtchBLcolor[i]->value(); fswtchBLcolor[i]->setValue(cfn.param); diff --git a/companion/src/releasenotesfirmwaredialog.cpp b/companion/src/releasenotesfirmwaredialog.cpp index bcce6709c..753599c52 100644 --- a/companion/src/releasenotesfirmwaredialog.cpp +++ b/companion/src/releasenotesfirmwaredialog.cpp @@ -50,4 +50,3 @@ void ReleaseNotesFirmwareDialog::replyFinished(QNetworkReply * reply) ui->textEditor->setOpenExternalLinks(true); reply->deleteLater(); } -