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

Turbo updates #863

Merged
Merged

Conversation

FeralAI
Copy link
Contributor

@FeralAI FeralAI commented Feb 24, 2024

This PR addresses several minor issues with the turbo addon. It integrates #857 as well for better consitency in turbo toggle and activations. Includes:

  • Turbo rate was running 1/2 speed as reported in Turbo rate is half of what is expected #853.
  • Suppress input when turbo options are being changed via turbo button hotkey
  • Various turbo precision updates
    • Updated turbo addon to track runtime in micros instead of millis
    • Applied slight offset to runtime check to compensate for loop run variance
    • Moved turbo toggle checks right before button state changes are applied
  • Moved turbo addon toward the end of the addon list since it overrides several of the input addons
  • Minor performance updates
    • Move pin checks to setup and cache enable flags for features requiring those pins (turbo button, ADC dial, shmup buttons)
    • Cache pin masks for button check in the process() method
  • Centralized interval calculation, was in 2 spots
  • Fixed bug with Turbo ADC reads where it was constantly writing to flash, should address turbo for adc problem #843
  • Throttled Turbo ADC reads to every 100ms since it's a non-essential input
  • Updated Turbo LED states
  • Fixed issue where the first turbo button press wouldn't register immediately due to waiting on the background timer
  • Updated default turbo rate to 10 shots per second

bsstephan and others added 9 commits February 23, 2024 13:18
a couple classes had their own debouncer or reference to the gamepad
debouncer. this seemed inefficient and caused potential for incongruent
behavior, thinking that instead we should just debounce the GPIO pins
(for buttons). this does that. this doesn't yet clean up all the code
(specifically the old debouncer) but it does get everything on the new
debouncer.

things appear to work as before, maybe they solve some debouncing
problems for folks, work to be done
this fixes boot time shortcuts that were broken by my refactor
the previous debouncer logic would try to only wait for the
debounceDelay on button depresses, IIRC in an attempt to get the real
button press immediately, but the more I look at it, the more I come to
the same conclusion as Feral that such logic is flawed, and will
register flapping switches because it's eagerly not debouncing them.

with this change, button presses only register if it's been
debounceDelay (default 5ms) since the last change. buttons will still
register immediately as long as the delay has been met, so in practice
this may only affect a latency tester and some kind of superhuman who
mashes buttons at sub-5ms speeds.

this applies Feral's logic (from the button debouncer) to the refactored
pin debouncer.

Co-authored-by: FeralAI <[email protected]>
@FeralAI FeralAI mentioned this pull request Feb 25, 2024
4 tasks
@FeralAI FeralAI marked this pull request as ready for review February 26, 2024 02:38
Copy link
Contributor

@arntsonl arntsonl left a comment

Choose a reason for hiding this comment

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

Looks awesome!

src/addons/turbo.cpp Show resolved Hide resolved
@arntsonl arntsonl merged commit 165a136 into OpenStickCommunity:main Feb 27, 2024
30 checks passed
@FeralAI FeralAI deleted the bugfix/20240223_turbo_updates branch February 28, 2024 00:49
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