mirror of
https://github.com/liquidraver/ZephCore.git
synced 2026-10-15 20:49:53 +00:00
UI fixes
This commit is contained in:
@@ -878,6 +878,7 @@ void JoystickUITask::loop()
|
||||
bool consumed = false;
|
||||
if (key == KEY_BUZZ_TOGGLE) {
|
||||
toggleBuzzer();
|
||||
showAlert(isBuzzerQuiet() ? "Buzzer off" : "Buzzer on", 1000);
|
||||
consumed = true;
|
||||
} else if (key == KEY_GPS_TOGGLE) {
|
||||
toggleGPS();
|
||||
@@ -995,8 +996,15 @@ bool JoystickUITask::getGPSState() const
|
||||
|
||||
void JoystickUITask::toggleGPS()
|
||||
{
|
||||
if (!gps_is_available()) return;
|
||||
mesh_gps_set_enabled(!gps_is_enabled());
|
||||
if (!gps_is_available()) {
|
||||
showAlert("No GPS", 1000);
|
||||
return;
|
||||
}
|
||||
/* The mesh loop applies the change later, so getGPSState() is still
|
||||
* the old state here: the alert names the requested one. */
|
||||
bool enable = !gps_is_enabled();
|
||||
mesh_gps_set_enabled(enable);
|
||||
showAlert(enable ? "GPS enabled" : "GPS disabled", 1000);
|
||||
}
|
||||
|
||||
uint32_t JoystickUITask::getGpsDutySec() const
|
||||
|
||||
@@ -114,6 +114,7 @@ public:
|
||||
void toggleBuzzer();
|
||||
bool isGPSAvailable() const;
|
||||
bool getGPSState() const;
|
||||
/* Requests the opposite state and shows the alert for it. */
|
||||
void toggleGPS();
|
||||
/* GPS duty-cycle interval, seconds (0 = always on). Steps through a fixed
|
||||
* preset ladder (step = +1/-1) rather than raw seconds, since the valid
|
||||
|
||||
@@ -874,7 +874,6 @@ bool GPSSettingsScreen::handleInput(char key)
|
||||
if (key == KEY_ENTER) {
|
||||
if (_selected == 0) {
|
||||
_task->toggleGPS();
|
||||
_task->showAlert(_task->getGPSState() ? "GPS enabled" : "GPS disabled", 1000);
|
||||
} else {
|
||||
_task->adjustGpsDuty(1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user