feat: add 0.5 second option to power on/off delays (#5134)
This commit is contained in:
@@ -478,6 +478,18 @@ void GeneralSetupPanel::populateRotEncCB(int reCount)
|
||||
b->setCurrentIndex(generalSettings.reNavigation);
|
||||
}
|
||||
|
||||
int pwrDelayFromYaml(int delay)
|
||||
{
|
||||
static int8_t vals[] = { 1, 4, 3, 2, 0 };
|
||||
return vals[delay + 2];
|
||||
}
|
||||
|
||||
int pwrDelayToYaml(int delay)
|
||||
{
|
||||
static int8_t vals[] = { 2, -2, 1, 0, -1 };
|
||||
return vals[delay];
|
||||
}
|
||||
|
||||
void GeneralSetupPanel::setValues()
|
||||
{
|
||||
ui->beeperCB->setCurrentIndex(generalSettings.beeperMode+2);
|
||||
@@ -509,8 +521,8 @@ void GeneralSetupPanel::setValues()
|
||||
ui->vBatMaxDSB->setValue((double)(generalSettings.vBatMax + 120) / 10);
|
||||
}
|
||||
|
||||
ui->pwrOnDelay->setValue(2 - generalSettings.pwrOnSpeed);
|
||||
ui->pwrOffDelay->setValue(2 - generalSettings.pwrOffSpeed);
|
||||
ui->pwrOnDelay->setCurrentIndex(pwrDelayFromYaml(generalSettings.pwrOnSpeed));
|
||||
ui->pwrOffDelay->setCurrentIndex(pwrDelayFromYaml(generalSettings.pwrOffSpeed));
|
||||
|
||||
ui->registrationId->setText(generalSettings.registrationId);
|
||||
|
||||
@@ -632,15 +644,15 @@ void GeneralSetupPanel::on_splashScreenDuration_currentIndexChanged(int index)
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void GeneralSetupPanel::on_pwrOnDelay_valueChanged(int)
|
||||
void GeneralSetupPanel::on_pwrOnDelay_currentIndexChanged(int index)
|
||||
{
|
||||
generalSettings.pwrOnSpeed = 2 - ui->pwrOnDelay->value();
|
||||
generalSettings.pwrOnSpeed = pwrDelayToYaml(index);
|
||||
emit modified();
|
||||
}
|
||||
|
||||
void GeneralSetupPanel::on_pwrOffDelay_valueChanged(int)
|
||||
void GeneralSetupPanel::on_pwrOffDelay_currentIndexChanged(int index)
|
||||
{
|
||||
generalSettings.pwrOffSpeed = 2 - ui->pwrOffDelay->value();
|
||||
generalSettings.pwrOffSpeed = pwrDelayToYaml(index);
|
||||
emit modified();
|
||||
}
|
||||
|
||||
|
||||
@@ -91,8 +91,8 @@ class GeneralSetupPanel : public GeneralPanel
|
||||
void on_contrastSB_editingFinished();
|
||||
void on_registrationId_editingFinished();
|
||||
|
||||
void on_pwrOnDelay_valueChanged(int);
|
||||
void on_pwrOffDelay_valueChanged(int);
|
||||
void on_pwrOnDelay_currentIndexChanged(int);
|
||||
void on_pwrOffDelay_currentIndexChanged(int);
|
||||
void on_pwrOnOffHaptic_CB_stateChanged(int);
|
||||
|
||||
void on_modelQuickSelect_CB_stateChanged(int);
|
||||
|
||||
@@ -1368,13 +1368,32 @@ p, li { white-space: pre-wrap; }
|
||||
</widget>
|
||||
</item>
|
||||
<item row="12" column="1">
|
||||
<widget class="QSpinBox" name="pwrOnDelay">
|
||||
<property name="suffix">
|
||||
<string> sec</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<widget class="QComboBox" name="pwrOnDelay">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>0s</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>0.5s</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>1s</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>2s</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>3s</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
@@ -1548,13 +1567,32 @@ Acceptable values are 3v..12v</string>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="13" column="1">
|
||||
<widget class="QSpinBox" name="pwrOffDelay">
|
||||
<property name="suffix">
|
||||
<string> sec</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<widget class="QComboBox" name="pwrOffDelay">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>0s</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>0.5s</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>1s</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>2s</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>3s</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" colspan="2">
|
||||
|
||||
Reference in New Issue
Block a user