Refactored Ledstrip (Fixed types and removed Macros)
This commit is contained in:
@ -10,7 +10,7 @@ using namespace espgui;
|
||||
|
||||
namespace {
|
||||
#ifdef FEATURE_LEDSTRIP
|
||||
template<int16_t type>
|
||||
template<uint16_t type>
|
||||
class LedStripSetAnimationAction : public virtual ActionInterface
|
||||
{
|
||||
public:
|
||||
|
@ -16,8 +16,8 @@ using namespace std::chrono_literals;
|
||||
std::vector<CRGB> leds;
|
||||
uint8_t gHue = 0;
|
||||
|
||||
int16_t blinkAnimation = LEDSTRIP_OVERWRITE_NONE;
|
||||
int16_t animation_type = LEDSTRIP_ANIMATION_TYPE_DEFAULTRAINBOW;
|
||||
uint16_t blinkAnimation = LEDSTRIP_OVERWRITE_NONE;
|
||||
uint16_t animation_type = LedstripAnimation::DefaultRainbow;
|
||||
|
||||
|
||||
void initLedStrip()
|
||||
@ -215,10 +215,10 @@ void showAnimation()
|
||||
{
|
||||
if (settings.ledstrip.enableLedAnimation && !simplified && !(asyncOtaTaskStarted && settings.ledstrip.otaMode != OtaAnimationModes::None))
|
||||
{
|
||||
if (animation_type == LEDSTRIP_ANIMATION_TYPE_DEFAULTRAINBOW) showDefaultLedstrip();
|
||||
else if (animation_type == LEDSTRIP_ANIMATION_TYPE_BETTERRAINBOW) showBetterRainbow();
|
||||
else if (animation_type == LEDSTRIP_ANIMATION_TYPE_SPEEDSYNCANIMATION) showSpeedSyncAnimation();
|
||||
else if (animation_type == LEDSTRIP_ANIMATION_TYPE_CUSTOMCOLOR) showCustomColor();
|
||||
if (animation_type == LedstripAnimation::DefaultRainbow) showDefaultLedstrip();
|
||||
else if (animation_type == LedstripAnimation::BetterRainbow) showBetterRainbow();
|
||||
else if (animation_type == LedstripAnimation::SpeedSync) showSpeedSyncAnimation();
|
||||
else if (animation_type == LedstripAnimation::CustomColor) showCustomColor();
|
||||
else showDefaultLedstrip();
|
||||
}
|
||||
else if (asyncOtaTaskStarted && settings.ledstrip.otaMode != OtaAnimationModes::None)
|
||||
|
@ -29,8 +29,8 @@ enum OtaAnimationModes
|
||||
extern std::vector<CRGB> leds;
|
||||
extern uint8_t gHue;
|
||||
|
||||
extern int16_t blinkAnimation;
|
||||
extern int16_t animation_type;
|
||||
extern uint16_t blinkAnimation;
|
||||
extern uint16_t animation_type;
|
||||
|
||||
void showDefaultLedstrip();
|
||||
void showAnimation();
|
||||
|
@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
/*
|
||||
* This file contains a few defines, so you don't have to remember which ledstrip animation is which number
|
||||
*/
|
||||
@ -13,11 +14,12 @@
|
||||
#endif
|
||||
#define LEDSTRIP_OVERWRITE_BLINKBOTH 3
|
||||
|
||||
|
||||
#define LEDSTRIP_ANIMATION_TYPE_DEFAULTRAINBOW 0
|
||||
#define LEDSTRIP_ANIMATION_TYPE_BETTERRAINBOW 1
|
||||
#define LEDSTRIP_ANIMATION_TYPE_SPEEDSYNCANIMATION 2
|
||||
#define LEDSTRIP_ANIMATION_TYPE_CUSTOMCOLOR 3
|
||||
enum LedstripAnimation : uint16_t {
|
||||
DefaultRainbow,
|
||||
BetterRainbow,
|
||||
SpeedSync,
|
||||
CustomColor
|
||||
};
|
||||
|
||||
#define BLINK_LEFT_EXPR blinkAnimation != LEDSTRIP_OVERWRITE_BLINKRIGHT
|
||||
#define BLINK_RIGHT_EXPR blinkAnimation != LEDSTRIP_OVERWRITE_BLINKLEFT
|
||||
|
@ -256,7 +256,7 @@ constexpr Settings::Ledstrip defaultLedstrip {
|
||||
#ifdef LEDSTRIP_ANIMATION_DEFAULT
|
||||
.animationType = LEDSTRIP_ANIMATION_DEFAULT,
|
||||
#else
|
||||
.animationType = LEDSTRIP_ANIMATION_TYPE_DEFAULTRAINBOW,
|
||||
.animationType = LedstripAnimation::DefaultRainbow,
|
||||
#endif
|
||||
.enableFullBlink = false,
|
||||
.enableStVO = false,
|
||||
|
Reference in New Issue
Block a user