2023-06-10 19:23:31 +00:00
|
|
|
#include "countdown.hpp"
|
|
|
|
|
|
|
|
uint CountdownScreen::countdownMinutes = 1;
|
|
|
|
uint CountdownScreen::countdownSeconds = 0;
|
2023-10-28 18:31:10 +00:00
|
|
|
std::array<String, NUM_SCREENS> CountdownScreen::epdContent = {"COUNT/DOWN", "", "", "", "", "", ""};
|
2023-06-10 19:23:31 +00:00
|
|
|
|
|
|
|
void CountdownScreen::init()
|
|
|
|
{
|
|
|
|
CountdownScreen::showScreen();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CountdownScreen::showScreen()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2023-10-28 18:31:10 +00:00
|
|
|
std::array<String, NUM_SCREENS> CountdownScreen::getEpdContent()
|
2023-06-10 19:23:31 +00:00
|
|
|
{
|
|
|
|
return CountdownScreen::epdContent;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CountdownScreen::setCountdownSeconds(uint sec) {
|
|
|
|
countdownSeconds = sec;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CountdownScreen::countdownTask(void *pvParameters)
|
|
|
|
{
|
|
|
|
for (int i = CountdownScreen::countdownSeconds; i >= 0; i--)
|
|
|
|
{
|
2023-10-28 18:31:10 +00:00
|
|
|
char countdownString[NUM_SCREENS];
|
2023-06-10 19:23:31 +00:00
|
|
|
sprintf(countdownString, "%02d:%02d", i / 60, i % 60);
|
|
|
|
std::string timeString = countdownString;
|
2023-10-28 18:31:10 +00:00
|
|
|
timeString.insert(timeString.begin(), NUM_SCREENS - timeString.length(), ' ');
|
2023-06-10 19:23:31 +00:00
|
|
|
CountdownScreen::epdContent[0] = "COUNT/DOWN";
|
|
|
|
for (uint i = 1; i < 7; i++)
|
|
|
|
{
|
|
|
|
CountdownScreen::epdContent[i] = timeString[i];
|
|
|
|
}
|
|
|
|
vTaskDelay(pdMS_TO_TICKS(1000));
|
|
|
|
}
|
|
|
|
Serial.println("Countdown finished!");
|
|
|
|
vTaskDelete(NULL);
|
|
|
|
}
|