ensure PIN_EXISTS

This commit is contained in:
Dirk Moeller 2020-06-22 21:36:57 +02:00
parent f798343b0f
commit 311ad9454b

View file

@ -577,7 +577,7 @@ inline void manage_inactivity(const bool ignore_stepper_queue=false) {
#if HAS_CUSTOM_USER_BUTTONS
// Handle a custom user button if defined as part of a user-defined menu item
// Debug macro on https://godbolt.org/z/SJDZmp
#define HAS_CUSTOM_USER_BUTTON(N) (defined(USER_GCODE_PIN_##N) && defined(USER_GCODE_PIN_STATE_##N) && defined(USER_GCODE_##N) && defined(USER_DESC_##N))
#define HAS_CUSTOM_USER_BUTTON(N) (PIN_EXISTS(USER_GCODE_PIN_##N) && defined(USER_GCODE_PIN_STATE_##N) && defined(USER_GCODE_##N) && defined(USER_DESC_##N))
#define CHECK_CUSTOM_USER_BUTTON(N) do{ \
constexpr millis_t CUB_DEBOUNCE_DELAY_##N = 1000UL; \
static millis_t next_cub_ms_##N; \
@ -1244,7 +1244,7 @@ void setup() {
#endif
#if HAS_CUSTOM_USER_BUTTONS
#define INIT_CUSTOM_USER_BUTTON_PINS(N) (ENABLED(USER_GCODE_PIN_INIT_##N) && defined(USER_GCODE_PIN_##N) && defined(USER_GCODE_PIN_STATE_##N))
#define INIT_CUSTOM_USER_BUTTON_PINS(N) (PIN_EXISTS(USER_GCODE_PIN_##N) && ENABLED(USER_GCODE_PIN_INIT_##N) && defined(USER_GCODE_PIN_STATE_##N))
#define INIT_CUSTOM_USER_BUTTON_PIN(N) do{ SET_INPUT(USER_GCODE_PIN_##N); WRITE(USER_GCODE_PIN_##N, !USER_GCODE_PIN_STATE_##N); }while(0)
#if INIT_CUSTOM_USER_BUTTON_PINS(1)