feat: Support all current timezones for GPS (#3406)

* Support all current timezones.

* Fix function name and calculation for timezone offset.

* Allow setting any time offset value from -12 to +14 in 15 minutes increments.

* Alternate timezone editor in Companion (from elecpower).

* Fix compiler warning.

* chore: Add the T20
This commit is contained in:
philmoz
2023-07-16 14:02:27 +10:00
committed by GitHub
parent 286ae00678
commit bd92f70056
27 changed files with 223 additions and 42 deletions
+12 -7
View File
@@ -150,7 +150,8 @@ ui(new Ui::GeneralSetup)
}
ui->gpsFormatCB->setCurrentIndex(generalSettings.gpsFormat);
ui->timezoneSB->setValue(generalSettings.timezone);
ui->timezoneLE->setTime((generalSettings.timezone * 3600) + (generalSettings.timezoneMinutes/*quarter hours*/ * 15 * 60));
if (IS_HORUS_OR_TARANIS(firmware->getBoard())) {
ui->adjustRTC->setChecked(generalSettings.adjustRTC);
@@ -328,6 +329,16 @@ GeneralSetupPanel::~GeneralSetupPanel()
delete ui;
}
void GeneralSetupPanel::on_timezoneLE_textEdited(const QString &text)
{
if (!lock) {
int secs = ui->timezoneLE->timeInSeconds();
generalSettings.timezone = secs / 3600;
generalSettings.timezoneMinutes = (secs % 3600) / (15 * 60); // timezoneMinutes in quarter hours
emit modified();
}
}
void GeneralSetupPanel::populateBacklightCB()
{
QComboBox * b = ui->backlightswCB;
@@ -693,12 +704,6 @@ void GeneralSetupPanel::on_switchesDelay_valueChanged(int)
emit modified();
}
void GeneralSetupPanel::on_timezoneSB_editingFinished()
{
generalSettings.timezone = ui->timezoneSB->value();
emit modified();
}
void GeneralSetupPanel::on_adjustRTC_stateChanged(int)
{
generalSettings.adjustRTC = ui->adjustRTC->isChecked();