瀏覽代碼

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
Guðni Már Gilbert 2 年之前
父節點
當前提交
2216ba9fbf
共有 3 個文件被更改,包括 4 次插入13 次删除
  1. 4 5
      Firmware/Marlin_main.cpp
  2. 0 4
      Firmware/mmu2.cpp
  3. 0 4
      Firmware/mmu2.h

+ 4 - 5
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();

+ 0 - 4
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);
     }

+ 0 - 4
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;