From 6508b98ab85ee3233a15f7d6508f4814c9175a51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Ma=C5=82ecki?= Date: Mon, 8 May 2023 21:30:24 +0200 Subject: [PATCH] Leave user's MMU-loaded filament loaded after first layer cal Presently, if user runs the first layer calibration with the filament that's been loaded into the nozzle by MMU, this filament will be unloaded after the calibration is complete. This behavior seems unexpected from user experience point of view: if you load a filament into the nozzle and proceed to first layer calibration, you did so for a reason and probably don't want it unloaded after the first try (just like you wouldn't want it unloaded if you did so without the MMU). Any other filament that's not been previously loaded into the nozzle is fair game to unload (as it was before). --- Firmware/first_lay_cal.cpp | 6 +++--- Firmware/first_lay_cal.h | 2 +- Firmware/ultralcd.cpp | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Firmware/first_lay_cal.cpp b/Firmware/first_lay_cal.cpp index 65ceaf6789..95dc102b84 100644 --- a/Firmware/first_lay_cal.cpp +++ b/Firmware/first_lay_cal.cpp @@ -66,7 +66,7 @@ void lay1cal_wait_preheat() //! @brief Load filament //! @param cmd_buffer character buffer needed to format gcodes //! @param filament filament to use (applies for MMU only) -//! @returns true if extra purge distance is needed in case of MMU prints (after a toolchange), otherwise false +//! @returns true if filament has been changed (therefore an extra purge distance is needed in case of MMU prints), otherwise false bool lay1cal_load_filament(uint8_t filament) { if (MMU2::mmu2.Enabled()) @@ -225,7 +225,7 @@ void lay1cal_square(uint8_t step, float layer_height, float extrusion_width) } } -void lay1cal_finish(bool mmu_enabled) +void lay1cal_finish(bool unload_filament) { static const char cmd_cal_finish_1[] PROGMEM = "G1 E-0.075 F2100"; //retract static const char cmd_cal_finish_2[] PROGMEM = "M104 S0"; // turn off temperature @@ -245,6 +245,6 @@ void lay1cal_finish(bool mmu_enabled) lay1cal_common_enqueue_loop(cmd_cal_finish, (sizeof(cmd_cal_finish)/sizeof(cmd_cal_finish[0]))); - if (mmu_enabled) enquecommand_P(MSG_M702); //unload from nozzle + if (unload_filament) enquecommand_P(MSG_M702); //unload from nozzle enquecommand_P(MSG_M84);// disable motors } diff --git a/Firmware/first_lay_cal.h b/Firmware/first_lay_cal.h index 1e2dd624a0..c1c12925a3 100644 --- a/Firmware/first_lay_cal.h +++ b/Firmware/first_lay_cal.h @@ -13,6 +13,6 @@ void lay1cal_before_meander(); void lay1cal_meander_start(float layer_height, float extrusion_width); void lay1cal_meander(float layer_height, float extrusion_width); void lay1cal_square(uint8_t step, float layer_height, float extrusion_width); -void lay1cal_finish(bool mmu_enabled); +void lay1cal_finish(bool unload_filament); #endif /* FIRMWARE_FIRST_LAY_CAL_H_ */ diff --git a/Firmware/ultralcd.cpp b/Firmware/ultralcd.cpp index eafcb26e7e..d421a48a15 100644 --- a/Firmware/ultralcd.cpp +++ b/Firmware/ultralcd.cpp @@ -67,7 +67,7 @@ int8_t SilentModeMenu = SILENT_MODE_OFF; LcdCommands lcd_commands_type = LcdCommands::Idle; static uint8_t lcd_commands_step = 0; -static bool extraPurgeNeeded = false; ///< lcd_commands - detect if extra purge after MMU-toolchange is necessary or not +static bool filament_changed = false; ///< lcd_commands - detect if extra purge after MMU-toolchange is necessary or not CustomMsg custom_message_type = CustomMsg::Status; uint8_t custom_message_state = 0; @@ -807,13 +807,13 @@ void lcd_commands() lay1cal_wait_preheat(); break; case 11: - extraPurgeNeeded = lay1cal_load_filament(lay1cal_filament); + filament_changed = lay1cal_load_filament(lay1cal_filament); break; case 10: lcd_clear(); menu_depth = 0; menu_submenu(lcd_babystep_z, true); - lay1cal_intro_line(extraPurgeNeeded, layer_height, extrusion_width); + lay1cal_intro_line(filament_changed, layer_height, extrusion_width); break; case 9: lay1cal_before_meander(); @@ -837,7 +837,7 @@ void lcd_commands() lay1cal_square(12, layer_height, extrusion_width); break; case 2: - lay1cal_finish(MMU2::mmu2.Enabled()); + lay1cal_finish(MMU2::mmu2.Enabled() && filament_changed); break; case 1: lcd_setstatuspgm(MSG_WELCOME);