From 31238de93740870c6a5c2ac212ba931f0ebe39f5 Mon Sep 17 00:00:00 2001 From: Cory Ory Date: Mon, 5 Oct 2020 01:51:21 +0100 Subject: [PATCH] Allow bypass for cold E movement (#19606) --- Marlin/src/lcd/menu/menu_motion.cpp | 79 ++++++++++++++++++----------- buildroot/tests/mega1280-tests | 10 +--- buildroot/tests/mega2560-tests | 17 +++++-- 3 files changed, 62 insertions(+), 44 deletions(-) diff --git a/Marlin/src/lcd/menu/menu_motion.cpp b/Marlin/src/lcd/menu/menu_motion.cpp index 4e356b3e0c56..dff9895c6b64 100644 --- a/Marlin/src/lcd/menu/menu_motion.cpp +++ b/Marlin/src/lcd/menu/menu_motion.cpp @@ -170,11 +170,6 @@ void _goto_manual_move(const float scale) { void _menu_move_distance(const AxisEnum axis, const screenFunc_t func, const int8_t eindex=-1) { _manual_move_func_ptr = func; - #if ENABLED(PREVENT_COLD_EXTRUSION) - const bool too_cold = axis == E_AXIS && thermalManager.tooColdToExtrude(eindex >= 0 ? eindex : active_extruder); - #else - constexpr bool too_cold = false; - #endif START_MENU(); if (LCD_HEIGHT >= 4) { switch (axis) { @@ -187,35 +182,57 @@ void _menu_move_distance(const AxisEnum axis, const screenFunc_t func, const int break; } } - if (too_cold) - BACK_ITEM(MSG_HOTEND_TOO_COLD); - else { - BACK_ITEM(MSG_MOVE_AXIS); - SUBMENU(MSG_MOVE_10MM, []{ _goto_manual_move(10); }); - SUBMENU(MSG_MOVE_1MM, []{ _goto_manual_move( 1); }); - SUBMENU(MSG_MOVE_01MM, []{ _goto_manual_move( 0.1f); }); - if (axis == Z_AXIS && (SHORT_MANUAL_Z_MOVE) > 0.0f && (SHORT_MANUAL_Z_MOVE) < 0.1f) { - // Determine digits needed right of decimal - constexpr uint8_t digs = !UNEAR_ZERO((SHORT_MANUAL_Z_MOVE) * 1000 - int((SHORT_MANUAL_Z_MOVE) * 1000)) ? 4 : - !UNEAR_ZERO((SHORT_MANUAL_Z_MOVE) * 100 - int((SHORT_MANUAL_Z_MOVE) * 100)) ? 3 : 2; - PGM_P const label = GET_TEXT(MSG_MOVE_Z_DIST); - char tmp[strlen_P(label) + 10 + 1], numstr[10]; - sprintf_P(tmp, label, dtostrf(SHORT_MANUAL_Z_MOVE, 1, digs, numstr)); - - #if DISABLED(HAS_GRAPHICAL_TFT) - extern const char NUL_STR[]; - SUBMENU_P(NUL_STR, []{ _goto_manual_move(float(SHORT_MANUAL_Z_MOVE)); }); - MENU_ITEM_ADDON_START(0 + ENABLED(HAS_MARLINUI_HD44780)); - lcd_put_u8str(tmp); - MENU_ITEM_ADDON_END(); - #else - SUBMENU_P(tmp, []{ _goto_manual_move(float(SHORT_MANUAL_Z_MOVE)); }); - #endif - } + + BACK_ITEM(MSG_MOVE_AXIS); + SUBMENU(MSG_MOVE_10MM, []{ _goto_manual_move(10); }); + SUBMENU(MSG_MOVE_1MM, []{ _goto_manual_move( 1); }); + SUBMENU(MSG_MOVE_01MM, []{ _goto_manual_move( 0.1f); }); + if (axis == Z_AXIS && (SHORT_MANUAL_Z_MOVE) > 0.0f && (SHORT_MANUAL_Z_MOVE) < 0.1f) { + // Determine digits needed right of decimal + constexpr uint8_t digs = !UNEAR_ZERO((SHORT_MANUAL_Z_MOVE) * 1000 - int((SHORT_MANUAL_Z_MOVE) * 1000)) ? 4 : + !UNEAR_ZERO((SHORT_MANUAL_Z_MOVE) * 100 - int((SHORT_MANUAL_Z_MOVE) * 100)) ? 3 : 2; + PGM_P const label = GET_TEXT(MSG_MOVE_Z_DIST); + char tmp[strlen_P(label) + 10 + 1], numstr[10]; + sprintf_P(tmp, label, dtostrf(SHORT_MANUAL_Z_MOVE, 1, digs, numstr)); + + #if DISABLED(HAS_GRAPHICAL_TFT) + extern const char NUL_STR[]; + SUBMENU_P(NUL_STR, []{ _goto_manual_move(float(SHORT_MANUAL_Z_MOVE)); }); + MENU_ITEM_ADDON_START(0 + ENABLED(HAS_MARLINUI_HD44780)); + lcd_put_u8str(tmp); + MENU_ITEM_ADDON_END(); + #else + SUBMENU_P(tmp, []{ _goto_manual_move(float(SHORT_MANUAL_Z_MOVE)); }); + #endif } END_MENU(); } +#if E_MANUAL + + inline void _goto_menu_move_distance_e() { + ui.goto_screen([]{ _menu_move_distance(E_AXIS, []{ lcd_move_e(); }, -1); }); + } + + inline void _menu_move_distance_e_maybe() { + #if ENABLED(PREVENT_COLD_EXTRUSION) + const bool too_cold = thermalManager.tooColdToExtrude(active_extruder); + if (too_cold) { + ui.goto_screen([]{ + MenuItem_confirm::select_screen( + GET_TEXT(MSG_BUTTON_PROCEED), GET_TEXT(MSG_BACK), + _goto_menu_move_distance_e, ui.goto_previous_screen, + GET_TEXT(MSG_HOTEND_TOO_COLD), (const char *)nullptr, PSTR("!") + ); + }); + return; + } + #endif + _goto_menu_move_distance_e(); + } + +#endif // E_MANUAL + void menu_move() { START_MENU(); BACK_ITEM(MSG_MOTION); @@ -278,7 +295,7 @@ void menu_move() { #if E_MANUAL // The current extruder - SUBMENU(MSG_MOVE_E, []{ _menu_move_distance(E_AXIS, []{ lcd_move_e(); }, -1); }); + SUBMENU(MSG_MOVE_E, []{ _menu_move_distance_e_maybe(); }); #define SUBMENU_MOVE_E(N) SUBMENU_N(N, MSG_MOVE_EN, []{ _menu_move_distance(E_AXIS, []{ lcd_move_e(MenuItemBase::itemIndex); }, MenuItemBase::itemIndex); }); diff --git a/buildroot/tests/mega1280-tests b/buildroot/tests/mega1280-tests index 6bd9cda60562..ce13d4a6e8bb 100644 --- a/buildroot/tests/mega1280-tests +++ b/buildroot/tests/mega1280-tests @@ -52,16 +52,8 @@ exec_test $1 $2 "RAMPS | DELTA | RRD LCD | DELTA_AUTO_CALIBRATION | DELTA_CALIBR # Delta Config (generic) + ABL bilinear + BLTOUCH use_example_configs delta/generic opt_set LCD_LANGUAGE cz -opt_set X_DRIVER_TYPE L6470 -opt_set Y_DRIVER_TYPE L6470 -opt_set Z_DRIVER_TYPE L6470 -opt_add L6470_CHAIN_SCK_PIN 53 -opt_add L6470_CHAIN_MISO_PIN 49 -opt_add L6470_CHAIN_MOSI_PIN 40 -opt_add L6470_CHAIN_SS_PIN 42 -opt_add "ENABLE_RESET_L64XX_CHIPS(V) NOOP" opt_enable REPRAP_DISCOUNT_SMART_CONTROLLER DELTA_CALIBRATION_MENU AUTO_BED_LEVELING_BILINEAR BLTOUCH -exec_test $1 $2 "DELTA | L6470 | RRD LCD | ABL Bilinear | BLTOUCH" +exec_test $1 $2 "DELTA | RRD LCD | ABL Bilinear | BLTOUCH" # clean up restore_configs diff --git a/buildroot/tests/mega2560-tests b/buildroot/tests/mega2560-tests index a3920b94688c..4dd03984a58c 100755 --- a/buildroot/tests/mega2560-tests +++ b/buildroot/tests/mega2560-tests @@ -256,13 +256,22 @@ exec_test $1 $2 "Full-featured CR-10S config" #exec_test $1 $2 "Stuff" # -# Delta Config (generic) + UBL + ALLEN_KEY + OLED_PANEL_TINYBOY2 + EEPROM_SETTINGS +# Delta Config (generic) + UBL + ALLEN_KEY + EEPROM_SETTINGS + OLED_PANEL_TINYBOY2 # use_example_configs delta/generic +opt_enable RESTORE_LEVELING_AFTER_G28 EEPROM_SETTINGS EEPROM_CHITCHAT \ + Z_PROBE_ALLEN_KEY AUTO_BED_LEVELING_UBL \ + OLED_PANEL_TINYBOY2 MESH_EDIT_GFX_OVERLAY DELTA_CALIBRATION_MENU opt_set LCD_LANGUAGE ko_KR -opt_enable AUTO_BED_LEVELING_UBL RESTORE_LEVELING_AFTER_G28 Z_PROBE_ALLEN_KEY EEPROM_SETTINGS EEPROM_CHITCHAT \ - OLED_PANEL_TINYBOY2 MESH_EDIT_GFX_OVERLAY -exec_test $1 $2 "RAMPS | DELTA | OLED_PANEL_TINYBOY2 | UBL | Allen Key | EEPROM" +opt_set X_DRIVER_TYPE L6470 +opt_set Y_DRIVER_TYPE L6470 +opt_set Z_DRIVER_TYPE L6470 +opt_add L6470_CHAIN_SCK_PIN 53 +opt_add L6470_CHAIN_MISO_PIN 49 +opt_add L6470_CHAIN_MOSI_PIN 40 +opt_add L6470_CHAIN_SS_PIN 42 +opt_add "ENABLE_RESET_L64XX_CHIPS(V) NOOP" +exec_test $1 $2 "DELTA, RAMPS, L6470, UBL, Allen Key, EEPROM, OLED_PANEL_TINYBOY2..." # # Delta Config (FLSUN AC because it's complex)