mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-11 23:52:14 +00:00
GPS toggle now tells if it's on or off
This commit is contained in:
parent
2f4f2b1202
commit
7293e542ec
@ -237,14 +237,21 @@ int32_t ButtonThread::runOnce()
|
|||||||
LOG_BUTTON("Mulitipress! %hux", multipressClickCount);
|
LOG_BUTTON("Mulitipress! %hux", multipressClickCount);
|
||||||
switch (multipressClickCount) {
|
switch (multipressClickCount) {
|
||||||
#if HAS_GPS && !defined(ELECROW_ThinkNode_M1)
|
#if HAS_GPS && !defined(ELECROW_ThinkNode_M1)
|
||||||
// 3 clicks: toggle GPS
|
// 3 clicks: toggle GPS
|
||||||
case 3:
|
case 3:
|
||||||
if (!config.device.disable_triple_click && (gps != nullptr)) {
|
if (!config.device.disable_triple_click && (gps != nullptr)) {
|
||||||
gps->toggleGpsMode();
|
gps->toggleGpsMode();
|
||||||
if (screen)
|
|
||||||
screen->forceDisplay(true); // Force a new UI frame, then force an EInk update
|
const char* statusMsg = (config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_ENABLED)
|
||||||
|
? "GPS Enabled"
|
||||||
|
: "GPS Disabled";
|
||||||
|
|
||||||
|
if (screen) {
|
||||||
|
screen->forceDisplay(true); // Force a new UI frame, then force an EInk update
|
||||||
|
screen->showOverlayBanner(statusMsg, 3000);
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
|
break;
|
||||||
#elif defined(ELECROW_ThinkNode_M1) || defined(ELECROW_ThinkNode_M2)
|
#elif defined(ELECROW_ThinkNode_M1) || defined(ELECROW_ThinkNode_M2)
|
||||||
case 3:
|
case 3:
|
||||||
LOG_INFO("3 clicks: toggle buzzer");
|
LOG_INFO("3 clicks: toggle buzzer");
|
||||||
|
@ -510,17 +510,19 @@ int CannedMessageModule::handleInputEvent(const InputEvent *event)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case INPUT_BROKER_MSG_GPS_TOGGLE:
|
case INPUT_BROKER_MSG_GPS_TOGGLE:
|
||||||
#if !MESHTASTIC_EXCLUDE_GPS
|
#if !MESHTASTIC_EXCLUDE_GPS
|
||||||
if (gps != nullptr) {
|
if (gps != nullptr) {
|
||||||
gps->toggleGpsMode();
|
gps->toggleGpsMode();
|
||||||
|
const char* statusMsg = (config.position.gps_mode == meshtastic_Config_PositionConfig_GpsMode_ENABLED)
|
||||||
|
? "GPS Enabled"
|
||||||
|
: "GPS Disabled";
|
||||||
|
if (screen) {
|
||||||
|
screen->forceDisplay();
|
||||||
|
screen->showOverlayBanner(statusMsg, 3000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (screen) {
|
#endif
|
||||||
screen->forceDisplay();
|
|
||||||
screen->showOverlayBanner("GPS Toggled", 3000);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case INPUT_BROKER_MSG_BLUETOOTH_TOGGLE:
|
case INPUT_BROKER_MSG_BLUETOOTH_TOGGLE:
|
||||||
if (config.bluetooth.enabled == true) {
|
if (config.bluetooth.enabled == true) {
|
||||||
config.bluetooth.enabled = false;
|
config.bluetooth.enabled = false;
|
||||||
@ -544,6 +546,21 @@ int CannedMessageModule::handleInputEvent(const InputEvent *event)
|
|||||||
if (screen) screen->showOverlayBanner("Node Info\nUpdate Sent", 3000);
|
if (screen) screen->showOverlayBanner("Node Info\nUpdate Sent", 3000);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case INPUT_BROKER_MSG_SHUTDOWN:
|
||||||
|
if (screen)
|
||||||
|
screen->showOverlayBanner("Shutting down...");
|
||||||
|
shutdownAtMsec = millis() + DEFAULT_SHUTDOWN_SECONDS * 1000;
|
||||||
|
this->runState = CANNED_MESSAGE_RUN_STATE_INACTIVE;
|
||||||
|
validEvent = true;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case INPUT_BROKER_MSG_REBOOT:
|
||||||
|
if (screen)
|
||||||
|
screen->showOverlayBanner("Rebooting...", 0); // stays on screen
|
||||||
|
rebootAtMsec = millis() + DEFAULT_REBOOT_SECONDS * 1000;
|
||||||
|
this->runState = CANNED_MESSAGE_RUN_STATE_INACTIVE;
|
||||||
|
validEvent = true;
|
||||||
|
break;
|
||||||
case INPUT_BROKER_MSG_DISMISS_FRAME: // fn+del: dismiss screen frames like text or waypoint
|
case INPUT_BROKER_MSG_DISMISS_FRAME: // fn+del: dismiss screen frames like text or waypoint
|
||||||
// Avoid opening the canned message screen frame
|
// Avoid opening the canned message screen frame
|
||||||
// We're only handling the keypress here by convention, this has nothing to do with canned messages
|
// We're only handling the keypress here by convention, this has nothing to do with canned messages
|
||||||
@ -899,19 +916,6 @@ int32_t CannedMessageModule::runOnce()
|
|||||||
case INPUT_BROKER_MSG_RIGHT:
|
case INPUT_BROKER_MSG_RIGHT:
|
||||||
// already handled above
|
// already handled above
|
||||||
break;
|
break;
|
||||||
// handle fn+s for shutdown
|
|
||||||
case INPUT_BROKER_MSG_SHUTDOWN:
|
|
||||||
if (screen)
|
|
||||||
shutdownAtMsec = millis() + DEFAULT_SHUTDOWN_SECONDS * 1000;
|
|
||||||
runState = CANNED_MESSAGE_RUN_STATE_INACTIVE;
|
|
||||||
break;
|
|
||||||
// and fn+r for reboot
|
|
||||||
case INPUT_BROKER_MSG_REBOOT:
|
|
||||||
if (screen)
|
|
||||||
screen->showOverlayBanner("Rebooting...", 0); // stays on screen
|
|
||||||
rebootAtMsec = millis() + DEFAULT_REBOOT_SECONDS * 1000;
|
|
||||||
runState = CANNED_MESSAGE_RUN_STATE_INACTIVE;
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
if (this->highlight != 0x00) {
|
if (this->highlight != 0x00) {
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user