MCPcopy Create free account
hub / github.com/bmorcelli/Launcher / checkReboot

Function checkReboot

boards/m5stack-cplus1_1/interface.cpp:67–95  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

65void powerOff() { axp192.PowerOff(); }
66
67void checkReboot() {
68 static unsigned long time_count = 0;
69 static bool armed = false;
70 int countDown;
71 /* Long press power off */
72 if (axp192.GetBtnPress()) {
73 if (armed == false) {
74 time_count = launcherMillis();
75 armed = true;
76 return;
77 }
78 if (launcherMillis() - time_count < 500) return;
79
80 while (axp192.GetBtnPress()) {
81 // Display poweroff bar only if holding button
82 if (launcherMillis() - time_count > 500) {
83 tft->setCursor(60, 12);
84 tft->setTextSize(1);
85 tft->setTextColor(FGCOLOR, BGCOLOR);
86 countDown = (launcherMillis() - time_count) / 1000 + 1;
87 tft->printf(" PWR OFF IN %d/3\n", countDown);
88 launcherDelayMs(10);
89 }
90 }
91 // Clear text after releasing the button
92 tft->fillRect(60, 12, tftWidth - 60, 8, BGCOLOR);
93 }
94 armed = false;
95}

Callers

nothing calls this directly

Calls 7

launcherMillisFunction · 0.85
launcherDelayMsFunction · 0.85
GetBtnPressMethod · 0.80
setCursorMethod · 0.45
setTextSizeMethod · 0.45
setTextColorMethod · 0.45
fillRectMethod · 0.45

Tested by

no test coverage detected