make pin a bit less bouncy

This commit is contained in:
Dirk Moeller 2020-09-26 15:22:05 +02:00
parent 7d7f33cfa7
commit ed6e0ba367

View file

@ -578,7 +578,7 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) {
// Handle a custom user button if defined as part of a user-defined menu item // Handle a custom user button if defined as part of a user-defined menu item
#define HAS_CUSTOM_USER_BUTTON(N) ((defined(USER_GCODE_PIN_##N) && USER_GCODE_PIN_##N >= 0) && defined(USER_GCODE_PIN_STATE_##N) && defined(USER_GCODE_##N) && defined(USER_DESC_##N)) #define HAS_CUSTOM_USER_BUTTON(N) ((defined(USER_GCODE_PIN_##N) && USER_GCODE_PIN_##N >= 0) && defined(USER_GCODE_PIN_STATE_##N) && defined(USER_GCODE_##N) && defined(USER_DESC_##N))
#define CHECK_CUSTOM_USER_BUTTON(N) do{ \ #define CHECK_CUSTOM_USER_BUTTON(N) do{ \
constexpr millis_t CUB_DEBOUNCE_DELAY_##N = 1000UL; \ constexpr millis_t CUB_DEBOUNCE_DELAY_##N = 2000UL; \
static millis_t next_cub_ms_##N; \ static millis_t next_cub_ms_##N; \
if (USER_GCODE_PIN_STATE_##N == READ(USER_GCODE_PIN_##N)) { \ if (USER_GCODE_PIN_STATE_##N == READ(USER_GCODE_PIN_##N)) { \
const millis_t ms = millis(); \ const millis_t ms = millis(); \