diff --git a/nametag/src/main.cpp b/nametag/src/main.cpp index ed3c95c..00480b8 100644 --- a/nametag/src/main.cpp +++ b/nametag/src/main.cpp @@ -42,6 +42,7 @@ int line_speed[PANEL_WIDTH]; // how fast each line moves unsigned long line_last_moved[PANEL_WIDTH]; typedef struct { + bool reached_bottom = false; int y; int length; int speed; @@ -59,12 +60,7 @@ void setup(){ raindrops[i].length = random(20, 28); raindrops[i].speed = random(25, 100); raindrops[i].last_moved = millis(); - //raindrops[i] = rd; - - //line_pos[i] = 0 - random(24); - //line_length[i] = random(20, 28); - //line_speed[i] = random(25, 100); - //line_last_moved[i] = millis(); + //raindrops[i].reached_bottom = false; } // redefine pins if required HUB75_I2S_CFG::i2s_pins _pins={R1, G1, BL1, R2, G2, BL2, CH_A, CH_B, CH_C, CH_D, CH_E, LAT, OE, CLK}; @@ -100,6 +96,7 @@ void loop() { } if (raindrops[x].y > PANEL_HEIGHT) { raindrops[x].y = 0; + raindrops[x].reached_bottom = true; } if (raindrops[x].y >= 0) { //draw our pixel @@ -114,7 +111,7 @@ void loop() { } else { matrix->drawPixel(x, trail_y, matrix->color565(0, (255 / raindrops[x].length) * (raindrops[x].length - trail_offset), 0)); } - } else { + } else if (raindrops[x].reached_bottom) { int pixel_num = ((PANEL_HEIGHT + trail_y) * PANEL_WIDTH) + x; if (line_pos[x] >= 0) { if (overlay[ pixel_num / 8 ] & (1 << (7 - (pixel_num % 8)) )) {