adds funny restart animation
This commit is contained in:
parent
6cdcca198e
commit
47df29c8d8
3 changed files with 22 additions and 1 deletions
|
@ -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<float>(timer.getCurrentTime()) / static_cast<float>(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)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -14,4 +14,6 @@ public:
|
|||
void start();
|
||||
bool update(unsigned long delta);
|
||||
bool isRunning() const;
|
||||
unsigned long getDuration() const;
|
||||
unsigned long getCurrentTime() const;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue