Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions wled00/FX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,41 @@ uint16_t mode_rainbow_cycle(void) {
}
static const char _data_FX_MODE_RAINBOW_CYCLE[] PROGMEM = "Rainbow@!,Size;;!";

/*
* Cycles a rainbow over the entire string of LEDs, with a white flash that goes across it.
*/
uint16_t mode_shimmer() {

uint32_t shimmerSpeed = 100 + (255 - SEGMENT.speed) * 40; // [100,10260ms]
uint32_t shimmerSize = (SEGMENT.custom1 * SEGLEN >> 9) + 1; // [1,SEGLEN/2+1]
uint32_t cycleTime = (255 - SEGMENT.intensity) * 150 + shimmerSpeed; // [100, 48510]

uint32_t percCycle = strip.now % cycleTime;
uint64_t shimmerIndex = ((uint64_t)percCycle<<8) / shimmerSpeed * (SEGLEN + 2*shimmerSize);

shimmerIndex -= shimmerSize << 8;

//change direction unless reverse is checked
if(!SEGMENT.check1) {
shimmerIndex = (((uint64_t) SEGLEN) << 8) - shimmerIndex;
}

for (unsigned i = 0; i < SEGLEN; i++) {
//shimmer logic
uint64_t distFromShimmerCenter = abs((int32_t)shimmerIndex - ((int64_t)i << 8));

// Only process pixels that are within the shimmer's range.
if (distFromShimmerCenter < (shimmerSize<<8)) {
SEGMENT.setPixelColor(i, color_blend(SEGCOLOR(1), SEGCOLOR(0), 255-(distFromShimmerCenter / shimmerSize)));
}
else {
SEGMENT.setPixelColor(i,SEGCOLOR(1));
}
}

return FRAMETIME;
}
static const char _data_FX_MODE_SHIMMER[] PROGMEM = "Shimmer@Speed,Frequancy,Size,,,Reverse;!!;sx=231,ix=221";

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Typo in user-facing metadata and unclear parameter mapping

  • “Frequancy” should be “Frequency”.
  • Labels imply: Speed = speed slider, Frequency = intensity slider, Size = custom1, Reverse = check1. That matches the code. Fix the typo to avoid UI polish regressions.

Apply:

-static const char _data_FX_MODE_SHIMMER[] PROGMEM = "Shimmer@Speed,Frequancy,Size,,,Reverse;!!;sx=231,ix=221";
+static const char _data_FX_MODE_SHIMMER[] PROGMEM = "Shimmer@Speed,Frequency,Size,,,Reverse;!!;sx=231,ix=221";
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
static const char _data_FX_MODE_SHIMMER[] PROGMEM = "Shimmer@Speed,Frequancy,Size,,,Reverse;!!;sx=231,ix=221";
static const char _data_FX_MODE_SHIMMER[] PROGMEM = "Shimmer@Speed,Frequency,Size,,,Reverse;!!;sx=231,ix=221";
🤖 Prompt for AI Agents
In wled00/FX.cpp around lines 581-582, the user-facing metadata string contains
a typo: "Frequancy" should be "Frequency"; update the PROGMEM string to correct
the spelling while keeping the existing parameter order and mapping
(Speed,Frequancy,Size,,,Reverse) unchanged so Speed maps to speed slider,
Frequency to intensity slider, Size to custom1 and Reverse to check1.

/*
* Alternating pixels running function.
Expand Down Expand Up @@ -10665,6 +10700,7 @@ void WS2812FX::setupEffectData() {
addEffect(FX_MODE_DYNAMIC, &mode_dynamic, _data_FX_MODE_DYNAMIC);
addEffect(FX_MODE_RAINBOW, &mode_rainbow, _data_FX_MODE_RAINBOW);
addEffect(FX_MODE_RAINBOW_CYCLE, &mode_rainbow_cycle, _data_FX_MODE_RAINBOW_CYCLE);
addEffect(FX_MODE_SHIMMER, &mode_shimmer, _data_FX_MODE_SHIMMER);
addEffect(FX_MODE_SCAN, &mode_scan, _data_FX_MODE_SCAN);
addEffect(FX_MODE_DUAL_SCAN, &mode_dual_scan, _data_FX_MODE_DUAL_SCAN);
addEffect(FX_MODE_FADE, &mode_fade, _data_FX_MODE_FADE);
Expand Down
3 changes: 2 additions & 1 deletion wled00/FX.h
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,8 @@ extern byte realtimeMode; // used in getMappedPixelIndex()
#define FX_MODE_PS1DSONICBOOM 215
#define FX_MODE_PS1DSPRINGY 216
#define FX_MODE_PARTICLEGALAXY 217
#define MODE_COUNT 218
#define FX_MODE_SHIMMER 218
#define MODE_COUNT 219


#define BLEND_STYLE_FADE 0x00 // universal
Expand Down