mirror of
https://github.com/Ralim/IronOS.git
synced 2025-02-26 07:53:55 +00:00
Create printSleepCountdown.cpp
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
#include "OperatingModeUtilities.h"
|
||||
#ifndef NO_SLEEP_MODE
|
||||
void printCountdownUntilSleep(int sleepThres) {
|
||||
/*
|
||||
* Print seconds or minutes (if > 99 seconds) until sleep
|
||||
* mode is triggered.
|
||||
*/
|
||||
TickType_t lastEventTime = lastButtonTime < lastMovementTime ? lastMovementTime : lastButtonTime;
|
||||
TickType_t downCount = sleepThres - xTaskGetTickCount() + lastEventTime;
|
||||
if (downCount > (99 * TICKS_SECOND)) {
|
||||
OLED::printNumber(downCount / 60000 + 1, 2, FontStyle::SMALL);
|
||||
OLED::print(SymbolMinutes, FontStyle::SMALL);
|
||||
} else {
|
||||
OLED::printNumber(downCount / 1000 + 1, 2, FontStyle::SMALL);
|
||||
OLED::print(SymbolSeconds, FontStyle::SMALL);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user