Skip to content

(0.15.x) wait for LEDs output to finish before OS calls that potentially suspend interrupts#5435

Open
softhack007 wants to merge 21 commits into0_15_xfrom
8266_wait_b4_close
Open

(0.15.x) wait for LEDs output to finish before OS calls that potentially suspend interrupts#5435
softhack007 wants to merge 21 commits into0_15_xfrom
8266_wait_b4_close

Conversation

@softhack007
Copy link
Member

@softhack007 softhack007 commented Mar 21, 2026

Add a short wait time before calling file.close() and ESP.getFreeHeap(), to prevent LED glitches caused by interrupt stalls.

potential fix for #5427

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced timing synchronization between system operations (file access, memory queries, OTA updates, file uploads) and LED transmission cycles to prevent timing conflicts with addressable LED strips.
    • Improved trigger event handling to prevent event loss during LED service suspension.

f.close() writes buffered data to flash, and shortly suspends all other interrupts during writing. This can lead to LEDs flickering, especially on 8266 or -C3 that don't have the RMTHI driver.
reduces code duplication
two more places where flickering can be reduced
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 21, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: b6ddd9c4-91eb-4a26-8c42-3efcf44f7f36

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 8266_wait_b4_close

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@softhack007 softhack007 changed the title wait for LEDs output to finish before OS calls that potentially suspend interrupts (0.15.x) wait for LEDs output to finish before OS calls that potentially suspend interrupts Mar 21, 2026
coderabbitai[bot]

This comment was marked as off-topic.

only in async paths (webserver context)
coderabbitai[bot]

This comment was marked as resolved.

to prevent repeated attempts to close a closed file handle.
coderabbitai[bot]

This comment was marked as resolved.

coderabbitai[bot]

This comment was marked as resolved.

I overlooked that this method already existed -> merged both definitions.
@softhack007 softhack007 added this to the 0.15.5 milestone Mar 22, 2026
if strip.suspend() was received in the middle of effect rendering, the final strip.show() is skipped => trigger request should not reset if suspended.
coderabbitai[bot]

This comment was marked as off-topic.

* remove statements for 8266 - 8266 UART output is not affected by paused interrupts
* add statement for risc-v boards
coderabbitai[bot]

This comment was marked as off-topic.

avoids random LED flashing during OTA

This is only partly related to the PR scope, but its a good idea any way so I added it here
coderabbitai[bot]

This comment was marked as resolved.

* only resume if suspended by OTA
* remove resume() from unrelated path
suspend/resume is already handled internally in ota_update.cpp
coderabbitai[bot]

This comment was marked as duplicate.

* presets.json sending via webserver
* cfg.json copy /  compare / restore
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants