From 2216ba9fbff8a57322ea3f5df5f885e81a2f9f5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=C3=B0ni=20M=C3=A1r=20Gilbert?= Date: Sat, 3 Sep 2022 12:13:26 +0000 Subject: [PATCH] M600: Ask for which slot to use when loading This fixes an issue where the assumed slot to use is unknown and the printer will hang on loading filament 100. Another good thing is this is an old user feature request which we have in our 3.12 milestone. Change in memory: Flash: +14 bytes SRAM: -1 bytes --- Firmware/Marlin_main.cpp | 9 ++++----- Firmware/mmu2.cpp | 4 ---- Firmware/mmu2.h | 4 ---- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index 6bf7c54e2..7a0c72548 100644 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -3512,8 +3512,8 @@ static void mmu_M600_unload_filament() { /// @brief load filament for mmu v2 /// @par nozzle_temp nozzle temperature to load filament static void mmu_M600_load_filament(bool automatic, float nozzle_temp) { - uint8_t tmp_extruder = MMU2::mmu2.get_previous_tool(); - + // TODO: Only ask for the slot if automatic/ SpoolJoin is off + uint8_t slot = choose_menu_P(_T(MSG_SELECT_EXTRUDER), _T(MSG_EXTRUDER)); // TODO SpoolJoin /*if (automatic) { tmp_extruder = ad_getAlternative(tmp_extruder); @@ -3522,12 +3522,11 @@ static void mmu_M600_load_filament(bool automatic, float nozzle_temp) { lcd_clear(); lcd_puts_at_P(0, 1, _T(MSG_LOADING_FILAMENT)); lcd_print(' '); - lcd_print(tmp_extruder + 1); + lcd_print(slot + 1); - // printf_P(PSTR("T code: %d \n"), tmp_extruder); setTargetHotend(nozzle_temp, active_extruder); - MMU2::mmu2.load_filament_to_nozzle(tmp_extruder); + MMU2::mmu2.load_filament_to_nozzle(slot); load_filament_final_feed(); // @@TODO verify st_synchronize(); diff --git a/Firmware/mmu2.cpp b/Firmware/mmu2.cpp index bcc8e6b0b..fd154c195 100644 --- a/Firmware/mmu2.cpp +++ b/Firmware/mmu2.cpp @@ -96,7 +96,6 @@ MMU2::MMU2() : is_mmu_error_monitor_active(false) , logic(&mmu2Serial) , extruder(MMU2_NO_TOOL) - , previous_extruder(MMU2_NO_TOOL) , tool_change_extruder(MMU2_NO_TOOL) , resume_position() , resume_hotend_temp(0) @@ -286,7 +285,6 @@ bool MMU2::tool_change(uint8_t index) { plan_set_e_position(current_position[E_AXIS]); extruder = index; //filament change is finished - previous_extruder = extruder; // @@TODO really report onto the serial? May be for the Octoprint? Not important now // SERIAL_ECHO_START(); @@ -319,7 +317,6 @@ bool MMU2::tool_change(char code, uint8_t slot) { logic.ToolChange(slot); manage_response(false, false); extruder = slot; - previous_extruder = extruder; set_extrude_min_temp(EXTRUDE_MINTEMP); } break; @@ -466,7 +463,6 @@ bool MMU2::load_filament_to_nozzle(uint8_t index) { execute_extruder_sequence((const E_Step *)load_to_nozzle_sequence, sizeof(load_to_nozzle_sequence) / sizeof (load_to_nozzle_sequence[0])); extruder = index; - previous_extruder = extruder; Sound_MakeSound(e_SOUND_TYPE_StandardConfirm); } diff --git a/Firmware/mmu2.h b/Firmware/mmu2.h index 7766234b6..88be8c7bc 100644 --- a/Firmware/mmu2.h +++ b/Firmware/mmu2.h @@ -146,9 +146,6 @@ public: /// @returns the active filament slot index (0-4) or 0xff in case of no active tool uint8_t get_current_tool() const; - /// @returns the previous active filament slot index (0-4) or 0xff in case of no active tool at boot-up - inline uint8_t get_previous_tool() const { return previous_extruder; }; - /// @returns The filament slot index (0 to 4) that will be loaded next, 0xff in case of no active tool change uint8_t get_tool_change_tool() const; @@ -257,7 +254,6 @@ private: ProtocolLogic logic; ///< implementation of the protocol logic layer uint8_t extruder; ///< currently active slot in the MMU ... somewhat... not sure where to get it from yet - uint8_t previous_extruder; ///< last active slot in the MMU, useful for M600 uint8_t tool_change_extruder; ///< only used for UI purposes xyz_pos_t resume_position;