Skip to content

Fix a frame bug with the effect Stream that after a certain time will…#5739

Open
Ryrumeli wants to merge 1 commit into
wled:mainfrom
Ryrumeli:fix-Stream-Bug
Open

Fix a frame bug with the effect Stream that after a certain time will…#5739
Ryrumeli wants to merge 1 commit into
wled:mainfrom
Ryrumeli:fix-Stream-Bug

Conversation

@Ryrumeli

@Ryrumeli Ryrumeli commented Jul 17, 2026

Copy link
Copy Markdown

Tested in my ESP32 Wroom.

Basically, there was an oversight where the 32 bits float is tested against a temporary 16 bit variable. As soon as it extrapolates (In the highest speed for the effect in about over an hour) there is an erratic shit that happens instead of the desired effect. Just applying a similar solution to the one in Stream 2 fixed it completely, by using & 0xFFFF.

Working Version:
ezgif-3633caa18a4d4298

Glitch happening:
ezgif-37a0ab7589585766

Summary by CodeRabbit

  • Bug Fixes
    • Improved zone-change tracking in the Stream/random-chase lighting effect.
    • Ensured effect transitions remain synchronized during longer-running animations.

… start skipping

Tested in my ESP32 Wroom.

Basically, there was an oversight where the 32 bits float is tested against a temporary 16 bit variable. As soon as it extrapolates (In the highest speed for the effect in about over an hour) there is an erratic shit that happens instead of the desired effect. Just applying a similar solution to the one in Stream 2 fixed it completely.
@coderabbitai

coderabbitai Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 50531de0-bde4-4286-82bf-22b35e0203e7

📥 Commits

Reviewing files that changed from the base of the PR and between a962116 and 84e2c07.

📒 Files selected for processing (1)
  • wled00/FX.cpp

Walkthrough

The random stream effect now compares and stores only the low 16 bits of its iteration counter when tracking zone changes.

Changes

Random stream zone tracking

Layer / File(s) Summary
Low 16-bit zone tracking
wled00/FX.cpp
mode_running_random compares the iterator’s low 16 bits for zone changes and stores the same truncated value in SEGENV.aux1.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Suggested reviewers: dedehai, bobloeffner68, brandon502

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is directly related to the Stream effect frame bug fixed in this PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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.

Comment thread wled00/FX.cpp
}

SEGENV.aux1 = it;
SEGENV.aux1 = it & 0xFFFF;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is redundant, aux1 is uint16_t

@DedeHai

DedeHai commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

thanks for finding and fixing this. looks good, the last line is unnecessary though.

@softhack007 softhack007 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix looks good to me.

As a small correction to the description: there is no float involved. The problem is a comparison it != aux1 that is performed in full 32bit, while aux1 only has 16bit, and the effect behaves erratically after some time. The patch fixes it by masking out the upper 16bits so the comparison continues to work as expected.

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