add low battery shutdown alert for thinknode m1
This commit is contained in:
@@ -551,7 +551,22 @@ void UITask::loop() {
|
|||||||
if (millis() > next_batt_chck) {
|
if (millis() > next_batt_chck) {
|
||||||
uint16_t milliVolts = getBattMilliVolts();
|
uint16_t milliVolts = getBattMilliVolts();
|
||||||
if (milliVolts > 0 && milliVolts < AUTO_SHUTDOWN_MILLIVOLTS) {
|
if (milliVolts > 0 && milliVolts < AUTO_SHUTDOWN_MILLIVOLTS) {
|
||||||
|
|
||||||
|
// show low battery shutdown alert
|
||||||
|
// we should only do this for eink displays, which will persist after power loss
|
||||||
|
#ifdef THINKNODE_M1
|
||||||
|
if (_display != NULL) {
|
||||||
|
_display->startFrame();
|
||||||
|
_display->setTextSize(2);
|
||||||
|
_display->setColor(DisplayDriver::RED);
|
||||||
|
_display->drawTextCentered(_display->width() / 2, 20, "Low Battery.");
|
||||||
|
_display->drawTextCentered(_display->width() / 2, 40, "Shutting Down!");
|
||||||
|
_display->endFrame();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
shutdown();
|
shutdown();
|
||||||
|
|
||||||
}
|
}
|
||||||
next_batt_chck = millis() + 8000;
|
next_batt_chck = millis() + 8000;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user