** Function: checkReboot ** location: mykeyboard.cpp ** Btn logic to tornoff the device (name is odd btw) **********************************************************************/
| 175 | ** Btn logic to tornoff the device (name is odd btw) |
| 176 | **********************************************************************/ |
| 177 | void 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 | } |
nothing calls this directly
no test coverage detected