avoid while printing
This commit is contained in:
parent
ed6e0ba367
commit
d292c9e9ea
2 changed files with 18 additions and 11 deletions
|
|
@ -3205,6 +3205,7 @@
|
|||
//#define USER_GCODE_PIN_1 -1 // PIN assigned to trigger USER_GCODE_1 execution
|
||||
#ifdef USER_GCODE_PIN_1
|
||||
#define USER_GCODE_PIN_STATE_1 LOW // What state should trigger USER_GCODE_1 execution (LOW or HIGH)
|
||||
#define USER_GCODE_PIN_TRIGGER_ALWAYS_1 false // PIN can trigger USER_GCODE_5 even if print job timer is running
|
||||
#endif
|
||||
|
||||
#define USER_DESC_2 "Preheat for " PREHEAT_1_LABEL
|
||||
|
|
@ -3212,6 +3213,7 @@
|
|||
//#define USER_GCODE_PIN_2 -1 // PIN assigned to trigger USER_GCODE_2 execution
|
||||
#ifdef USER_GCODE_PIN_2
|
||||
#define USER_GCODE_PIN_STATE_2 LOW // What state should trigger USER_GCODE_2 execution (LOW or HIGH)
|
||||
#define USER_GCODE_PIN_TRIGGER_ALWAYS_2 false // PIN can trigger USER_GCODE_5 even if print job timer is running
|
||||
#endif
|
||||
|
||||
#define USER_DESC_3 "Preheat for " PREHEAT_2_LABEL
|
||||
|
|
@ -3219,6 +3221,7 @@
|
|||
//#define USER_GCODE_PIN_3 -1 // PIN assigned to trigger USER_GCODE_3 execution
|
||||
#ifdef USER_GCODE_PIN_3
|
||||
#define USER_GCODE_PIN_STATE_3 LOW // What state should trigger USER_GCODE_3 execution (LOW or HIGH)
|
||||
#define USER_GCODE_PIN_TRIGGER_ALWAYS_3 false // PIN can trigger USER_GCODE_5 even if print job timer is running
|
||||
#endif
|
||||
|
||||
#define USER_DESC_4 "Heat Bed/Home/Level"
|
||||
|
|
@ -3226,6 +3229,7 @@
|
|||
//#define USER_GCODE_PIN_4 -1 // PIN assigned to trigger USER_GCODE_4 execution
|
||||
#ifdef USER_GCODE_PIN_4
|
||||
#define USER_GCODE_PIN_STATE_4 LOW // What state should trigger USER_GCODE_4 execution (LOW or HIGH)
|
||||
#define USER_GCODE_PIN_TRIGGER_ALWAYS_4 false // PIN can trigger USER_GCODE_5 even if print job timer is running
|
||||
#endif
|
||||
|
||||
#define USER_DESC_5 "Home & Info"
|
||||
|
|
@ -3233,6 +3237,7 @@
|
|||
//#define USER_GCODE_PIN_5 -1 // PIN assigned to trigger USER_GCODE_5 execution
|
||||
#ifdef USER_GCODE_PIN_5
|
||||
#define USER_GCODE_PIN_STATE_5 LOW // What state should trigger USER_GCODE_5 execution (LOW or HIGH)
|
||||
#define USER_GCODE_PIN_TRIGGER_ALWAYS_5 false // PIN can trigger USER_GCODE_5 even if print job timer is running
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -576,18 +576,20 @@ 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
|
||||
const bool printer_not_busy = !printingIsActive();
|
||||
#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{ \
|
||||
constexpr millis_t CUB_DEBOUNCE_DELAY_##N = 2000UL; \
|
||||
static millis_t next_cub_ms_##N; \
|
||||
if (USER_GCODE_PIN_STATE_##N == READ(USER_GCODE_PIN_##N)) { \
|
||||
const millis_t ms = millis(); \
|
||||
if (ELAPSED(ms, next_cub_ms_##N)) { \
|
||||
next_cub_ms_##N = ms + CUB_DEBOUNCE_DELAY_##N; \
|
||||
LCD_MESSAGEPGM_P(USER_DESC_##N); \
|
||||
queue.inject_P(USER_GCODE_##N); \
|
||||
} \
|
||||
} \
|
||||
#define CHECK_CUSTOM_USER_BUTTON(N) do{ \
|
||||
constexpr millis_t CUB_DEBOUNCE_DELAY_##N = 2000UL; \
|
||||
static millis_t next_cub_ms_##N; \
|
||||
if ((USER_GCODE_PIN_STATE_##N == READ(USER_GCODE_PIN_##N)) \
|
||||
&& (USER_GCODE_PIN_TRIGGER_ALWAYS_##N || printer_not_busy)) { \
|
||||
const millis_t ms = millis(); \
|
||||
if (ELAPSED(ms, next_cub_ms_##N)) { \
|
||||
next_cub_ms_##N = ms + CUB_DEBOUNCE_DELAY_##N; \
|
||||
LCD_MESSAGEPGM_P(USER_DESC_##N); \
|
||||
queue.inject_P(USER_GCODE_##N); \
|
||||
} \
|
||||
} \
|
||||
}while(0)
|
||||
|
||||
#if HAS_CUSTOM_USER_BUTTON(1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue