Skip to content
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

Improved framerate control code - strip.show(), strip.service() #176

Merged
merged 6 commits into from
Nov 4, 2024

Conversation

softhack007
Copy link
Collaborator

@softhack007 softhack007 commented Nov 1, 2024

The old code was having lots of minor errors in calculation of "time passed" since last frame. Additionally, the value for MIN_SHOW_DELAY (_frametime < 16 ? 8 : 15) seems very random and it's effectively limiting the max framerates to 60-80fps.

This change implements a better solution:

  • Separates framerate control in strip.service() from FPS calculation in strip.show()
  • framerate calcutation considers all steps of rendering (drawing + brightness limiter + busses.show). The old code was only using the time after last "show" until beginning of next render cycle - so it artificially created too low framerates and random "stuttering" of effects.
  • Add an "unlimited" mode where all effects will render as fast as possible (limited to 333 fps to keep WiFi alive)

From user perspective:

  • smoothly running effects at all framerates
  • The "Target FPS" (LED settings) will be achieved (and not exceeded much) if effects can render fast enough.
  • setting Target FPS to 250 means "unlimited" (good for testing render performance)
  • -D WLEDMM_FASTPATH is needed for the new code
  • 8266 and non-fastpath builds are using the improved code, however with the old MIN_SHOW_DELAY that causes too many idle cycles

@softhack007 softhack007 added the enhancement New feature or request label Nov 1, 2024
upstream has renamed "now" to "showNow" - so we follow
based on feedback from the PR to upstream
* support "0 FPS" meaning "unlimited"
* keep FRAMETIME_FIXED fixed
@softhack007 softhack007 merged commit ebeff65 into mdev Nov 4, 2024
73 checks passed
@softhack007 softhack007 deleted the showtime branch November 4, 2024 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant