Browse Source

🚸 Use M600 for disabled MMU (#21865)

Giuliano Zaro 3 years ago
parent
commit
1dd9adbfe4
No account linked to committer's email address
3 changed files with 34 additions and 31 deletions
  1. 4
    1
      Marlin/src/MarlinCore.cpp
  2. 4
    11
      Marlin/src/feature/pause.h
  3. 26
    19
      Marlin/src/gcode/feature/pause/M600.cpp

+ 4
- 1
Marlin/src/MarlinCore.cpp View File

784
   (void)check_tool_sensor_stats(active_extruder, true);
784
   (void)check_tool_sensor_stats(active_extruder, true);
785
 
785
 
786
   // Handle filament runout sensors
786
   // Handle filament runout sensors
787
-  TERN_(HAS_FILAMENT_SENSOR, runout.run());
787
+  #if HAS_FILAMENT_SENSOR
788
+    if (TERN1(HAS_PRUSA_MMU2, !mmu2.enabled()))
789
+      runout.run();
790
+  #endif
788
 
791
 
789
   // Run HAL idle tasks
792
   // Run HAL idle tasks
790
   TERN_(HAL_IDLETASK, HAL_idletask());
793
   TERN_(HAL_IDLETASK, HAL_idletask());

+ 4
- 11
Marlin/src/feature/pause.h View File

73
 
73
 
74
 extern uint8_t did_pause_print;
74
 extern uint8_t did_pause_print;
75
 
75
 
76
-#if ENABLED(DUAL_X_CARRIAGE)
77
-  #define DXC_PARAMS , const int8_t DXC_ext=-1
78
-  #define DXC_ARGS   , const int8_t DXC_ext
79
-  #define DXC_PASS   , DXC_ext
80
-  #define DXC_SAY    , " dxc:", int(DXC_ext)
81
-#else
82
-  #define DXC_PARAMS
83
-  #define DXC_ARGS
84
-  #define DXC_PASS
85
-  #define DXC_SAY
86
-#endif
76
+#define DXC_PARAMS OPTARG(DUAL_X_CARRIAGE, const int8_t DXC_ext=-1)
77
+#define DXC_ARGS   OPTARG(DUAL_X_CARRIAGE, const int8_t DXC_ext)
78
+#define DXC_PASS   OPTARG(DUAL_X_CARRIAGE, DXC_ext)
79
+#define DXC_SAY    OPTARG(DUAL_X_CARRIAGE, " dxc:", int(DXC_ext))
87
 
80
 
88
 // Pause the print. If unload_length is set, do a Filament Unload
81
 // Pause the print. If unload_length is set, do a Filament Unload
89
 bool pause_print(
82
 bool pause_print(

+ 26
- 19
Marlin/src/gcode/feature/pause/M600.cpp View File

34
   #include "../../../module/tool_change.h"
34
   #include "../../../module/tool_change.h"
35
 #endif
35
 #endif
36
 
36
 
37
-#if ENABLED(MMU2_MENUS)
38
-  #include "../../../lcd/menu/menu_mmu2.h"
37
+#if ENABLED(HAS_PRUSA_MMU2)
38
+  #include "../../../feature/mmu/mmu2.h"
39
+  #if ENABLED(MMU2_MENUS)
40
+    #include "../../../lcd/menu/menu_mmu2.h"
41
+  #endif
39
 #endif
42
 #endif
40
 
43
 
41
 #if ENABLED(MIXING_EXTRUDER)
44
 #if ENABLED(MIXING_EXTRUDER)
92
     }
95
     }
93
   #endif
96
   #endif
94
 
97
 
98
+  const bool standardM600 = TERN1(MMU2_MENUS, !mmu2.enabled());
99
+
95
   // Show initial "wait for start" message
100
   // Show initial "wait for start" message
96
-  #if DISABLED(MMU2_MENUS)
101
+  if (standardM600)
97
     ui.pause_show_message(PAUSE_MESSAGE_CHANGING, PAUSE_MODE_PAUSE_PRINT, target_extruder);
102
     ui.pause_show_message(PAUSE_MESSAGE_CHANGING, PAUSE_MODE_PAUSE_PRINT, target_extruder);
98
-  #endif
99
 
103
 
100
   #if ENABLED(HOME_BEFORE_FILAMENT_CHANGE)
104
   #if ENABLED(HOME_BEFORE_FILAMENT_CHANGE)
101
     // If needed, home before parking for filament change
105
     // If needed, home before parking for filament change
126
   #endif
130
   #endif
127
 
131
 
128
   #if ENABLED(MMU2_MENUS)
132
   #if ENABLED(MMU2_MENUS)
129
-    // For MMU2 reset retract and load/unload values so they don't mess with MMU filament handling
130
-    constexpr float unload_length = 0.5f,
131
-                    slow_load_length = 0.0f,
132
-                    fast_load_length = 0.0f;
133
+    // For MMU2, when enabled, reset retract value so it doesn't mess with MMU filament handling
134
+    const float unload_length = standardM600 ? -ABS(parser.axisunitsval('U', E_AXIS, fc_settings[active_extruder].unload_length)) : 0.5f;
133
   #else
135
   #else
134
     // Unload filament
136
     // Unload filament
135
     const float unload_length = -ABS(parser.axisunitsval('U', E_AXIS, fc_settings[active_extruder].unload_length));
137
     const float unload_length = -ABS(parser.axisunitsval('U', E_AXIS, fc_settings[active_extruder].unload_length));
136
-    // Slow load filament
137
-    constexpr float slow_load_length = FILAMENT_CHANGE_SLOW_LOAD_LENGTH;
138
-    // Fast load filament
139
-    const float fast_load_length = ABS(parser.axisunitsval('L', E_AXIS, fc_settings[active_extruder].load_length));
140
   #endif
138
   #endif
141
 
139
 
142
   const int beep_count = parser.intval('B', -1
140
   const int beep_count = parser.intval('B', -1
146
   );
144
   );
147
 
145
 
148
   if (pause_print(retract, park_point, true, unload_length DXC_PASS)) {
146
   if (pause_print(retract, park_point, true, unload_length DXC_PASS)) {
149
-    #if ENABLED(MMU2_MENUS)
150
-      mmu2_M600();
151
-      resume_print(slow_load_length, fast_load_length, 0, beep_count DXC_PASS);
152
-    #else
147
+    if (standardM600) {
153
       wait_for_confirmation(true, beep_count DXC_PASS);
148
       wait_for_confirmation(true, beep_count DXC_PASS);
154
-      resume_print(slow_load_length, fast_load_length, ADVANCED_PAUSE_PURGE_LENGTH,
155
-                   beep_count, (parser.seenval('R') ? parser.value_celsius() : 0) DXC_PASS);
156
-    #endif
149
+      resume_print(
150
+        FILAMENT_CHANGE_SLOW_LOAD_LENGTH,
151
+        ABS(parser.axisunitsval('L', E_AXIS, fc_settings[active_extruder].load_length)),
152
+        ADVANCED_PAUSE_PURGE_LENGTH,
153
+        beep_count,
154
+        parser.celsiusval('R')
155
+        DXC_PASS
156
+      );
157
+    }
158
+    else {
159
+      #if ENABLED(MMU2_MENUS)
160
+        mmu2_M600();
161
+        resume_print(0, 0, 0, beep_count, 0 DXC_PASS);
162
+      #endif
163
+    }
157
   }
164
   }
158
 
165
 
159
   #if HAS_MULTI_EXTRUDER
166
   #if HAS_MULTI_EXTRUDER

Loading…
Cancel
Save