Skip to content

Commit d9dcbb5

Browse files
committed
fixed: introduced ledBuffer in emitter pattern to realize better fade behavior with clock overlay. (Could be generally useful when not all leds are recalculated in each loop cycle.)
1 parent 553cf51 commit d9dcbb5

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

esp8266-fastled-webserver.ino

+8-3
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ NTPClient timeClient(ntpUDP, "pool.ntp.org", utcOffsetInSeconds);
6767
#define LED_TYPE WS2812B
6868
#define COLOR_ORDER GRB
6969
#define NUM_LEDS 256
70+
#define NUM_LEDS_3 NUM_LEDS * 3
7071

7172
#define MILLI_AMPS 2000 // IMPORTANT: set the max milli-Amps of your power supply (4A = 4000mA)
7273
#define FRAMES_PER_SECOND 120 // here you can control the speed. With the Access Point / Web Server the animations run a bit slower.
@@ -1459,9 +1460,10 @@ void waterFibonacci() {
14591460
}
14601461

14611462
/**
1462-
* Emits arcs of color pertruding from the center to the edge of the disc.
1463+
* Emits arcs of color spreading out from the center to the edge of the disc.
14631464
*/
14641465
void emitterFibonacci() {
1466+
static CRGB ledBuffer[NUM_LEDS]; // buffer for better fade behavior
14651467
const uint8_t dAngle = 32; // angular span of the traces
14661468
const uint8_t dRadius = 12; // radial width of the traces
14671469
const uint8_t vSpeed = 16; // max speed variation
@@ -1483,14 +1485,17 @@ void emitterFibonacci() {
14831485
}
14841486

14851487
// fade traces
1486-
fadeToBlackBy( leds, NUM_LEDS, 10);
1488+
fadeToBlackBy( ledBuffer, NUM_LEDS, 6 + (speed >> 3));
14871489

14881490
// draw traces
14891491
for (uint8_t e = 0; e < eCount; e++) {
14901492
uint8_t startRadius = sub8(beat8(qadd8(speed, speedOffset[e])), timeOffset[e]);
14911493
uint8_t endRadius = add8(startRadius, dRadius + (speed>>5)); // increase radial width for higher speeds
1492-
antialiasPixelAR(angle[e], dAngle, startRadius, endRadius, ColorFromPalette(gCurrentPalette, startRadius));
1494+
antialiasPixelAR(angle[e], dAngle, startRadius, endRadius, ColorFromPalette(gCurrentPalette, startRadius), ledBuffer);
14931495
}
1496+
1497+
// copy buffer to actual strip
1498+
memcpy(leds, ledBuffer, NUM_LEDS_3);
14941499
}
14951500

14961501
void wheel() {

0 commit comments

Comments
 (0)