screen auto off in 30s

This commit is contained in:
aeroreyna
2026-01-09 10:20:54 -05:00
parent 564484aa2e
commit 1ce6e1adab
2 changed files with 73 additions and 1 deletions
+12 -1
View File
@@ -21,6 +21,7 @@ void process_command(char *cmd);
void core1_entry();
bool screen_on = false;
uint32_t screen_last_ts = 0;
int epaper_init()
{
@@ -47,7 +48,7 @@ int epaper_init()
}
bool editor_mode = false;
int editor_last_ts = 0;
uint32_t editor_last_ts = 0;
char screen_log[2000];
int screen_log_i = 0;
sFONT *current_font = &Font16;
@@ -211,6 +212,8 @@ void core1_entry() {
if(!screen_on){
epaper_init();
}
absolute_time_t time = get_absolute_time();
screen_last_ts = to_ms_since_boot(time);
if(editor_mode){
bool overflow = false;
Paint_Clear(WHITE);
@@ -243,6 +246,14 @@ void core1_entry() {
}
}
if(screen_on){
absolute_time_t time = get_absolute_time();
uint32_t ms = to_ms_since_boot(time);
if(screen_last_ts + 30000 < ms){
printf("Turning off screen due to inactivity (30s)");
epaper_close();
}
}
}
}