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

Function checkReboot

boards/reaper/interface.cpp:177–204  ·  view source on GitHub ↗

** Function: checkReboot ** location: mykeyboard.cpp ** Btn logic to tornoff the device (name is odd btw) **********************************************************************/

Source from the content-addressed store, hash-verified

175** Btn logic to tornoff the device (name is odd btw)
176**********************************************************************/
177void checkReboot() {
178 int countDown;
179 /* Long press power off */
180 if (digitalRead(ESC_BTN) == BTN_ACT) {
181 uint32_t time_count = millis();
182 while (digitalRead(ESC_BTN) == BTN_ACT) {
183 // Display poweroff bar only if holding button
184 if (millis() - time_count > 500) {
185 tft->setTextSize(1);
186 tft->setTextColor(FGCOLOR, BGCOLOR);
187 countDown = (millis() - time_count) / 1000 + 1;
188 if (countDown < 3)
189 tft->drawCentreString("PWR OFF IN " + String(countDown) + "/2", tftWidth / 2, 12, 1);
190 else {
191 tft->fillScreen(BGCOLOR);
192 while (digitalRead(ESC_BTN) == BTN_ACT);
193 delay(200);
194 powerOff();
195 }
196 delay(10);
197 }
198 }
199
200 // Clear text after releasing the button
201 delay(30);
202 tft->fillRect(60, 12, tftWidth - 60, LH, BGCOLOR);
203 }
204}

Callers

nothing calls this directly

Calls 6

powerOffFunction · 0.70
setTextSizeMethod · 0.45
setTextColorMethod · 0.45
drawCentreStringMethod · 0.45
fillScreenMethod · 0.45
fillRectMethod · 0.45

Tested by

no test coverage detected