2022-02-28 21:19:38 +00:00
|
|
|
#include "configuration.h"
|
|
|
|
#include "graphics/Screen.h"
|
|
|
|
#include "power.h"
|
|
|
|
#include "buzz.h"
|
|
|
|
#include "main.h"
|
|
|
|
|
|
|
|
void powerCommandsCheck()
|
|
|
|
{
|
2022-04-26 11:48:26 +00:00
|
|
|
DEBUG_MSG("Rebooting\n");
|
|
|
|
|
2022-02-28 21:19:38 +00:00
|
|
|
if (rebootAtMsec && millis() > rebootAtMsec) {
|
|
|
|
#ifndef NO_ESP32
|
|
|
|
ESP.restart();
|
2022-04-26 11:48:26 +00:00
|
|
|
#elif NRF52_SERIES
|
|
|
|
NVIC_SystemReset();
|
2022-02-28 21:19:38 +00:00
|
|
|
#else
|
|
|
|
DEBUG_MSG("FIXME implement reboot for this platform");
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
#if NRF52_SERIES
|
|
|
|
if (shutdownAtMsec) {
|
|
|
|
screen->startShutdownScreen();
|
|
|
|
playBeep();
|
|
|
|
ledOff(PIN_LED1);
|
|
|
|
ledOff(PIN_LED2);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (shutdownAtMsec && millis() > shutdownAtMsec) {
|
|
|
|
DEBUG_MSG("Shutting down from admin command\n");
|
|
|
|
#ifdef TBEAM_V10
|
|
|
|
if (axp192_found == true) {
|
|
|
|
setLed(false);
|
|
|
|
power->shutdown();
|
|
|
|
}
|
|
|
|
#elif NRF52_SERIES
|
|
|
|
playShutdownMelody();
|
|
|
|
power->shutdown();
|
|
|
|
#else
|
|
|
|
DEBUG_MSG("FIXME implement shutdown for this platform");
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|