Only auto-activate FireAnimation once on startup
This commit is contained in:
parent
9d60afe1fb
commit
4d2c61782b
18
src/main.cpp
18
src/main.cpp
|
@ -96,6 +96,7 @@ bool initLEDs()
|
|||
}
|
||||
|
||||
enum LEDState {
|
||||
STARTUP,
|
||||
UDP,
|
||||
ANIMATION,
|
||||
TRANSITION,
|
||||
|
@ -105,7 +106,7 @@ enum LEDState {
|
|||
static void ledFSM(void)
|
||||
{
|
||||
static bool stateEntered = true;
|
||||
static LEDState ledState = ANIMATION;
|
||||
static LEDState ledState = STARTUP;
|
||||
static LEDState nextState;
|
||||
|
||||
static unsigned long lastUDPUpdate = 0;
|
||||
|
@ -113,19 +114,22 @@ static void ledFSM(void)
|
|||
LEDState lastState = ledState;
|
||||
|
||||
switch(ledState) {
|
||||
case ANIMATION:
|
||||
Serial.print("A");
|
||||
case STARTUP:
|
||||
animController.loop();
|
||||
|
||||
if(animController.isIdle()) {
|
||||
animController.changeAnimation(std::unique_ptr<Animation>(new FireAnimation(&ledFader, false)), false);
|
||||
ledState = ANIMATION;
|
||||
}
|
||||
break;
|
||||
|
||||
case ANIMATION:
|
||||
if(stateEntered) {
|
||||
animController.restart();
|
||||
}
|
||||
|
||||
animController.loop();
|
||||
|
||||
if(animController.isIdle()) {
|
||||
animController.changeAnimation(std::unique_ptr<Animation>(new FireAnimation(&ledFader, false)));
|
||||
}
|
||||
|
||||
if(((WiFi.status() == WL_CONNECTED) || (WiFi.getMode() == WIFI_MODE_AP)) &&
|
||||
udpProto.check()) {
|
||||
// UDP packet received -> transition to UDP state
|
||||
|
|
Loading…
Reference in a new issue