From 8d0431649770fb560666263b56b50c582ccac83c Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Wed, 21 Apr 2021 19:07:58 +0200 Subject: [PATCH] Revert/cleanup mininum extruder height during M600 This change restores the minimum extruder height for filament purge during M600 from the current 50mm back to 27mm from FW 3.9. We do this by introducing a new option for unload_filament() to indicate that the unload is part of an automatic swap, and in such cases avoid raising more than absolutely necessary (this will _also_ come in handy to avoid the extra purge in PR #2318 during M600). A new define MIN_Z_FOR_SWAP is introduced for this purpose. MIN_Z_FOR_UNLOAD is still used for manual lcd unload and for M702 and hasn't been changed. --- Firmware/Configuration.h | 7 ++++--- Firmware/Marlin_main.cpp | 2 +- Firmware/ultralcd.cpp | 9 +++++---- Firmware/ultralcd.h | 2 +- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Firmware/Configuration.h b/Firmware/Configuration.h index a6c89c88..ef359f39 100644 --- a/Firmware/Configuration.h +++ b/Firmware/Configuration.h @@ -551,9 +551,10 @@ enum CalibrationStatus // Try to maintain a minimum distance from the bed even when Z is // unknown when doing the following operations -#define MIN_Z_FOR_LOAD 50 -#define MIN_Z_FOR_UNLOAD 50 -#define MIN_Z_FOR_PREHEAT 10 +#define MIN_Z_FOR_LOAD 50 // lcd filament loading or autoload +#define MIN_Z_FOR_UNLOAD 50 // lcd filament unloading +#define MIN_Z_FOR_SWAP 27 // filament change (including M600) +#define MIN_Z_FOR_PREHEAT 10 // lcd preheat #include "Configuration_adv.h" #include "thermistortables.h" diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 68933093..f7e8a43d 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -3676,7 +3676,7 @@ static void gcode_M600(bool automatic, float x_position, float y_position, float // Unload filament if (mmu_enabled) extr_unload(); //unload just current filament for multimaterial printers (used also in M702) - else unload_filament(); //unload filament for single material (used also in M702) + else unload_filament(true); //unload filament for single material (used also in M702) //finish moves st_synchronize(); diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index 3e765a5c..5e085f90 100755 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -4885,7 +4885,7 @@ void lcd_wizard(WizState state) lcd_display_message_fullscreen_P(_i("Now I will preheat nozzle for PLA.")); wait_preheat(); //unload current filament - unload_filament(); + unload_filament(true); //load filament lcd_wizard_load(); setTargetHotend(0, 0); //we are finished, cooldown nozzle @@ -6200,13 +6200,14 @@ static void change_extr_menu(){ } #endif //SNMM -//unload filament for single material printer (used in M702 gcode) -void unload_filament() +// unload filament for single material printer (used in M702 gcode) +// @param automatic: If true, unload_filament is part of a unload+load sequence (M600) +void unload_filament(bool automatic) { custom_message_type = CustomMsg::FilamentLoading; lcd_setstatuspgm(_T(MSG_UNLOADING_FILAMENT)); - raise_z_above(MIN_Z_FOR_UNLOAD); + raise_z_above(automatic? MIN_Z_FOR_SWAP: MIN_Z_FOR_UNLOAD); // extr_unload2(); diff --git a/Firmware/ultralcd.h b/Firmware/ultralcd.h index 008a106e..c671326e 100755 --- a/Firmware/ultralcd.h +++ b/Firmware/ultralcd.h @@ -195,7 +195,7 @@ extern bool bFilamentAction; void mFilamentItem(uint16_t nTemp,uint16_t nTempBed); void mFilamentItemForce(); void lcd_generic_preheat_menu(); -void unload_filament(); +void unload_filament(bool automatic = false); void stack_error(); void lcd_printer_connected();