Moved button thread to its own file (#1260)

* Moved button thread to its own file

* Move some debug code blocks into their own files

* Shutdown refactoring

* Removed GENIEBLOCKS
This commit is contained in:
Ben Meadors
2022-02-28 21:19:38 +00:00
committed by GitHub
parent 7b8746d596
commit ca4c1c9d7c
6 changed files with 329 additions and 322 deletions

41
src/shutdown.h Normal file
View File

@@ -0,0 +1,41 @@
#include "configuration.h"
#include "graphics/Screen.h"
#include "power.h"
#include "buzz.h"
#include "main.h"
void powerCommandsCheck()
{
if (rebootAtMsec && millis() > rebootAtMsec) {
#ifndef NO_ESP32
DEBUG_MSG("Rebooting for update\n");
ESP.restart();
#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
}
}