@@ -64,7 +64,8 @@ const int outputCount = sizeof(outputs) / sizeof(outputs[0]);
6464
6565// Auto sleep timer
6666unsigned long sleepPreviousMillis = 0 ;
67- const long SLEEP_INTERVAL = 10 * 60 * 1000 ;
67+ const long SLEEP_INTERVAL = 30 * 60 * 1000 ;
68+ const long SCREEN_SLEEP_INTERVAL = 3 * 60 * 1000 ;
6869
6970// Battery timer
7071unsigned long batteryPreviousMillis = 0 ;
@@ -93,6 +94,7 @@ bool isCaffeinated = false;
9394bool isOutputLocked = false ;
9495bool isScreenInverted = false ;
9596bool isScreenDisabled = false ;
97+ bool isScreenSleeping = false ;
9698
9799// OLED Screen Content
98100String contentTop = " " ;
@@ -1057,7 +1059,7 @@ void renderScreen() {
10571059 u8g2.drawGlyph (0 , 16 , 0x00 );
10581060 }
10591061
1060- while (clearDisplay || isScreenDisabled) {
1062+ while (clearDisplay || isScreenDisabled || isScreenSleeping ) {
10611063 u8g2.clearBuffer ();
10621064 u8g2.sendBuffer ();
10631065 delay (100 );
@@ -1132,6 +1134,9 @@ void checkIdle() {
11321134 if (!isCaffeinated &&
11331135 currentMillis - sleepPreviousMillis > SLEEP_INTERVAL) {
11341136 goSleeping ();
1137+ } else if (!isCaffeinated &&
1138+ currentMillis - sleepPreviousMillis > SCREEN_SLEEP_INTERVAL) {
1139+ isScreenSleeping = true ;
11351140 }
11361141}
11371142
@@ -1161,7 +1166,7 @@ void checkBattery() {
11611166void showLowBatteryWarning () {
11621167 if (!isLowBattery) {
11631168 if (bleKeyboard.isConnected ()) {
1164- if (isScreenDisabled) {
1169+ if (isScreenDisabled || isScreenSleeping ) {
11651170 tp.DotStar_SetPower (true );
11661171 tp.DotStar_SetBrightness (1 );
11671172 tp.DotStar_SetPixelColor (0 , 0 , 255 );
@@ -1192,7 +1197,10 @@ void showLowBatteryWarning() {
11921197 * Update sleepPreviousMillis' value to reset idle timer
11931198 *
11941199 */
1195- void resetIdle () { sleepPreviousMillis = currentMillis; }
1200+ void resetIdle () {
1201+ sleepPreviousMillis = currentMillis;
1202+ isScreenSleeping = false ;
1203+ }
11961204
11971205/* *
11981206 * Activate WiFi and start the server
0 commit comments