Skip to content

Allow use of pysical buttons when receiving live data#5370

Open
IsaccoBenedetti wants to merge 7 commits intowled:mainfrom
IsaccoBenedetti:fix-unresponsive-buttons-when-receiving-live-data
Open

Allow use of pysical buttons when receiving live data#5370
IsaccoBenedetti wants to merge 7 commits intowled:mainfrom
IsaccoBenedetti:fix-unresponsive-buttons-when-receiving-live-data

Conversation

@IsaccoBenedetti
Copy link

@IsaccoBenedetti IsaccoBenedetti commented Feb 13, 2026

Hi, first time contributor here!

Recently I ran into a small issue when using physical buttons and HyperHDR. I'm not sure if this was done by design, but currently when WLED is receiving a live data stream physical button inputs are not processed. This makes it impossible to regain local control over the lights once a live source is active, without opening the webUI.

Initially I tried assigning a preset with the API command LO=2 (Live Override) to a physical button, but it didn't work as expected, because the functions that handle preset logic (handlePresets() and handlePlaylist()) are located within the conditional block that is skipped when realtimeMode is true.

This issue has been previously reported by the community on the WLED Discourse forums, but it seems it never got resolved: Live data override on the physical button.

This PR aims to solve the issue, simply by moving the handlePresets() and handlePlaylist() function calls out of the if (!realtimeMode || ...) block in the main loop.

This way button presses and their associated API commands are now processed on every loop cycle, regardless of the live data state. When a button triggers a preset containing LO=2, the realtimeOverride flag is correctly set, allowing WLED to exit the live stream and apply the desired preset.

I was a bit worried these functions were purposely been left inside the check for performance reasons, so I tested it specifically on an ESP8266 instead of an ESP32 with a HyperHDR stream, but I couldn't notice any lag or jitter at all. It seems solid.

What do you think?

Summary by CodeRabbit

  • Refactor
    • Removed duplicate preset and playlist processing logic to optimize performance and improve code maintainability.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 13, 2026

Walkthrough

Removed duplicate preset and playlist handling logic in the main loop. The earlier occurrence of the handling sequence was retained while a later duplicate block was eliminated, consolidating the control flow.

Changes

Cohort / File(s) Summary
Duplicate logic consolidation
wled00/wled.cpp
Removed duplicate handlePlaylist() and handlePresets() calls with preceding presetNeedsSaving() check; retained single earlier occurrence in loop.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: allowing physical button input to remain responsive while the device receives live data streams.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into main

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

No actionable comments were generated in the recent review. 🎉

🧹 Recent nitpick comments
wled00/wled.cpp (1)

130-130: Trailing whitespace on this line.

Nit: this line appears to contain trailing spaces.

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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.

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.

1 participant