Add delay for advance color within SimonSays function

pull/14/head
Dennis Bücker 2 years ago
parent 9b10b6fcea
commit efa3de5207
  1. 24
      src/SimonSays.cpp
  2. 10
      src/SimonSays.h
  3. 4
      src/main.cpp

@ -89,28 +89,16 @@ void SimonSays::checkBtnPress()
};
uint8_t SimonSays::getBuff()
{
// uint8_t buff[2 + 5 * 5 * 3];
// buff[0] = 0x05;
// buff[1] = 0x05;
// for (int i = 0; i < 25; i++)
// {
// buff[2 + i * 3 + 0] = 0xcc;
// buff[2 + i * 3 + 1] = 0xee;
// buff[2 + i * 3 + 2] = 0xff;
// }
uint8_t a=1;
return a;
};
void SimonSays::update()
void SimonSays::update(uint32_t currentTime)
{
checkBtnPress();
advanceHighlightColor();
if ((currentTime-lastActivationTime)>colorAdvanceTimeInMs) {
advanceHighlightColor();
lastActivationTime=currentTime;
}
// determine pattern von number color

@ -18,15 +18,17 @@ class SimonSays
CRGB baseColors[9];
CRGB highlightColors[9];
uint32_t lastActivationTime = 0;
public:
int numberColors = 2;
int currentLevel = 0;
int currentColorId = 0;
uint32_t colorAdvanceTimeInMs = 2000;
void begin(uint8_t currentLevel = 0, uint8_t numberColors = 2);
void update();
void
begin(uint8_t currentLevel = 0, uint8_t numberColors = 2);
void update(uint32_t time);
void advanceHighlightColor();
void checkBtnPress();
uint8_t getBuff();
};

@ -47,12 +47,12 @@ void loop()
{
// Update in tick rate.
unsigned long time = millis();
uint32_t time = millis();
if (time - timeOfLastTick >= MCUInfo::tickIntervalInMs)
{
timeOfLastTick = time;
Simon.update();
Simon.update(time);
M5.update();
}

Loading…
Cancel
Save