diff options
| author | mrcodetastic <12006953+mrcodetastic@users.noreply.github.com> | 2024-07-28 22:00:45 +0100 |
|---|---|---|
| committer | mrcodetastic <12006953+mrcodetastic@users.noreply.github.com> | 2024-07-28 22:00:45 +0100 |
| commit | f2634319ab7ebfe22fc6d2ebabcdd27879f3667e (patch) | |
| tree | d8834f64f0dc4349bf34cf29a6831a12063b1435 /examples/AuroraDemo/PatternFlock.h | |
| parent | aa28e2a93baaf90083b2d556c0ac80602d9940aa (diff) | |
Clean-up and fix some examples
Diffstat (limited to 'examples/AuroraDemo/PatternFlock.h')
| -rw-r--r-- | examples/AuroraDemo/PatternFlock.h | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/examples/AuroraDemo/PatternFlock.h b/examples/AuroraDemo/PatternFlock.h index 3ae31b1..03c3fd7 100644 --- a/examples/AuroraDemo/PatternFlock.h +++ b/examples/AuroraDemo/PatternFlock.h @@ -36,6 +36,11 @@ #define PatternFlock_H class PatternFlock : public Drawable { + + private: + unsigned long last_update_hue_ms = 0; + unsigned long last_update_predator_ms = 0; + public: PatternFlock() { name = (char *)"Flock"; @@ -110,11 +115,13 @@ class PatternFlock : public Drawable { effects.drawBackgroundFastLEDPixelCRGB(location.x, location.y, color); } - EVERY_N_MILLIS(200) { + if (millis() - last_update_hue_ms > 200) { + last_update_hue_ms = millis(); hue++; } - EVERY_N_SECONDS(30) { + if (millis() - last_update_predator_ms > 30000) { + last_update_predator_ms = millis(); predatorPresent = !predatorPresent; } |
