Skip to content

Commit

Permalink
feat(bw128): add option to invert LCD/OLED display (#4933)
Browse files Browse the repository at this point in the history
  • Loading branch information
philmoz authored Jun 5, 2024
1 parent fb2188c commit 65e0508
Show file tree
Hide file tree
Showing 15 changed files with 269 additions and 185 deletions.
3 changes: 3 additions & 0 deletions companion/src/firmwares/edgetx/yaml_generalsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,8 @@ Node convert<GeneralSettings>::encode(const GeneralSettings& rhs)
node["labelSingleSelect"] = rhs.labelSingleSelect;
node["labelMultiMode"] = rhs.labelMultiMode;
node["favMultiMode"] = rhs.favMultiMode;
} else if (fw->getCapability(LcdWidth) == 128) {
node["invertLCD"] = (int)rhs.invertLCD;
}

Node serialPort;
Expand Down Expand Up @@ -513,6 +515,7 @@ bool convert<GeneralSettings>::decode(const Node& node, GeneralSettings& rhs)
node["backgroundVolume"] >> ioffset_int(rhs.backgroundVolume, 2);
node["modelQuickSelect"] >> rhs.modelQuickSelect;
node["dontPlayHello"] >> rhs.dontPlayHello;
node["invertLCD"] >> rhs.invertLCD;

// depreciated v2.7 replaced by serialPort
if (node["auxSerialMode"]) {
Expand Down
2 changes: 2 additions & 0 deletions companion/src/firmwares/generalsettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,8 @@ class GeneralSettings {
int labelMultiMode;
int favMultiMode;

bool invertLCD;

// v 2.10 ADC refactor
// earlier version data is read into legacy structs to maintain older version compatibility
// post reading the legacy structs are manipulated into the new structs
Expand Down
13 changes: 13 additions & 0 deletions companion/src/generaledit/generalsetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,13 @@ void GeneralSetupPanel::setValues()
ui->label_favMultiMode->hide();
ui->favMultiMode_CB->hide();
}

if (firmware->getCapability(LcdWidth) == 128) {
ui->invertLCD_CB->setChecked(generalSettings.invertLCD);
} else {
ui->invertLCD_label->hide();
ui->invertLCD_CB->hide();
}
}

void GeneralSetupPanel::showLabelSelectOptions()
Expand Down Expand Up @@ -928,3 +935,9 @@ void GeneralSetupPanel::on_startSoundCB_stateChanged(int)
generalSettings.dontPlayHello = !ui->startSoundCB->isChecked();
emit modified();
}

void GeneralSetupPanel::on_invertLCD_CB_stateChanged(int)
{
generalSettings.invertLCD = ui->invertLCD_CB->isChecked();
emit modified();
}
1 change: 1 addition & 0 deletions companion/src/generaledit/generalsetup.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class GeneralSetupPanel : public GeneralPanel
void on_labelSingleSelect_CB_currentIndexChanged(int);
void on_labelMultiMode_CB_currentIndexChanged(int);
void on_favMultiMode_CB_currentIndexChanged(int);
void on_invertLCD_CB_stateChanged(int);

private:
Ui::GeneralSetup *ui;
Expand Down
Loading

0 comments on commit 65e0508

Please sign in to comment.