add multiple meteors and ability to slow meteors - #5758
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe Meteor effect now supports multiple evenly spaced meteors and a slow mode. Segment controls determine meteor count and timing, while rendering, trail updates, frame progression, and effect metadata reflect the new options. ChangesMeteor effect updates
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested labels: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
wled00/FX.cpp (1)
2427-2433: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winFormat the new meteor loop to match WLED C++ style.
The added block uses
if(meteorSmooth)/else{and over-indents the smooth branch. Please format it withif (/} else {and 2-space indentation.As per coding guidelines,
wled00/**/*.{cpp,h}requires 2-space indentation, spaces after control-flow keywords, and K&R braces.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@wled00/FX.cpp` around lines 2427 - 2433, Reformat the meteorSmooth conditional in the meteor loop to follow WLED C++ style: use “if (meteorSmooth)” and “} else {”, with the smooth branch and its statements indented by two spaces. Preserve the existing logic and expressions unchanged.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@wled00/FX.cpp`:
- Around line 2427-2433: Reformat the meteorSmooth conditional in the meteor
loop to follow WLED C++ style: use “if (meteorSmooth)” and “} else {”, with the
smooth branch and its statements indented by two spaces. Preserve the existing
logic and expressions unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: d7448f14-eaf4-4d42-967b-8f625fd7517c
📒 Files selected for processing (1)
wled00/FX.cpp
|
thanks, sounds like good addition - similar to multi comet. You can also try PS Sparkler, it is different though but also can do something similar. can you show what it looks like? there is an FX recorder tool in my wled tools repo. |
| if(meteorSmooth) { | ||
| // draw meteor(s), evenly spaced along the strip | ||
| for (unsigned m = 0; m < numMeteors; m++) { | ||
| unsigned start = (meteorstart + m * SEGLEN / numMeteors) % SEGLEN; |
There was a problem hiding this comment.
@coderabbitai i'm seeing a jump in the example shown by the PR author. Please check if the math is correct here.
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- Focused source ---'
ast-grep outline wled00/FX.cpp --match mode_meteor --view expanded
sed -n '2365,2460p' wled00/FX.cpp
printf '%s\n' '--- PR diff for Meteor ---'
git diff --unified=80 HEAD^ HEAD -- wled00/FX.cpp | sed -n '/void mode_meteor()/,/static const char _data_FX_MODE_METEOR/p'
printf '%s\n' '--- Spacing and wrap simulation ---'
python3 - <<'PY'
cases = [(10, 3), (17, 3), (17, 6), (30, 8), (60, 8), (144, 8)]
for length, count in cases:
print(f"\nSEGLEN={length}, numMeteors={count}")
previous = None
for meteorstart in range(length):
starts = [((meteorstart + m * length // count) % length) for m in range(count)]
ordered = sorted(starts)
gaps = [ordered[i + 1] - ordered[i] for i in range(count - 1)]
gaps.append(length + ordered[0] - ordered[-1])
if previous is not None:
moved = sorted((starts[i] - previous[i]) % length for i in range(count))
if moved != [1] * count:
print(f" discontinuity from {meteorstart - 1} to {meteorstart}: {previous} -> {starts}, movement={moved}")
break
previous = starts
print(f" starts at phase 0: {[m * length // count for m in range(count)]}")
print(f" circular gaps: {gaps}")
PYLength of output: 9010
@softhack007, I checked the position math.
(meteorstart + m * SEGLEN / numMeteors) % SEGLEN does not create a frame-to-frame jump. Each meteor advances by the same amount as meteorstart. The modulo also wraps a meteor from the last pixel to pixel zero.
The code does produce unequal spacing when SEGLEN is not divisible by numMeteors. Integer division rounds each offset down.
For example, with SEGLEN == 60 and numMeteors == 8, the gaps are:
8, 7, 8, 7, 8, 7, 8, 7
Therefore, the pattern has fixed one-pixel spacing differences. This can look like a jump in a visual recording, especially on a short segment. Exact equal spacing is impossible on the integer pixel grid for this case.
I do not find a wraparound or arithmetic discontinuity in this line. The reported effect is likely the unavoidable rounding distribution.
You are interacting with an AI system.
There was a problem hiding this comment.
The jump may also be due to my failed attempt at trying to get a nice looping gif.
There was a problem hiding this comment.
Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

I really like the "Meteor" effect, and wanted to have multiple meteors going across my house. So I added a slider that adds meteors (up to 8, default 1).
The meteors also moved very quickly across my house, so I added a checkbox function to slow the meteors down (default off).
Built and tested locally and works well.
AI was used to assist me coding this.
Summary by CodeRabbit
Summary
New Features
Improvements