mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-12 08:02:04 +00:00
We may have RAK modules in Slot D pulling IO5 to Low permanently (like the RAK12002 RTC Module). React to assumed Long presses of the device button only 30 seconds after bootup to prevent a reboot loop. This is Particularly important for button-less RAK19003 Baseboard.
This commit is contained in:
parent
a0f34a8d0a
commit
3a9086dfc5
@ -135,7 +135,7 @@ class ButtonThread : public concurrency::OSThread
|
|||||||
screen->adjustBrightness();
|
screen->adjustBrightness();
|
||||||
#endif
|
#endif
|
||||||
// If user button is held down for 5 seconds, shutdown the device.
|
// If user button is held down for 5 seconds, shutdown the device.
|
||||||
if (millis() - longPressTime > 5 * 1000) {
|
if ((millis() - longPressTime > 5 * 1000) && (longPressTime > 0)) {
|
||||||
#ifdef TBEAM_V10
|
#ifdef TBEAM_V10
|
||||||
if (axp192_found == true) {
|
if (axp192_found == true) {
|
||||||
setLed(false);
|
setLed(false);
|
||||||
@ -144,7 +144,7 @@ class ButtonThread : public concurrency::OSThread
|
|||||||
#elif NRF52_SERIES
|
#elif NRF52_SERIES
|
||||||
// Do actual shutdown when button released, otherwise the button release
|
// Do actual shutdown when button released, otherwise the button release
|
||||||
// may wake the board immediatedly.
|
// may wake the board immediatedly.
|
||||||
if (!shutdown_on_long_stop) {
|
if ((!shutdown_on_long_stop) && (millis() > 30 * 1000)) {
|
||||||
screen->startShutdownScreen();
|
screen->startShutdownScreen();
|
||||||
DEBUG_MSG("Shutdown from long press");
|
DEBUG_MSG("Shutdown from long press");
|
||||||
playBeep();
|
playBeep();
|
||||||
@ -180,18 +180,22 @@ class ButtonThread : public concurrency::OSThread
|
|||||||
|
|
||||||
static void userButtonPressedLongStart()
|
static void userButtonPressedLongStart()
|
||||||
{
|
{
|
||||||
DEBUG_MSG("Long press start!\n");
|
if (millis() > 30 * 1000) {
|
||||||
longPressTime = millis();
|
DEBUG_MSG("Long press start!\n");
|
||||||
|
longPressTime = millis();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void userButtonPressedLongStop()
|
static void userButtonPressedLongStop()
|
||||||
{
|
{
|
||||||
DEBUG_MSG("Long press stop!\n");
|
if (millis() > 30 * 1000){
|
||||||
longPressTime = 0;
|
DEBUG_MSG("Long press stop!\n");
|
||||||
if (shutdown_on_long_stop) {
|
longPressTime = 0;
|
||||||
playShutdownMelody();
|
if (shutdown_on_long_stop) {
|
||||||
delay(3000);
|
playShutdownMelody();
|
||||||
power->shutdown();
|
delay(3000);
|
||||||
|
power->shutdown();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user