diff --git a/include/effect_multi_dynamic.h b/include/effect_multi_dynamic.h index 6518ff7..92d247d 100644 --- a/include/effect_multi_dynamic.h +++ b/include/effect_multi_dynamic.h @@ -4,9 +4,8 @@ #include "effect_single_dynamic.h" class MultiDynamicEffect : public SingleDynamicEffect { - protected: - int getLoopTime(); public: + MultiDynamicEffect(); void update(); }; diff --git a/include/effect_single_dynamic.h b/include/effect_single_dynamic.h index 21ed51e..8356c84 100644 --- a/include/effect_single_dynamic.h +++ b/include/effect_single_dynamic.h @@ -8,12 +8,13 @@ class SingleDynamicEffect : public Effect { protected: static const int factor = 2; static const int tile_count = LED_WIDTH/factor * LED_HEIGHT/factor; - virtual int getLoopTime(); + int loopTime = 200; CRGB tiles[tile_count]; CRGB old_tiles[tile_count]; uint8_t blend = 0; public: SingleDynamicEffect(); + void init(); virtual void update(); boolean can_be_shown_with_clock(); virtual void loop(); diff --git a/src/effect_multi_dynamic.cpp b/src/effect_multi_dynamic.cpp index 954a6bb..3c93a93 100644 --- a/src/effect_multi_dynamic.cpp +++ b/src/effect_multi_dynamic.cpp @@ -2,7 +2,11 @@ #include "effect_single_dynamic.h" #include "config.h" -int MultiDynamicEffect::getLoopTime() { return EFFECT_MULTI_DYNAMIC_LOOP_TIME; } +MultiDynamicEffect::MultiDynamicEffect() { + init(); + loopTime = EFFECT_MULTI_DYNAMIC_LOOP_TIME; +} + void MultiDynamicEffect::update() { for (int i=0; i