Merge pull request #24 from jeremybox/screensaver

makes SCREENSAVER_INTERVAL a #define to save some ram
This commit is contained in:
jacobeva 2024-08-30 17:01:18 +01:00 committed by GitHub
commit 5cb7de66d8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -131,8 +131,8 @@ uint32_t last_disp_update = 0;
int disp_update_interval = 1000/disp_target_fps;
#define SCREENSAVER_TIME 500 // ms
#define SCREENSAVER_INTERVAL 600000 // ms
uint32_t last_screensaver = 0;
uint32_t screensaver_interval = 600000;
bool screensaver_enabled = false;
uint32_t last_page_flip = 0;
@ -1118,12 +1118,12 @@ void update_display(bool blank = false) {
update_disp_area();
display.display();
// 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);
last_screensaver = millis();
screensaver_enabled = false;
}
else if (millis()-last_screensaver >= screensaver_interval) {
else if (millis()-last_screensaver >= SCREENSAVER_INTERVAL) {
display.invertDisplay(1);
screensaver_enabled = true;
}