feat: Option for inverting rotary encoder direction (#1690)

* feat: Add option for rotary encoder direction
Based heavily on opentx/opentx#8852 by @3djc

* companion ui elements

* Cleanup

* Hook up UI, reading setting from yaml

* Teach simulator about rotEncDirection

* Simu and radio default scroll direction correction
Otherwise the "default" would be the opposite to how it has always been

* Remove what will be a confict with fix in #1586

* Wasn't using rotEncDirection consistently

* Zorro RE dir is opp to TX16, TX12, TPro, X9D+2019
This commit is contained in:
Peter Feerick
2022-03-22 16:14:57 +10:00
committed by GitHub
parent b36e456ca7
commit b54ad7169a
47 changed files with 416 additions and 326 deletions
@@ -125,6 +125,14 @@ ui(new Ui::GeneralSetup)
ui->faimode_CB->setChecked(generalSettings.fai);
}
if (!firmware->getCapability(RotaryEncoderNavigation)) {
ui->invertRotary_CB->hide();
ui->invertRotary_label->hide();
}
else {
ui->invertRotary_CB->setChecked(generalSettings.rotEncDirection);
}
if (!firmware->getCapability(HasPxxCountry)) {
ui->countrycode_label->hide();
ui->countrycode_CB->hide();
@@ -475,6 +483,12 @@ void GeneralSetupPanel::on_faimode_CB_stateChanged(int)
emit modified();
}
void GeneralSetupPanel::on_invertRotary_CB_stateChanged(int)
{
generalSettings.rotEncDirection = ui->invertRotary_CB->isChecked();
emit modified();
}
void GeneralSetupPanel::on_speakerPitchSB_editingFinished()
{
generalSettings.speakerPitch = ui->speakerPitchSB->value();