Proposal: Button Debounce

You’re correct that I do not mean homing. I have no idea where that came from.

I was not aware that endstops already perform debounce checks. It’s relevant to this discussion in it shows other places where that type of code is used.

I was specifically talking about klippy/extras/buttons.py. Which is used by other code.

The primary interest I have is the filament_switch_sensor. The Magneto X comes with this sketchy macro to make up for either a hardware / sensor tolerance issue or the stupid accelerations it is capable of triggering a false detection.

Looking through the code, filament_switch_sensor registers a button with a callback under the hood. That button code just seems like the logical place for debounce code to live, but I’m not that familiar with Klipper internals.

@mykepredko

Excluding everything that’s been said about how homing already, here’s a few links. Including multiple people using macros, and one manufacturer explicitly noting they implemented debounce on a separate microcontroller.

Edit:
I am aware that pull up resistors do not help with debounce, however that was the recommended solution in one of the discourse links I’ve provided. Which is why I noted it does not solve the problem.