Turn off display after 5 min.
Better shut off display after few minutes to preserve display life time.
This commit is contained in:
parent
df1b25f381
commit
750261d205
@ -39,6 +39,8 @@ uint8_t knownMode = 0;
|
|||||||
uint8_t knownPalette = 0;
|
uint8_t knownPalette = 0;
|
||||||
|
|
||||||
long lastUpdate = 0;
|
long lastUpdate = 0;
|
||||||
|
long startupTimestamp = millis();
|
||||||
|
bool displayTurnedOff = false;
|
||||||
// How often we are redrawing screen
|
// How often we are redrawing screen
|
||||||
#define USER_LOOP_REFRESH_RATE_MS 5000
|
#define USER_LOOP_REFRESH_RATE_MS 5000
|
||||||
|
|
||||||
@ -49,6 +51,11 @@ void userLoop() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
lastUpdate = millis();
|
lastUpdate = millis();
|
||||||
|
// Turn off display after 5 minutes from powering.
|
||||||
|
if( !displayTurnedOff && millis() - startupTimestamp > 5*60*1000) {
|
||||||
|
u8x8.setPowerSave(1);
|
||||||
|
displayTurnedOff = true;
|
||||||
|
}
|
||||||
|
|
||||||
// Check if values which are shown on display changed from the last tiem.
|
// Check if values which are shown on display changed from the last tiem.
|
||||||
if ((apActive == true ? String(apSSID) : WiFi.SSID()) != knownSsid) {
|
if ((apActive == true ? String(apSSID) : WiFi.SSID()) != knownSsid) {
|
||||||
|
Loading…
Reference in New Issue
Block a user