esp32-sk6812/include/Animation/AnimationController.h
Thomas Kolb d5357b2021 Show IP address on startup
To accomplish this, the following changes were made:

- Added an image-scrolling animation
- Implemented a bitmap font engine to generate an image from text
- On startup, an image-scrolling animation is set up with an image
  generated from the local IP address
2019-12-23 19:56:33 +01:00

54 lines
1.1 KiB
C++

#pragma once
#include <memory>
#include "Animation.h"
#include <FreeRTOS.h>
#include <freertos/semphr.h>
class AnimationController
{
public:
enum DefaultAnimation {
FIRE_HOT = 0,
FIRE_COLD = 1,
SNOWFALL = 2,
FONT_TEST = 3,
NUM_DEFAULT_ANIMATIONS
};
static const constexpr std::array<const char*, NUM_DEFAULT_ANIMATIONS> AnimationNames{
"Hot Fire",
"Cold Fire",
"Snowfall",
"Font Test"
};
AnimationController(Fader *fader);
void changeAnimation(std::unique_ptr<Animation> anim, bool transition = true);
void changeAnimation(DefaultAnimation animation_id, bool transition = true);
void loop(void);
void stop(void);
void restart(void);
bool isIdle(void)
{
return !m_animation || (m_animation->finished() && !m_nextAnimation);
}
private:
Fader *m_fader;
std::unique_ptr<Animation> m_animation;
std::unique_ptr<Animation> m_nextAnimation;
SemaphoreHandle_t m_updateMutex;
uint64_t m_frame;
};