diff --git a/companion/src/firmwares/boards.cpp b/companion/src/firmwares/boards.cpp index 59e36715c..1d9d6cfd6 100644 --- a/companion/src/firmwares/boards.cpp +++ b/companion/src/firmwares/boards.cpp @@ -346,7 +346,7 @@ SwitchInfo Boards::getSwitchInfo(Board::Type board, int index) if (index < DIM(switches)) return switches[index]; } - else if (IS_FLYSKY_NV14(board) || IS_FLYSKY_EL18(board)) { + else if (IS_FLYSKY_NV14(board)) { const Board::SwitchInfo switches[] = { {SWITCH_2POS, "SA"}, {SWITCH_3POS, "SB"}, @@ -360,6 +360,20 @@ SwitchInfo Boards::getSwitchInfo(Board::Type board, int index) if (index < DIM(switches)) return switches[index]; } + else if (IS_FLYSKY_EL18(board)) { + const Board::SwitchInfo switches[] = { + {SWITCH_2POS, "SA"}, + {SWITCH_3POS, "SB"}, + {SWITCH_3POS, "SC"}, + {SWITCH_2POS, "SD"}, + {SWITCH_2POS, "SE"}, + {SWITCH_3POS, "SF"}, + {SWITCH_3POS, "SG"}, + {SWITCH_TOGGLE, "SH"} + }; + if (index < DIM(switches)) + return switches[index]; + } else if (IS_FAMILY_HORUS_OR_T16(board)) { const Board::SwitchInfo switches[] = { {SWITCH_3POS, "SA"}, @@ -700,10 +714,17 @@ StringTagMappingTable Boards::getAnalogNamesLookupTable(Board::Type board, const {tr("S3").toStdString(), "POT3"}, }); } else if ((IS_TARANIS_SMALL(board) && !IS_JUMPER_TLITE(board)) || IS_FLYSKY_NV14(board) || IS_FLYSKY_EL18(board)) { - tbl.insert(tbl.end(), { - {tr("S1").toStdString(), "POT1"}, - {tr("S2").toStdString(), "POT2"}, - }); + if (version < adcVersion) { + tbl.insert(tbl.end(), { + {tr("S1").toStdString(), "POT1"}, + {tr("S2").toStdString(), "POT2"}, + }); + } else { + tbl.insert(tbl.end(), { + {tr("S1").toStdString(), "P1", 4}, + {tr("S2").toStdString(), "P2", 5}, + }); + } } else if (IS_TARANIS_X9(board)) { if (version < adcVersion) { tbl.insert(tbl.end(), { @@ -892,6 +913,8 @@ QString Boards::potTypeToString(int value) return tr("Multi pos switch"); case POT_WITHOUT_DETENT: return tr("Pot without detent"); + case POT_SLIDER_WITH_DETENT: + return tr("slider"); default: return CPN_STR_UNKNOWN_ITEM; } diff --git a/companion/src/firmwares/boards.h b/companion/src/firmwares/boards.h index 438f03641..203061e5a 100644 --- a/companion/src/firmwares/boards.h +++ b/companion/src/firmwares/boards.h @@ -83,6 +83,7 @@ namespace Board { POT_WITH_DETENT, POT_MULTIPOS_SWITCH, POT_WITHOUT_DETENT, + POT_SLIDER_WITH_DETENT, POT_TYPE_COUNT }; diff --git a/companion/src/firmwares/edgetx/yaml_generalsettings.cpp b/companion/src/firmwares/edgetx/yaml_generalsettings.cpp index e2852dd92..5172835d7 100644 --- a/companion/src/firmwares/edgetx/yaml_generalsettings.cpp +++ b/companion/src/firmwares/edgetx/yaml_generalsettings.cpp @@ -184,6 +184,7 @@ Node convert::encode(const GeneralSettings& rhs) node["fai"] = (int)rhs.fai; node["disableMemoryWarning"] = (int)rhs.disableMemoryWarning; node["beepMode"] = rhs.beeperMode; + node["alarmsFlash"] = (int)rhs.flashBeep; node["disableAlarmWarning"] = (int)rhs.disableAlarmWarning; node["disableRssiPoweroffAlarm"] = (int)rhs.disableRssiPoweroffAlarm; node["USBMode"] = rhs.usbMode; @@ -297,7 +298,7 @@ Node convert::encode(const GeneralSettings& rhs) seq = getCurrentFirmware()->getAnalogInputSeqADC(adcoffset + i) - sticks; if (seq >= 0 && seq < maxPots) { strcpy(potName[seq], rhs.sliderName[i]); - potConfig[seq] = rhs.sliderConfig[i]; + potConfig[seq] = ((rhs.sliderConfig[i] == Board::SLIDER_WITH_DETENT) ? Board::POT_SLIDER_WITH_DETENT : Board::POT_NONE); } } @@ -436,6 +437,7 @@ bool convert::decode(const Node& node, GeneralSettings& rhs) node["fai"] >> rhs.fai; node["disableMemoryWarning"] >> rhs.disableMemoryWarning; node["beepMode"] >> rhs.beeperMode; + node["alarmsFlash"] >> rhs.flashBeep; node["disableAlarmWarning"] >> rhs.disableAlarmWarning; node["disableRssiPoweroffAlarm"] >> rhs.disableRssiPoweroffAlarm; node["USBMode"] >> rhs.usbMode; @@ -576,7 +578,7 @@ bool convert::decode(const Node& node, GeneralSettings& rhs) else { for (int i = 0; i < Boards::getCapability(board, Board::Sliders); i++) { strcpy(rhs.sliderName[i], potName[numPots + i]); - rhs.sliderConfig[i] = potConfig[numPots + i]; + rhs.sliderConfig[i] = ((potConfig[numPots + i] == Board::POT_SLIDER_WITH_DETENT) ? Board::SLIDER_WITH_DETENT : Board::SLIDER_NONE); } } diff --git a/companion/src/firmwares/edgetx/yaml_rawsource.cpp b/companion/src/firmwares/edgetx/yaml_rawsource.cpp index d61ffc4bf..063705c96 100644 --- a/companion/src/firmwares/edgetx/yaml_rawsource.cpp +++ b/companion/src/firmwares/edgetx/yaml_rawsource.cpp @@ -264,6 +264,8 @@ RawSource YamlRawSourceDecode(const std::string& src_str) } int ana_idx = getCurrentFirmware()->getAnalogInputIndex(ana_str.c_str()); + if (ana_idx < 0) + ana_idx = getCurrentFirmware()->getAnalogInputIndexADC(ana_str.c_str()); if (ana_idx >= 0) { rhs.type = SOURCE_TYPE_STICK; rhs.index = ana_idx; diff --git a/companion/src/firmwares/edgetx/yaml_switchconfig.cpp b/companion/src/firmwares/edgetx/yaml_switchconfig.cpp index 94b2b3e9b..0ea5f48df 100644 --- a/companion/src/firmwares/edgetx/yaml_switchconfig.cpp +++ b/companion/src/firmwares/edgetx/yaml_switchconfig.cpp @@ -36,6 +36,7 @@ const YamlLookupTable potConfigLut = { {Board::POT_WITH_DETENT, "with_detent"}, {Board::POT_MULTIPOS_SWITCH, "multipos_switch"}, {Board::POT_WITHOUT_DETENT, "without_detent"}, + {Board::POT_SLIDER_WITH_DETENT, "slider"}, }; const YamlLookupTable slidersLut = { diff --git a/companion/src/firmwares/eeprominterface.h b/companion/src/firmwares/eeprominterface.h index a757ffd2c..700611d37 100644 --- a/companion/src/firmwares/eeprominterface.h +++ b/companion/src/firmwares/eeprominterface.h @@ -172,6 +172,7 @@ enum Capability { HasIntModuleCRSF, HasIntModuleELRS, HasIntModuleFlySky, + BacklightLevelMin, }; class EEPROMInterface diff --git a/companion/src/firmwares/opentx/opentxinterface.cpp b/companion/src/firmwares/opentx/opentxinterface.cpp index 905adff08..1087dc75a 100644 --- a/companion/src/firmwares/opentx/opentxinterface.cpp +++ b/companion/src/firmwares/opentx/opentxinterface.cpp @@ -804,6 +804,12 @@ int OpenTxFirmware::getCapability(::Capability capability) case HasIntModuleFlySky: return id.contains("afhds2a") || id.contains("afhds3") || IS_FLYSKY_NV14(board) || IS_FLYSKY_EL18(board); + case BacklightLevelMin: + if (IS_HORUS_X12S(board)) + return 5; + if (IS_FAMILY_T16(board) || IS_FLYSKY_NV14(board) || IS_FLYSKY_EL18(board)) + return 1; + return 46; default: return 0; } diff --git a/companion/src/generaledit/generalsetup.cpp b/companion/src/generaledit/generalsetup.cpp index f0ad1bf80..75d3b2dab 100644 --- a/companion/src/generaledit/generalsetup.cpp +++ b/companion/src/generaledit/generalsetup.cpp @@ -254,6 +254,10 @@ ui(new Ui::GeneralSetup) populateRotEncCB(reCount); } + if (Boards::getCapability(firmware->getBoard(), Board::HasColorLcd)) { + ui->backlightautoSB->setMinimum(5); + } + ui->contrastSB->setMinimum(firmware->getCapability(MinContrast)); ui->contrastSB->setMaximum(firmware->getCapability(MaxContrast)); ui->contrastSB->setValue(generalSettings.contrast); @@ -470,10 +474,15 @@ void GeneralSetupPanel::setValues() ui->label_HL->hide(); ui->hapticLengthCB->hide(); } + ui->OFFBright_SB->setMinimum(firmware->getCapability(BacklightLevelMin)); + if (generalSettings.backlightOffBright > 100-generalSettings.backlightBright) + generalSettings.backlightOffBright = 100-generalSettings.backlightBright; ui->BLBright_SB->setValue(100-generalSettings.backlightBright); ui->OFFBright_SB->setValue(generalSettings.backlightOffBright); + ui->BLBright_SB->setMinimum(ui->OFFBright_SB->value()); + ui->OFFBright_SB->setMaximum(ui->BLBright_SB->value()); ui->soundModeCB->setCurrentIndex(generalSettings.speakerMode); - ui->volume_SB->setValue(generalSettings.speakerVolume); + ui->volume_SB->setValue(generalSettings.speakerVolume + 12); ui->beeperlenCB->setCurrentIndex(generalSettings.beeperLength+2); ui->speakerPitchSB->setValue(generalSettings.speakerPitch); ui->hapticStrength->setValue(generalSettings.hapticStrength); @@ -624,19 +633,29 @@ void GeneralSetupPanel::on_varioR0_SB_editingFinished() void GeneralSetupPanel::on_BLBright_SB_editingFinished() { - generalSettings.backlightBright = 100 - ui->BLBright_SB->value(); - emit modified(); + if (ui->BLBright_SB->value() < ui->OFFBright_SB->value()) { + ui->BLBright_SB->setValue(ui->OFFBright_SB->value()); + } else { + ui->OFFBright_SB->setMaximum(ui->BLBright_SB->value()); + generalSettings.backlightBright = 100 - ui->BLBright_SB->value(); + emit modified(); + } } void GeneralSetupPanel::on_OFFBright_SB_editingFinished() { - generalSettings.backlightOffBright = ui->OFFBright_SB->value(); - emit modified(); + if (ui->OFFBright_SB->value() > ui->BLBright_SB->value()) { + ui->OFFBright_SB->setValue(ui->BLBright_SB->value()); + } else { + ui->BLBright_SB->setMinimum(ui->OFFBright_SB->value()); + generalSettings.backlightOffBright = ui->OFFBright_SB->value(); + emit modified(); + } } void GeneralSetupPanel::on_volume_SB_editingFinished() { - generalSettings.speakerVolume = ui->volume_SB->value(); + generalSettings.speakerVolume = ui->volume_SB->value() - 12; emit modified(); }