Skip to content

Commit 52532da

Browse files
committed
🚸 Immediate Buttons and Menu Items (#28180)
1 parent 402aab9 commit 52532da

File tree

15 files changed

+158
-102
lines changed

15 files changed

+158
-102
lines changed

Marlin/Configuration_adv.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4123,22 +4123,27 @@
41234123
#define MAIN_MENU_ITEM_1_DESC "Home & UBL Info"
41244124
#define MAIN_MENU_ITEM_1_GCODE "G28\nG29 W"
41254125
//#define MAIN_MENU_ITEM_1_CONFIRM // Show a confirmation dialog before this action
4126+
//#define MAIN_MENU_ITEM_1_IMMEDIATE // Skip the queue and execute immediately. Rarely needed.
41264127

41274128
#define MAIN_MENU_ITEM_2_DESC "Preheat for " PREHEAT_1_LABEL
41284129
#define MAIN_MENU_ITEM_2_GCODE "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND)
41294130
//#define MAIN_MENU_ITEM_2_CONFIRM
4131+
//#define MAIN_MENU_ITEM_2_IMMEDIATE
41304132

41314133
//#define MAIN_MENU_ITEM_3_DESC "Preheat for " PREHEAT_2_LABEL
41324134
//#define MAIN_MENU_ITEM_3_GCODE "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND)
41334135
//#define MAIN_MENU_ITEM_3_CONFIRM
4136+
//#define MAIN_MENU_ITEM_3_IMMEDIATE
41344137

41354138
//#define MAIN_MENU_ITEM_4_DESC "Heat Bed/Home/Level"
41364139
//#define MAIN_MENU_ITEM_4_GCODE "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nG28\nG29"
41374140
//#define MAIN_MENU_ITEM_4_CONFIRM
4141+
//#define MAIN_MENU_ITEM_4_IMMEDIATE
41384142

41394143
//#define MAIN_MENU_ITEM_5_DESC "Home & Info"
41404144
//#define MAIN_MENU_ITEM_5_GCODE "G28\nM503"
41414145
//#define MAIN_MENU_ITEM_5_CONFIRM
4146+
//#define MAIN_MENU_ITEM_5_IMMEDIATE
41424147
#endif
41434148

41444149
// @section custom config menu
@@ -4155,22 +4160,27 @@
41554160
#define CONFIG_MENU_ITEM_1_DESC "Wifi ON"
41564161
#define CONFIG_MENU_ITEM_1_GCODE "M118 [ESP110] WIFI-STA pwd=12345678"
41574162
//#define CONFIG_MENU_ITEM_1_CONFIRM // Show a confirmation dialog before this action
4163+
//#define CONFIG_MENU_ITEM_1_IMMEDIATE // Skip the queue and execute immediately. Rarely needed.
41584164

41594165
#define CONFIG_MENU_ITEM_2_DESC "Bluetooth ON"
41604166
#define CONFIG_MENU_ITEM_2_GCODE "M118 [ESP110] BT pwd=12345678"
41614167
//#define CONFIG_MENU_ITEM_2_CONFIRM
4168+
//#define CONFIG_MENU_ITEM_2_IMMEDIATE
41624169

41634170
//#define CONFIG_MENU_ITEM_3_DESC "Radio OFF"
41644171
//#define CONFIG_MENU_ITEM_3_GCODE "M118 [ESP110] OFF pwd=12345678"
41654172
//#define CONFIG_MENU_ITEM_3_CONFIRM
4173+
//#define CONFIG_MENU_ITEM_3_IMMEDIATE
41664174

41674175
//#define CONFIG_MENU_ITEM_4_DESC "Wifi ????"
41684176
//#define CONFIG_MENU_ITEM_4_GCODE "M118 ????"
41694177
//#define CONFIG_MENU_ITEM_4_CONFIRM
4178+
//#define CONFIG_MENU_ITEM_4_IMMEDIATE
41704179

41714180
//#define CONFIG_MENU_ITEM_5_DESC "Wifi ????"
41724181
//#define CONFIG_MENU_ITEM_5_GCODE "M118 ????"
41734182
//#define CONFIG_MENU_ITEM_5_CONFIRM
4183+
//#define CONFIG_MENU_ITEM_5_IMMEDIATE
41744184
#endif
41754185

41764186
// @section custom buttons
@@ -4187,6 +4197,7 @@
41874197
#define BUTTON1_WHEN_PRINTING false // Button allowed to trigger during printing?
41884198
#define BUTTON1_GCODE "G28"
41894199
#define BUTTON1_DESC "Homing" // Optional string to set the LCD status
4200+
//#define BUTTON1_IMMEDIATE // Skip the queue and run the G-code immediately. Rarely needed.
41904201
#endif
41914202

41924203
//#define BUTTON2_PIN -1
@@ -4195,6 +4206,7 @@
41954206
#define BUTTON2_WHEN_PRINTING false
41964207
#define BUTTON2_GCODE "M140 S" STRINGIFY(PREHEAT_1_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_1_TEMP_HOTEND)
41974208
#define BUTTON2_DESC "Preheat for " PREHEAT_1_LABEL
4209+
//#define BUTTON2_IMMEDIATE
41984210
#endif
41994211

42004212
//#define BUTTON3_PIN -1
@@ -4203,6 +4215,7 @@
42034215
#define BUTTON3_WHEN_PRINTING false
42044216
#define BUTTON3_GCODE "M140 S" STRINGIFY(PREHEAT_2_TEMP_BED) "\nM104 S" STRINGIFY(PREHEAT_2_TEMP_HOTEND)
42054217
#define BUTTON3_DESC "Preheat for " PREHEAT_2_LABEL
4218+
//#define BUTTON3_IMMEDIATE
42064219
#endif
42074220
#endif
42084221

Marlin/src/HAL/HC32/inc/SanityCheck.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
#error "POSTMORTEM_DEBUGGING requires CORE_DISABLE_FAULT_HANDLER to be set."
8484
#endif
8585

86-
#if defined(PANIC_ENABLE)
86+
#ifdef PANIC_ENABLE
8787
#if defined(PANIC_USART1_TX_PIN) || defined(PANIC_USART2_TX_PIN) || defined(PANIC_USART3_TX_PIN) || defined(PANIC_USART3_TX_PIN)
8888
#error "HC32 HAL uses a custom panic handler. Do not define PANIC_USARTx_TX_PIN."
8989
#endif

Marlin/src/HAL/HC32/sysclock.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ void core_hook_sysclock_init() {
171171
panic("HRC is not 16 MHz");
172172
}
173173

174-
#if defined(BOARD_XTAL_FREQUENCY)
174+
#ifdef BOARD_XTAL_FREQUENCY
175175
#warning "No valid XTAL frequency defined, falling back to HRC."
176176
#endif
177177

Marlin/src/MarlinCore.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,11 +531,15 @@ inline void manage_inactivity(const bool no_stepper_sleep=false) {
531531
constexpr millis_t CUB_DEBOUNCE_DELAY_##N = 250UL; \
532532
static millis_t next_cub_ms_##N; \
533533
if (BUTTON##N##_HIT_STATE == READ(BUTTON##N##_PIN) \
534-
&& (ENABLED(BUTTON##N##_WHEN_PRINTING) || printer_not_busy)) { \
534+
&& (ENABLED(BUTTON##N##_WHEN_PRINTING) || printer_not_busy) \
535+
) { \
535536
if (ELAPSED(ms, next_cub_ms_##N)) { \
536537
next_cub_ms_##N = ms + CUB_DEBOUNCE_DELAY_##N; \
537538
CODE; \
538-
queue.inject(F(BUTTON##N##_GCODE)); \
539+
if (ENABLED(BUTTON##N##_IMMEDIATE)) \
540+
gcode.process_subcommands_now(F(BUTTON##N##_GCODE)); \
541+
else \
542+
queue.inject(F(BUTTON##N##_GCODE)); \
539543
TERN_(HAS_MARLINUI_MENU, ui.quick_feedback()); \
540544
} \
541545
} \

Marlin/src/inc/Conditionals-3-etc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,7 @@
452452
#endif
453453
#else
454454
// Clear probe pin settings when no probe is selected
455+
#undef Z_MIN_PROBE_PIN
455456
#undef Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN
456457
#undef Z_MIN_PROBE_ENDSTOP_HIT_STATE
457458
#undef USE_PROBE_FOR_Z_HOMING

0 commit comments

Comments
 (0)