diff --git a/src/states.cpp b/src/states.cpp index 6e30087..7ba3e29 100644 --- a/src/states.cpp +++ b/src/states.cpp @@ -460,7 +460,16 @@ State* Restarting::update(const Context context) String Restarting::updateDisplay(const Context& context) { - return "RESTARTING......"; // todo + String animLine = ""; + const String full = ".-`-._.-`-._. :)"; + const float percent = static_cast(timer.getCurrentTime()) / static_cast(timer.getDuration()); + Serial.println(String("updating display ") + percent); + for (int i = 0; i < full.length() * percent; i++) + { + Serial.println(String("i: ") + i + "len " + (full.length() * percent)); + animLine = animLine + full[i]; + } + return "RESTARTING " + animLine; } void Restarting::activated(const Context context) diff --git a/src/timer.cpp b/src/timer.cpp index c3b12eb..2003585 100644 --- a/src/timer.cpp +++ b/src/timer.cpp @@ -44,3 +44,13 @@ bool Timer::isRunning() const { return this->running; } + +unsigned long Timer::getDuration() const +{ + return this->duration; +} + +unsigned long Timer::getCurrentTime() const +{ + return this->currentTime; +} diff --git a/src/timer.h b/src/timer.h index 9667847..33b3709 100644 --- a/src/timer.h +++ b/src/timer.h @@ -14,4 +14,6 @@ public: void start(); bool update(unsigned long delta); bool isRunning() const; + unsigned long getDuration() const; + unsigned long getCurrentTime() const; };