Replaced with template

This commit is contained in:
CommanderRedYT
2021-10-18 12:47:22 +02:00
committed by 0xFEEDC0DE64
parent b07d599dc2
commit 595d0434cf
2 changed files with 13 additions and 4 deletions

View File

@@ -4,11 +4,19 @@
#include "utils.h" #include "utils.h"
#include "globals.h" #include "globals.h"
#include "ledstrip.h" #include "ledstrip.h"
#include "ledstripdefines.h" // #include "ledstripdefines.h"
using namespace espgui; using namespace espgui;
namespace { namespace {
template<int16_t type>
class LedStripSetAnimationAction : public virtual ActionInterface
{
public:
void triggered() override { animation_type = type; }
};
/*
class LedstripAnimationDefaultRainbowAction : public virtual ActionInterface class LedstripAnimationDefaultRainbowAction : public virtual ActionInterface
{ {
public: public:
@@ -26,4 +34,5 @@ class LedstripAnimationSyncToSpeedAction : public virtual ActionInterface
public: public:
void triggered() override { animation_type = LEDSTRIP_ANIMATION_TYPE_SPEEDSYNCANIMATION; } void triggered() override { animation_type = LEDSTRIP_ANIMATION_TYPE_SPEEDSYNCANIMATION; }
}; };
*/
} }

View File

@@ -45,9 +45,9 @@ namespace {
{ {
constructMenuItem<makeComponent<MenuItem, currentSelectedAnimationText, DisabledColor, DummyAction>>(); constructMenuItem<makeComponent<MenuItem, currentSelectedAnimationText, DisabledColor, DummyAction>>();
constructMenuItem<makeComponent<MenuItem, EmptyText, DummyAction>>(); constructMenuItem<makeComponent<MenuItem, EmptyText, DummyAction>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_ANIMATION_DEFAULTRAINBOW>, LedstripAnimationDefaultRainbowAction>>(); constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_ANIMATION_DEFAULTRAINBOW>, LedStripSetAnimationAction<LEDSTRIP_ANIMATION_TYPE_DEFAULTRAINBOW>>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_ANIMATION_BETTERRAINBOW>, LedstripAnimationBetterRainbowAction>>(); constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_ANIMATION_BETTERRAINBOW>, LedStripSetAnimationAction<LEDSTRIP_ANIMATION_TYPE_BETTERRAINBOW>>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_ANIMATION_SPEEDSYNCANIMATION>, LedstripAnimationSyncToSpeedAction>>(); constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_ANIMATION_SPEEDSYNCANIMATION>, LedStripSetAnimationAction<LEDSTRIP_ANIMATION_TYPE_SPEEDSYNCANIMATION>>>();
constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<LedstripMenu>, StaticMenuItemIcon<&espgui::icons::back>>>(); constructMenuItem<makeComponent<MenuItem, StaticText<TEXT_BACK>, SwitchScreenAction<LedstripMenu>, StaticMenuItemIcon<&espgui::icons::back>>>();
} }
}; };