mirror of
https://github.com/correl/m5paper.git
synced 2024-11-24 03:00:10 +00:00
Add sleep calls to system and life tracker
This commit is contained in:
parent
32def14d83
commit
2f081a299e
1 changed files with 7 additions and 0 deletions
|
@ -206,6 +206,8 @@ public:
|
|||
return button.app;
|
||||
}
|
||||
}
|
||||
ESP_LOGD("System", "Going to sleep");
|
||||
M5.Power.lightSleep(0, true);
|
||||
return App::System;
|
||||
}
|
||||
void shutdown() {
|
||||
|
@ -452,9 +454,14 @@ public:
|
|||
}
|
||||
const time_t current_time = time(nullptr);
|
||||
if (current_time >= next_clock_update) {
|
||||
ESP_LOGD("LifeTracker", "Updating clock and battery display");
|
||||
next_clock_update = next_minute(current_time);
|
||||
drawClock(current_time);
|
||||
drawBattery();
|
||||
} else {
|
||||
int seconds = next_clock_update - current_time;
|
||||
ESP_LOGD("LifeTracker", "Sleep for %d seconds", seconds);
|
||||
M5.Power.lightSleep(seconds * 1000000, true); // Delay in microseconds
|
||||
}
|
||||
return App::LifeTracker;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue