[16.0.x port] prevent glitches on -C3 by waiting for LEDs updates to finish#5691
[16.0.x port] prevent glitches on -C3 by waiting for LEDs updates to finish#5691softhack007 wants to merge 10 commits into
Conversation
…lly suspend interrupts (#5435) * adding strip.waitForLEDs(waitMS) function * wait for LEDs output to complete before file writing * wait before ESP.getFreeHeap() - main loop * wait before file close (upload) and before getFreeHeap() (json info) * avoid losing "trigger" events due to strip.suspend --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* use constants instead of raw timeouts * simplify usage - in many cases we don't need #ifdef any more * missed one "wait" on image_loader
comment should match real timeout
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (3)
WalkthroughIntroduces ChangeswaitForLEDs API and call-site integration
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
prevents flickering at startup
* space before comment * use isUpdating() - not strip.isUpdating() - in waitForLEDs()
getFreeHeapSize() can cause glitches.
|
@bigfella5000 this is the -C3 flicker fix, brought to |
| * On 8266 this call will _not_ wait outside the main loop context. | ||
| * Function returns isUpdating() status after waiting. | ||
| **/ | ||
| bool WS2812FX::waitForLEDs(unsigned maxWaitMS, bool always) const { |
There was a problem hiding this comment.
add (or replace always) "bool suspend" and put the suspend code in here?
There was a problem hiding this comment.
that's a bit tricky ... need to think about it.
|
|
||
| // f.close() may enter flash critical sections (interrupts/cache paused), so we wait for LED transmission to finish first to avoid WS281x glitches | ||
| // This is most relevant on ESP32-C3/C5/C6, where the RMT driver is very sensitive to interrupt timing. | ||
| bool haveSuspended = false; |
There was a problem hiding this comment.
suspend will skip this frame if it already isServicing() but maybe that is the price to pay, I don't see an easy way out.
There was a problem hiding this comment.
good point ... its really a hard measure for every file update (saving presets and saving cfg.json).
The problem is that the main loop might run the next strip.service() when closefile() gets called from the async_tcp task context. This could create new flickering.
* clarify #ifdef condition in waitForLEDs() * move strip.waitForLEDs() before file exists checks (exists() can cause flickering) * use MEDUIM timeout in image loader * correct misunderstood comment in wled.cpp
|
esp01_1m_full_160 build has failed - need to check why we're now 3 bytes over program size 🤔 edit: my last commit seems to have added 16 bytes that are now pushing us over-the-limit. |
|
It looks like the I've removed AR from @DedeHai @netmindz @willmmiles what do you think? OK to remove AR from |
16.0.0 port of #5435
temporary solution for LEDs glitches on RISC-V boards, as discussed in #5683
previous discussion see #5683 and #5688
Summary by CodeRabbit
Summary by CodeRabbit
Bug Fixes
Improvements