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/PatternRadar.h | |
| parent | aa28e2a93baaf90083b2d556c0ac80602d9940aa (diff) | |
Clean-up and fix some examples
Diffstat (limited to 'examples/AuroraDemo/PatternRadar.h')
| -rw-r--r-- | examples/AuroraDemo/PatternRadar.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/examples/AuroraDemo/PatternRadar.h b/examples/AuroraDemo/PatternRadar.h index 1dc4484..fca1579 100644 --- a/examples/AuroraDemo/PatternRadar.h +++ b/examples/AuroraDemo/PatternRadar.h @@ -26,6 +26,7 @@ class PatternRadar : public Drawable { private: byte theta = 0; byte hueoffset = 0; + unsigned long last_update_hue_ms = 0; public: PatternRadar() { @@ -38,12 +39,13 @@ class PatternRadar : public Drawable { for (int offset = 0; offset < MATRIX_CENTER_X; offset++) { byte hue = 255 - (offset * 16 + hueoffset); CRGB color = effects.ColorFromCurrentPalette(hue); - uint8_t x = mapcos8(theta, offset, (MATRIX_WIDTH - 1) - offset); - uint8_t y = mapsin8(theta, offset, (MATRIX_HEIGHT - 1) - offset); + uint8_t x = mapcos8(theta, offset, (VPANEL_W - 1) - offset); + uint8_t y = mapsin8(theta, offset, (VPANEL_H - 1) - offset); uint16_t xy = XY(x, y); effects.leds[xy] = color; - EVERY_N_MILLIS(25) { + if (millis() - last_update_hue_ms > 25) { + last_update_hue_ms = millis(); theta += 2; hueoffset += 1; } |
