Skip to content

Commit

Permalink
Fix Circuit effect draw out of bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Plummer authored and Dave Plummer committed Jul 12, 2023
1 parent 1fb6372 commit 79c5cfa
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
5 changes: 3 additions & 2 deletions include/effects/matrix/PatternCircuit.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,12 +189,13 @@ class PatternCircuit : public LEDStripEffect
virtual void Draw() override
{
// Reset after 20 seconds
if (millis() - msStart > 20000)
const auto kResetEveryNSeconds = 20;
if (millis() - msStart > kResetEveryNSeconds * MILLIS_PER_SECOND)
start();

for (int i = 0; i < MATRIX_WIDTH * MATRIX_HEIGHT / 10; i++)
{
g()->leds[g()->xy(random(0, MATRIX_WIDTH), random(0, MATRIX_HEIGHT))].fadeToBlackBy(32);
g()->leds[g()->xy(random(0, MATRIX_WIDTH-1), random(0, MATRIX_HEIGHT-1))].fadeToBlackBy(32);
}

// fill_palette(colors, SNAKE_LENGTH, initialHue++, 5, graphics->currentPalette, 255, LINEARBLEND);
Expand Down
6 changes: 3 additions & 3 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
; https://docs.platformio.org/page/projectconf.html

[platformio]
default_envs =
default_envs = mesmerizer

; ==================
; Base configuration
;
; Options that are used (or extended) in all device sections (and hence environments) are defined here

[base]
upload_port =
monitor_port =
upload_port = /dev/cu.usbserial-8411101
monitor_port = /dev/cu.usbserial-8411101
upload_speed = 1500000

build_flags = -std=gnu++17
Expand Down
1 change: 1 addition & 0 deletions simh
Submodule simh added at e499d0
1 change: 1 addition & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,7 @@ void setup()

debugW("Reserving %d LED buffers for a total of %d bytes...", cBuffers, memtoalloc * cBuffers);


for (int iChannel = 0; iChannel < NUM_CHANNELS; iChannel++)
g_aptrBufferManager[iChannel] = std::make_unique<LEDBufferManager>(cBuffers, g_aptrDevices[iChannel]);

Expand Down

0 comments on commit 79c5cfa

Please sign in to comment.