#include "StateUserUnknown.h"
#include "Globals.h"
#include "StateDefault.h"


void UserUnknownState::setup()
{
  animationTime = currentTime;
  animationStep = 0;
}

void UserUnknownState::loop()
{
  if (buttonA->pressed() || buttonB->pressed())
  {
    setCurrentState(new DefaultState());
  }

  if (currentTime - animationTime > 500)
  {
    animationStep++;
    animationTime = currentTime;

    if (animationStep == 12)
      animationStep = 0;
  }

  switch (animationStep)
  {
    case 0:
    case 2:
    case 4:
    {
      char text[] = "ERROR";
      display->writeTextLeft(text);
      break;
    }

    case 1:
    case 3:
    case 5:
    {
      display->clear();
      break;
    }

    case 6:
    case 7:
    case 8:
    {
      char text[] = "user";
      display->writeTextLeft(text);
      break;
    }

    case 9:
    case 10:
    case 11:
    {
      char text[] = "unknwn";
      display->writeTextLeft(text);
      break;
    }
  }
}