From b2bc8aa75ece7447ed816ad8dfa22cb880959158 Mon Sep 17 00:00:00 2001 From: Fabian Schlenz Date: Mon, 3 Jun 2019 06:43:50 +0200 Subject: [PATCH] Experiment in getting the differing delays in Single/MultiDynamic effects to work. Unsuccessful, for now. --- include/effect_multi_dynamic.h | 3 +-- include/effect_single_dynamic.h | 3 ++- src/effect_multi_dynamic.cpp | 6 +++++- src/effect_single_dynamic.cpp | 22 +++++++++++++++++----- 4 files changed, 25 insertions(+), 9 deletions(-) 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