makes SCREENSAVER_INTERVAL a #define to save some ram
This commit is contained in:
parent
17ad6d213d
commit
8686ee7844
@ -131,8 +131,8 @@ uint32_t last_disp_update = 0;
|
|||||||
int disp_update_interval = 1000/disp_target_fps;
|
int disp_update_interval = 1000/disp_target_fps;
|
||||||
|
|
||||||
#define SCREENSAVER_TIME 500 // ms
|
#define SCREENSAVER_TIME 500 // ms
|
||||||
|
#define SCREENSAVER_INTERVAL 600000 // ms
|
||||||
uint32_t last_screensaver = 0;
|
uint32_t last_screensaver = 0;
|
||||||
uint32_t screensaver_interval = 600000;
|
|
||||||
bool screensaver_enabled = false;
|
bool screensaver_enabled = false;
|
||||||
|
|
||||||
uint32_t last_page_flip = 0;
|
uint32_t last_page_flip = 0;
|
||||||
@ -1118,12 +1118,12 @@ void update_display(bool blank = false) {
|
|||||||
update_disp_area();
|
update_disp_area();
|
||||||
display.display();
|
display.display();
|
||||||
// Invert display to protect against OLED screen burn in
|
// Invert display to protect against OLED screen burn in
|
||||||
if (millis()-last_screensaver >= screensaver_interval+SCREENSAVER_TIME && screensaver_enabled) {
|
if (millis()-last_screensaver >= SCREENSAVER_INTERVAL+SCREENSAVER_TIME && screensaver_enabled) {
|
||||||
display.invertDisplay(0);
|
display.invertDisplay(0);
|
||||||
last_screensaver = millis();
|
last_screensaver = millis();
|
||||||
screensaver_enabled = false;
|
screensaver_enabled = false;
|
||||||
}
|
}
|
||||||
else if (millis()-last_screensaver >= screensaver_interval) {
|
else if (millis()-last_screensaver >= SCREENSAVER_INTERVAL) {
|
||||||
display.invertDisplay(1);
|
display.invertDisplay(1);
|
||||||
screensaver_enabled = true;
|
screensaver_enabled = true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user