chore(cpn): remove redundant macro and unused fields (#7071)

This commit is contained in:
Neil Horne
2026-02-07 10:37:11 +10:00
committed by GitHub
parent e4fc09bfea
commit 539f722e9b
19 changed files with 859 additions and 1591 deletions
+1 -99
View File
@@ -51,48 +51,6 @@ ui(new Ui::GeneralSetup)
panelFilteredModels->registerItemModel(new FilteredItemModel(sharedItemModels->getItemModel(AbstractItemModel::IMID_ControlSource)),
FIM_CONTROLSRC);
QLabel *pmsl[] = {ui->ro_label, ui->ro1_label, ui->ro2_label, ui->ro3_label, ui->ro4_label, ui->ro5_label, ui->ro6_label, ui->ro7_label, ui->ro8_label, NULL};
QSlider *tpmsld[] = {ui->chkSA, ui->chkSB, ui->chkSC, ui->chkSD, ui->chkSE, ui->chkSF, ui->chkSG, ui->chkSH, NULL};
if (IS_TARANIS(board)) {
if (firmware->getId().contains("readonly")) {
uint16_t switchstate = generalSettings.switchUnlockStates;
ui->chkSA->setValue(switchstate & 0x3);
switchstate >>= 2;
ui->chkSB->setValue(switchstate & 0x3);
switchstate >>= 2;
ui->chkSC->setValue(switchstate & 0x3);
switchstate >>= 2;
ui->chkSD->setValue(switchstate & 0x3);
switchstate >>= 2;
ui->chkSE->setValue(switchstate & 0x3);
switchstate >>= 2;
ui->chkSF->setValue((switchstate & 0x3) / 2);
switchstate >>= 2;
ui->chkSG->setValue(switchstate & 0x3);
switchstate >>= 2;
ui->chkSH->setValue(switchstate & 0x3);
}
else {
for (int i = 0; pmsl[i]; i++) {
pmsl[i]->hide();
}
for (int i = 0; tpmsld[i]; i++) {
tpmsld[i]->hide();
}
this->layout()->removeItem(ui->TaranisReadOnlyUnlock);
}
}
else {
for (int i = 0; pmsl[i]; i++) {
pmsl[i]->hide();
}
for (int i = 0; tpmsld[i]; i++) {
tpmsld[i]->hide();
}
this->layout()->removeItem(ui->TaranisReadOnlyUnlock);
}
lock = true;
ui->volumeCtrl_CB->setSizeAdjustPolicy(QComboBox::AdjustToContents);
@@ -135,13 +93,7 @@ ui(new Ui::GeneralSetup)
ui->ppm_units_CB->setCurrentIndex(generalSettings.ppmunit);
ui->gpsFormatCB->setCurrentIndex(generalSettings.gpsFormat);
ui->timezoneLE->setTime((generalSettings.timezone * 3600) + (generalSettings.timezoneMinutes/*quarter hours*/ * 15 * 60));
if (IS_HORUS_OR_TARANIS(board)) {
ui->adjustRTC->setChecked(generalSettings.adjustRTC);
}
else {
ui->adjustRTC->hide();
}
ui->adjustRTC->setChecked(generalSettings.adjustRTC);
if (IS_STM32(board)) {
ui->usbModeCB->setCurrentIndex(generalSettings.usbMode);
@@ -235,28 +187,6 @@ ui(new Ui::GeneralSetup)
lock = false;
for (int i = 0; tpmsld[i]; i++) {
connect(tpmsld[i], SIGNAL(valueChanged(int)),this,SLOT(unlockSwitchEdited()));
}
if (!IS_HORUS_OR_TARANIS(board)) {
ui->stickReverse1->setChecked(generalSettings.stickReverse & (1 << 0));
ui->stickReverse2->setChecked(generalSettings.stickReverse & (1 << 1));
ui->stickReverse3->setChecked(generalSettings.stickReverse & (1 << 2));
ui->stickReverse4->setChecked(generalSettings.stickReverse & (1 << 3));
connect(ui->stickReverse1, SIGNAL(toggled(bool)), this, SLOT(stickReverseEdited()));
connect(ui->stickReverse2, SIGNAL(toggled(bool)), this, SLOT(stickReverseEdited()));
connect(ui->stickReverse3, SIGNAL(toggled(bool)), this, SLOT(stickReverseEdited()));
connect(ui->stickReverse4, SIGNAL(toggled(bool)), this, SLOT(stickReverseEdited()));
}
else {
ui->stickReverseLB->hide();
ui->stickReverse1->hide();
ui->stickReverse2->hide();
ui->stickReverse3->hide();
ui->stickReverse4->hide();
}
if (Boards::getCapability(board, Board::HasBacklightColor)) {
ui->backlightColor_SL->setValue(generalSettings.backlightColor);
}
@@ -954,23 +884,6 @@ void GeneralSetupPanel::on_stickmodeCB_currentIndexChanged(int index)
}
}
void GeneralSetupPanel::unlockSwitchEdited()
{
if (!lock) {
int i = 0;
i |= (((uint16_t)ui->chkSA->value()));
i |= (((uint16_t)ui->chkSB->value()) << 2);
i |= (((uint16_t)ui->chkSC->value()) << 4);
i |= (((uint16_t)ui->chkSD->value()) << 6);
i |= (((uint16_t)ui->chkSE->value()) << 8);
i |= (((uint16_t)ui->chkSF->value()) << 10);
i |= (((uint16_t)ui->chkSG->value()) << 12);
i |= (((uint16_t)ui->chkSH->value()) << 14);
generalSettings.switchUnlockStates=i;
emit modified();
}
}
void GeneralSetupPanel::on_blAlarm_ChkB_stateChanged()
{
if (!lock) {
@@ -987,17 +900,6 @@ void GeneralSetupPanel::on_registrationId_editingFinished()
}
}
void GeneralSetupPanel::stickReverseEdited()
{
if (!lock) {
generalSettings.stickReverse = ((int)ui->stickReverse1->isChecked()) |
((int)ui->stickReverse2->isChecked() << 1) |
((int)ui->stickReverse3->isChecked() << 2) |
((int)ui->stickReverse4->isChecked() << 3);
emit modified();
}
}
void GeneralSetupPanel::on_modelQuickSelect_CB_stateChanged(int)
{
if (!lock) {