SYSTEM ONLINE *** WELCOME, TRAVELER *** 38911 BASIC BYTES FREE

Debouncing a joystick fire button in software

3 replies · opened JUL 31 ago

ORIGINAL TRANSMISSION
The replacement switch is electrically noisy and a single press sometimes becomes two menu selections. Hardware repair is planned, but I want the menu code to behave too.

Is one clean-then-release state enough, or do you also wait a few frames?
REPLY #1
For menus I require release before accepting another press. It feels natural and avoids guessing at a delay.
REPLY #2
Sample once per frame and track the transition, not the held state. A short stability count can help truly bad switches.
REPLY #3
Fix the switch anyway. Code can make a tired button polite, not healthy.

Want to add to this transmission?

SIGN IN TO REPLY →