MCPcopy Create free account
hub / github.com/BruceDevices/firmware / checkReboot

Function checkReboot

boards/reaper/interface.cpp:166–193  ·  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

164** Btn logic to tornoff the device (name is odd btw)
165**********************************************************************/
166void checkReboot() {
167 int countDown;
168 /* Long press power off */
169 if (digitalRead(ESC_BTN) == BTN_ACT) {
170 uint32_t time_count = millis();
171 while (digitalRead(ESC_BTN) == BTN_ACT) {
172 // Display poweroff bar only if holding button
173 if (millis() - time_count > 500) {
174 tft.setTextSize(1);
175 tft.setTextColor(bruceConfig.priColor, bruceConfig.bgColor);
176 countDown = (millis() - time_count) / 1000 + 1;
177 if (countDown < 3)
178 tft.drawCentreString("PWR OFF IN " + String(countDown) + "/2", tftWidth / 2, 12, 1);
179 else {
180 tft.fillScreen(bruceConfig.bgColor);
181 while (digitalRead(ESC_BTN) == BTN_ACT);
182 delay(200);
183 powerOff();
184 }
185 delay(10);
186 }
187 }
188
189 // Clear text after releasing the button
190 delay(30);
191 tft.fillRect(60, 12, tftWidth - 60, tft.fontHeight(1), bruceConfig.bgColor);
192 }
193}

Callers

nothing calls this directly

Calls 8

millisFunction · 0.85
powerOffFunction · 0.70
setTextSizeMethod · 0.45
setTextColorMethod · 0.45
drawCentreStringMethod · 0.45
fillScreenMethod · 0.45
fillRectMethod · 0.45
fontHeightMethod · 0.45

Tested by

no test coverage detected