mirror of
https://github.com/meshtastic/firmware.git
synced 2025-07-30 02:15:41 +00:00
Update ButtonThread.cpp
Added 4 button click to toggle "Lost and found" role or togle back to Client role.
This commit is contained in:
parent
c28458d876
commit
91b6cbfc4b
@ -192,6 +192,24 @@ int32_t ButtonThread::runOnce()
|
||||
screen->forceDisplay(true); // Force a new UI frame, then force an EInk update
|
||||
}
|
||||
break;
|
||||
|
||||
// 4 clicks: toggle Lost and found
|
||||
case 4:
|
||||
if (config.device.role == meshtastic_Config_DeviceConfig_Role_CLIENT) {
|
||||
LOG_WARN("Changing mode to LOST_AND_FOUND");
|
||||
config.device.role = meshtastic_Config_DeviceConfig_Role_LOST_AND_FOUND;
|
||||
if (screen)
|
||||
screen->startAlert("Switching to LOST!");
|
||||
nodeDB->saveToDisk(SEGMENT_CONFIG);
|
||||
}else{
|
||||
LOG_WARN("Changing mode to Client");
|
||||
config.device.role = meshtastic_Config_DeviceConfig_Role_CLIENT;
|
||||
if (screen)
|
||||
screen->startAlert("Switching to Client!");
|
||||
nodeDB->saveToDisk(SEGMENT_CONFIG);
|
||||
}
|
||||
rebootAtMsec = millis() + 5000;
|
||||
break;
|
||||
#endif
|
||||
#if defined(USE_EINK) && defined(PIN_EINK_EN) // i.e. T-Echo
|
||||
// 4 clicks: toggle backlight
|
||||
@ -395,4 +413,4 @@ void ButtonThread::userButtonPressedLongStop()
|
||||
if (millis() > c_holdOffTime) {
|
||||
btnEvent = BUTTON_EVENT_LONG_RELEASED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user