From b65afde1420fcc10a623a1180c712c65fc86bcf5 Mon Sep 17 00:00:00 2001 From: Fabian Schlenz Date: Sat, 15 Jun 2019 14:17:06 +0200 Subject: [PATCH] MatrixEffect now uses dynamically allocated memory. --- include/effect_matrix.h | 4 +++- src/effect_matrix.cpp | 12 ++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/include/effect_matrix.h b/include/effect_matrix.h index 6ac7a59..7e00a8e 100644 --- a/include/effect_matrix.h +++ b/include/effect_matrix.h @@ -30,9 +30,11 @@ public: class MatrixEffect : public Effect { private: - MatrixEffectColumn columns[LED_WIDTH]; + MatrixEffectColumn* _columns; public: boolean can_be_shown_with_clock(); + void start(); + void stop(); MatrixEffect(); void loop(); }; diff --git a/src/effect_matrix.cpp b/src/effect_matrix.cpp index d79023a..b977654 100644 --- a/src/effect_matrix.cpp +++ b/src/effect_matrix.cpp @@ -55,10 +55,18 @@ void MatrixEffectColumn::loop() { boolean MatrixEffect::can_be_shown_with_clock() { return true; }; MatrixEffect::MatrixEffect() { - for (int i=0; iclear(); - for (int i=0; iwidth; i++) columns[i].loop(); + for (int i=0; iwidth; i++) _columns[i].loop(); }