-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Remove FRAMETIME return value from all FX #5314
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- all FX now render every frame, no more "speed up" during transitions
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughEffect mode functions and related typedefs changed from returning Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@usermods/user_fx/README.md`:
- Around line 83-85: The tutorial snippets call mode_static() when a non-2D
setup is detected but do not stop execution, allowing the flow to continue into
2D-specific logic; update the conditional that checks strip.isMatrix and
SEGMENT.is2D() so that after calling mode_static() you immediately return (e.g.,
wrap mode_static() in a block and add return;) and apply the same change to the
other occurrence referenced around the second snippet (the one at 130-132) so
both examples exit early after the fallback.
In `@wled00/FXparticleSystem.h`:
- Line 23: The header currently defines WLED_DEBUG_PS unconditionally which
forces particle-system debug and extra flash into every build; remove the
default `#define` and make WLED_DEBUG_PS opt-in by guarding debug code behind a
build-time macro (e.g., rely on a compile flag such as -DENABLE_WLED_DEBUG_PS or
an existing global debug macro) so that FXparticleSystem.h only enables debug
when that build flag is set; update references to WLED_DEBUG_PS in the file so
they are inside `#ifdef` ENABLE_WLED_DEBUG_PS (or the chosen macro) and document
the new build flag for opt‑in usage.
🧹 Nitpick comments (3)
usermods/user_fx/README.md (1)
253-253: Clarify how to re‑render when skipping state updates.The new note says to re‑render every frame, but the example still renders only inside the update interval. Consider adding a short hint or snippet showing a “render every call, update conditionally” structure to avoid confusion for readers.
wled00/FXparticleSystem.cpp (2)
1098-1102: Consider nullingPartSyson early exit to avoid dangling pointers.
SEGMENT.deallocateData()invalidates prior PS memory; settingPartSys = nullptrhere makes accidental reuse safer.♻️ Suggested change
if (!strip.isMatrix) { errorFlag = ERR_NOT_IMPL; // TODO: need a better error code if more codes are added SEGMENT.deallocateData(); // deallocate any data to make sure data is null (there is no valid PS in data and data can only be checked for null) + PartSys = nullptr; return false; // only for 2D }
1850-1854: Also nullPartSysin the 1D early-exit path.
This keeps callers from accidentally using a stale pointer afterSEGMENT.deallocateData().♻️ Suggested change
if (SEGLEN == 1) { errorFlag = ERR_NOT_IMPL; // TODO: need a better error code if more codes are added SEGMENT.deallocateData(); // deallocate any data to make sure data is null (there is no valid PS in data and data can only be checked for null) + PartSys = nullptr; return false; // single pixel not supported }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
usermods/user_fx/README.md (1)
302-309: Update Sinelon example to void-return to match FX changes.
The example still declaresuint16_tand later showsreturn FRAMETIME;, butFX_FALLBACK_STATICexpands toreturn;and the API is now void. Please align the snippet and its narrative to avoid copy-paste compile errors.✏️ Proposed doc fix
-static uint16_t sinelon_base(bool dual, bool rainbow=false) { +static void sinelon_base(bool dual, bool rainbow=false) { if (SEGLEN <= 1) FX_FALLBACK_STATIC; ... - return FRAMETIME; }-uint16_t mode_sinelon(void) { - return sinelon_base(false); -} +void mode_sinelon(void) { + sinelon_base(false); +} -uint16_t mode_sinelon_dual(void) { - return sinelon_base(true); -} +void mode_sinelon_dual(void) { + sinelon_base(true); +} -uint16_t mode_sinelon_rainbow(void) { - return sinelon_base(false, true); -} +void mode_sinelon_rainbow(void) { + sinelon_base(false, true); +}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@wled00/FXparticleSystem.h`:
- Around line 145-147: The comment for updateFire still mentions the removed
renderonly parameter and should be updated to reflect the new always-update
behavior; modify the comment on the updateFire(const uint8_t intensity)
declaration in FXparticleSystem.h to remove the "if renderonly is set, particles
are not updated" clause and instead state that updateFire always updates
particles (and is used to keep fire behavior consistent across frame skips/
transitions), or simply remove the outdated phrase so the comment matches
current behavior.
since for smooth transitions the FPS was forced to FRAMETIME anyway and only a handful of FX actually used it there is no reason to keep this logic. With persistent segment buffers a frame can also be sent out multiple times, even if the FX does not render it (which it should for smooth transitions but it is not a requirement anymore)
FX_FALLBACK_STATIC { mode_static(); return; }return FRAMETIME;and addFX_FALLBACK_STATICreferencesAdditional changes:
Summary by CodeRabbit
Bug Fixes
Refactor
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.