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