Skip to content

Commit e2242f5

Browse files
authored
Merge pull request wled#1804 from blazoncek/chunchun-fix
Slight modification of Chunchun effect.
2 parents 30df677 + e06d269 commit e2242f5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

wled00/FX.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3627,15 +3627,15 @@ uint16_t WS2812FX::mode_chunchun(void)
36273627
{
36283628
fill(SEGCOLOR(1));
36293629
uint16_t counter = now*(6 + (SEGMENT.speed >> 4));
3630-
uint16_t numBirds = SEGLEN >> 2;
3631-
uint16_t span = SEGMENT.intensity << 8;
3630+
uint16_t numBirds = 2 + (SEGLEN >> 3); // 2 + 1/8 of a segment
3631+
uint16_t span = (SEGMENT.intensity << 8) / numBirds;
36323632

36333633
for (uint16_t i = 0; i < numBirds; i++)
36343634
{
3635-
counter -= span/numBirds;
3636-
int megumin = sin16(counter) + 0x8000;
3635+
counter -= span;
3636+
uint16_t megumin = sin16(counter) + 0x8000;
36373637
uint32_t bird = (megumin * SEGLEN) >> 16;
3638-
uint32_t c = color_from_palette((i * 255)/ numBirds, false, true, 0);
3638+
uint32_t c = color_from_palette((i * 255)/ numBirds, false, false, 0); // no palette wrapping
36393639
setPixelColor(bird, c);
36403640
}
36413641
return FRAMETIME;

0 commit comments

Comments
 (0)