Browse Source

Split up tool_change for some setups

Scott Lahteine 7 years ago
parent
commit
d1734a089a
1 changed files with 230 additions and 215 deletions
  1. 230
    215
      Marlin/src/module/tool_change.cpp

+ 230
- 215
Marlin/src/module/tool_change.cpp View File

@@ -115,8 +115,114 @@
115 115
     #endif
116 116
   }
117 117
 
118
-#endif // PARKING_EXTRUDER
118
+  inline void parking_extruder_tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool no_move/*=false*/) {
119
+    constexpr float z_raise = PARKING_EXTRUDER_SECURITY_RAISE;
120
+
121
+    if (!no_move) {
122
+
123
+      const float parkingposx[] = PARKING_EXTRUDER_PARKING_X,
124
+                  midpos = (parkingposx[0] + parkingposx[1]) * 0.5 + hotend_offset[X_AXIS][active_extruder],
125
+                  grabpos = parkingposx[tmp_extruder] + hotend_offset[X_AXIS][active_extruder]
126
+                            + (tmp_extruder == 0 ? -(PARKING_EXTRUDER_GRAB_DISTANCE) : PARKING_EXTRUDER_GRAB_DISTANCE);
127
+      /**
128
+       *  Steps:
129
+       *    1. Raise Z-Axis to give enough clearance
130
+       *    2. Move to park position of old extruder
131
+       *    3. Disengage magnetic field, wait for delay
132
+       *    4. Move near new extruder
133
+       *    5. Engage magnetic field for new extruder
134
+       *    6. Move to parking incl. offset of new extruder
135
+       *    7. Lower Z-Axis
136
+       */
137
+
138
+      // STEP 1
139
+      #if ENABLED(DEBUG_LEVELING_FEATURE)
140
+        SERIAL_ECHOLNPGM("Starting Autopark");
141
+        if (DEBUGGING(LEVELING)) DEBUG_POS("current position:", current_position);
142
+      #endif
143
+      current_position[Z_AXIS] += z_raise;
144
+      #if ENABLED(DEBUG_LEVELING_FEATURE)
145
+        SERIAL_ECHOLNPGM("(1) Raise Z-Axis ");
146
+        if (DEBUGGING(LEVELING)) DEBUG_POS("Moving to Raised Z-Position", current_position);
147
+      #endif
148
+      planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[Z_AXIS], active_extruder);
149
+      stepper.synchronize();
150
+
151
+      // STEP 2
152
+      current_position[X_AXIS] = parkingposx[active_extruder] + hotend_offset[X_AXIS][active_extruder];
153
+      #if ENABLED(DEBUG_LEVELING_FEATURE)
154
+        SERIAL_ECHOLNPAIR("(2) Park extruder ", active_extruder);
155
+        if (DEBUGGING(LEVELING)) DEBUG_POS("Moving ParkPos", current_position);
156
+      #endif
157
+      planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[X_AXIS], active_extruder);
158
+      stepper.synchronize();
159
+
160
+      // STEP 3
161
+      #if ENABLED(DEBUG_LEVELING_FEATURE)
162
+        SERIAL_ECHOLNPGM("(3) Disengage magnet ");
163
+      #endif
164
+      pe_deactivate_magnet(active_extruder);
165
+
166
+      // STEP 4
167
+      #if ENABLED(DEBUG_LEVELING_FEATURE)
168
+        SERIAL_ECHOLNPGM("(4) Move to position near new extruder");
169
+      #endif
170
+      current_position[X_AXIS] += (active_extruder == 0 ? 10 : -10); // move 10mm away from parked extruder
171
+
172
+      #if ENABLED(DEBUG_LEVELING_FEATURE)
173
+        if (DEBUGGING(LEVELING)) DEBUG_POS("Moving away from parked extruder", current_position);
174
+      #endif
175
+      planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[X_AXIS], active_extruder);
176
+      stepper.synchronize();
119 177
 
178
+      // STEP 5
179
+      #if ENABLED(DEBUG_LEVELING_FEATURE)
180
+        SERIAL_ECHOLNPGM("(5) Engage magnetic field");
181
+      #endif
182
+
183
+      #if ENABLED(PARKING_EXTRUDER_SOLENOIDS_INVERT)
184
+        pe_activate_magnet(active_extruder); //just save power for inverted magnets
185
+      #endif
186
+      pe_activate_magnet(tmp_extruder);
187
+
188
+      // STEP 6
189
+      current_position[X_AXIS] = grabpos + (tmp_extruder == 0 ? (+10) : (-10));
190
+      planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[X_AXIS], active_extruder);
191
+      current_position[X_AXIS] = grabpos;
192
+      #if ENABLED(DEBUG_LEVELING_FEATURE)
193
+        SERIAL_ECHOLNPAIR("(6) Unpark extruder ", tmp_extruder);
194
+        if (DEBUGGING(LEVELING)) DEBUG_POS("Move UnparkPos", current_position);
195
+      #endif
196
+      planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[X_AXIS]/2, active_extruder);
197
+      stepper.synchronize();
198
+
199
+      // Step 7
200
+      current_position[X_AXIS] = midpos - hotend_offset[X_AXIS][tmp_extruder];
201
+      #if ENABLED(DEBUG_LEVELING_FEATURE)
202
+        SERIAL_ECHOLNPGM("(7) Move midway between hotends");
203
+        if (DEBUGGING(LEVELING)) DEBUG_POS("Move midway to new extruder", current_position);
204
+      #endif
205
+      planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[X_AXIS], active_extruder);
206
+      stepper.synchronize();
207
+      #if ENABLED(DEBUG_LEVELING_FEATURE)
208
+        SERIAL_ECHOLNPGM("Autopark done.");
209
+      #endif
210
+    }
211
+    else { // nomove == true
212
+      // Only engage magnetic field for new extruder
213
+      pe_activate_magnet(tmp_extruder);
214
+      #if ENABLED(PARKING_EXTRUDER_SOLENOIDS_INVERT)
215
+        pe_activate_magnet(active_extruder); // Just save power for inverted magnets
216
+      #endif
217
+    }
218
+    current_position[Z_AXIS] += hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder];
219
+
220
+    #if ENABLED(DEBUG_LEVELING_FEATURE)
221
+      if (DEBUGGING(LEVELING)) DEBUG_POS("Applying Z-offset", current_position);
222
+    #endif
223
+  }
224
+
225
+#endif // PARKING_EXTRUDER
120 226
 
121 227
 inline void invalid_extruder_error(const uint8_t e) {
122 228
   SERIAL_ECHO_START();
@@ -126,19 +232,132 @@ inline void invalid_extruder_error(const uint8_t e) {
126 232
   SERIAL_ECHOLNPGM(MSG_INVALID_EXTRUDER);
127 233
 }
128 234
 
129
-/**
130
- * Perform a tool-change, which may result in moving the
131
- * previous tool out of the way and the new tool into place.
132
- */
133
-void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool no_move/*=false*/) {
134
-  #if ENABLED(MIXING_EXTRUDER) && MIXING_VIRTUAL_TOOLS > 1
235
+#if ENABLED(MIXING_EXTRUDER) && MIXING_VIRTUAL_TOOLS > 1
135 236
 
237
+  inline void mixing_tool_change(const uint8_t tmp_extruder) {
136 238
     if (tmp_extruder >= MIXING_VIRTUAL_TOOLS)
137 239
       return invalid_extruder_error(tmp_extruder);
138 240
 
139 241
     // T0-Tnnn: Switch virtual tool by changing the mix
140 242
     for (uint8_t j = 0; j < MIXING_STEPPERS; j++)
141 243
       mixing_factor[j] = mixing_virtual_tool_mix[tmp_extruder][j];
244
+  }
245
+
246
+#endif // MIXING_EXTRUDER && MIXING_VIRTUAL_TOOLS > 1
247
+
248
+#if ENABLED(DUAL_X_CARRIAGE)
249
+
250
+  inline void dualx_tool_change(const uint8_t tmp_extruder, bool &no_move) {
251
+    #if ENABLED(DEBUG_LEVELING_FEATURE)
252
+      if (DEBUGGING(LEVELING)) {
253
+        SERIAL_ECHOPGM("Dual X Carriage Mode ");
254
+        switch (dual_x_carriage_mode) {
255
+          case DXC_FULL_CONTROL_MODE: SERIAL_ECHOLNPGM("DXC_FULL_CONTROL_MODE"); break;
256
+          case DXC_AUTO_PARK_MODE: SERIAL_ECHOLNPGM("DXC_AUTO_PARK_MODE"); break;
257
+          case DXC_DUPLICATION_MODE: SERIAL_ECHOLNPGM("DXC_DUPLICATION_MODE"); break;
258
+        }
259
+      }
260
+    #endif
261
+
262
+    const float xhome = x_home_pos(active_extruder);
263
+    if (dual_x_carriage_mode == DXC_AUTO_PARK_MODE
264
+        && IsRunning()
265
+        && (delayed_move_time || current_position[X_AXIS] != xhome)
266
+    ) {
267
+      float raised_z = current_position[Z_AXIS] + TOOLCHANGE_PARK_ZLIFT;
268
+      #if ENABLED(MAX_SOFTWARE_ENDSTOPS)
269
+        NOMORE(raised_z, soft_endstop_max[Z_AXIS]);
270
+      #endif
271
+      #if ENABLED(DEBUG_LEVELING_FEATURE)
272
+        if (DEBUGGING(LEVELING)) {
273
+          SERIAL_ECHOLNPAIR("Raise to ", raised_z);
274
+          SERIAL_ECHOLNPAIR("MoveX to ", xhome);
275
+          SERIAL_ECHOLNPAIR("Lower to ", current_position[Z_AXIS]);
276
+        }
277
+      #endif
278
+      // Park old head: 1) raise 2) move to park position 3) lower
279
+      for (uint8_t i = 0; i < 3; i++)
280
+        planner.buffer_line(
281
+          i == 0 ? current_position[X_AXIS] : xhome,
282
+          current_position[Y_AXIS],
283
+          i == 2 ? current_position[Z_AXIS] : raised_z,
284
+          current_position[E_AXIS],
285
+          planner.max_feedrate_mm_s[i == 1 ? X_AXIS : Z_AXIS],
286
+          active_extruder
287
+        );
288
+      stepper.synchronize();
289
+    }
290
+
291
+    // Apply Y & Z extruder offset (X offset is used as home pos with Dual X)
292
+    current_position[Y_AXIS] -= hotend_offset[Y_AXIS][active_extruder] - hotend_offset[Y_AXIS][tmp_extruder];
293
+    current_position[Z_AXIS] -= hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder];
294
+
295
+    // Activate the new extruder ahead of calling set_axis_is_at_home!
296
+    active_extruder = tmp_extruder;
297
+
298
+    // This function resets the max/min values - the current position may be overwritten below.
299
+    set_axis_is_at_home(X_AXIS);
300
+
301
+    #if ENABLED(DEBUG_LEVELING_FEATURE)
302
+      if (DEBUGGING(LEVELING)) DEBUG_POS("New Extruder", current_position);
303
+    #endif
304
+
305
+    // Only when auto-parking are carriages safe to move
306
+    if (dual_x_carriage_mode != DXC_AUTO_PARK_MODE) no_move = true;
307
+
308
+    switch (dual_x_carriage_mode) {
309
+      case DXC_FULL_CONTROL_MODE:
310
+        // New current position is the position of the activated extruder
311
+        current_position[X_AXIS] = inactive_extruder_x_pos;
312
+        // Save the inactive extruder's position (from the old current_position)
313
+        inactive_extruder_x_pos = destination[X_AXIS];
314
+        break;
315
+      case DXC_AUTO_PARK_MODE:
316
+        // record raised toolhead position for use by unpark
317
+        COPY(raised_parked_position, current_position);
318
+        raised_parked_position[Z_AXIS] += TOOLCHANGE_UNPARK_ZLIFT;
319
+        #if ENABLED(MAX_SOFTWARE_ENDSTOPS)
320
+          NOMORE(raised_parked_position[Z_AXIS], soft_endstop_max[Z_AXIS]);
321
+        #endif
322
+        active_extruder_parked = true;
323
+        delayed_move_time = 0;
324
+        break;
325
+      case DXC_DUPLICATION_MODE:
326
+        // If the new extruder is the left one, set it "parked"
327
+        // This triggers the second extruder to move into the duplication position
328
+        active_extruder_parked = (active_extruder == 0);
329
+        current_position[X_AXIS] = active_extruder_parked ? inactive_extruder_x_pos : destination[X_AXIS] + duplicate_extruder_x_offset;
330
+        inactive_extruder_x_pos = destination[X_AXIS];
331
+        extruder_duplication_enabled = false;
332
+        #if ENABLED(DEBUG_LEVELING_FEATURE)
333
+          if (DEBUGGING(LEVELING)) {
334
+            SERIAL_ECHOLNPAIR("Set inactive_extruder_x_pos=", inactive_extruder_x_pos);
335
+            SERIAL_ECHOLNPGM("Clear extruder_duplication_enabled");
336
+          }
337
+        #endif
338
+        break;
339
+    }
340
+
341
+    #if ENABLED(DEBUG_LEVELING_FEATURE)
342
+      if (DEBUGGING(LEVELING)) {
343
+        SERIAL_ECHOLNPAIR("Active extruder parked: ", active_extruder_parked ? "yes" : "no");
344
+        DEBUG_POS("New extruder (parked)", current_position);
345
+      }
346
+    #endif
347
+
348
+    // No extra case for HAS_ABL in DUAL_X_CARRIAGE. Does that mean they don't work together?
349
+  }
350
+
351
+#endif // DUAL_X_CARRIAGE
352
+
353
+/**
354
+ * Perform a tool-change, which may result in moving the
355
+ * previous tool out of the way and the new tool into place.
356
+ */
357
+void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool no_move/*=false*/) {
358
+  #if ENABLED(MIXING_EXTRUDER) && MIXING_VIRTUAL_TOOLS > 1
359
+
360
+    mixing_tool_change(tmp_extruder);
142 361
 
143 362
   #else // !MIXING_EXTRUDER || MIXING_VIRTUAL_TOOLS <= 1
144 363
 
@@ -164,217 +383,13 @@ void tool_change(const uint8_t tmp_extruder, const float fr_mm_s/*=0.0*/, bool n
164 383
 
165 384
         #if ENABLED(DUAL_X_CARRIAGE)
166 385
 
167
-          #if ENABLED(DEBUG_LEVELING_FEATURE)
168
-            if (DEBUGGING(LEVELING)) {
169
-              SERIAL_ECHOPGM("Dual X Carriage Mode ");
170
-              switch (dual_x_carriage_mode) {
171
-                case DXC_FULL_CONTROL_MODE: SERIAL_ECHOLNPGM("DXC_FULL_CONTROL_MODE"); break;
172
-                case DXC_AUTO_PARK_MODE: SERIAL_ECHOLNPGM("DXC_AUTO_PARK_MODE"); break;
173
-                case DXC_DUPLICATION_MODE: SERIAL_ECHOLNPGM("DXC_DUPLICATION_MODE"); break;
174
-              }
175
-            }
176
-          #endif
177
-
178
-          const float xhome = x_home_pos(active_extruder);
179
-          if (dual_x_carriage_mode == DXC_AUTO_PARK_MODE
180
-              && IsRunning()
181
-              && (delayed_move_time || current_position[X_AXIS] != xhome)
182
-          ) {
183
-            float raised_z = current_position[Z_AXIS] + TOOLCHANGE_PARK_ZLIFT;
184
-            #if ENABLED(MAX_SOFTWARE_ENDSTOPS)
185
-              NOMORE(raised_z, soft_endstop_max[Z_AXIS]);
186
-            #endif
187
-            #if ENABLED(DEBUG_LEVELING_FEATURE)
188
-              if (DEBUGGING(LEVELING)) {
189
-                SERIAL_ECHOLNPAIR("Raise to ", raised_z);
190
-                SERIAL_ECHOLNPAIR("MoveX to ", xhome);
191
-                SERIAL_ECHOLNPAIR("Lower to ", current_position[Z_AXIS]);
192
-              }
193
-            #endif
194
-            // Park old head: 1) raise 2) move to park position 3) lower
195
-            for (uint8_t i = 0; i < 3; i++)
196
-              planner.buffer_line(
197
-                i == 0 ? current_position[X_AXIS] : xhome,
198
-                current_position[Y_AXIS],
199
-                i == 2 ? current_position[Z_AXIS] : raised_z,
200
-                current_position[E_AXIS],
201
-                planner.max_feedrate_mm_s[i == 1 ? X_AXIS : Z_AXIS],
202
-                active_extruder
203
-              );
204
-            stepper.synchronize();
205
-          }
206
-
207
-          // Apply Y & Z extruder offset (X offset is used as home pos with Dual X)
208
-          current_position[Y_AXIS] -= hotend_offset[Y_AXIS][active_extruder] - hotend_offset[Y_AXIS][tmp_extruder];
209
-          current_position[Z_AXIS] -= hotend_offset[Z_AXIS][active_extruder] - hotend_offset[Z_AXIS][tmp_extruder];
210
-
211
-          // Activate the new extruder ahead of calling set_axis_is_at_home!
212
-          active_extruder = tmp_extruder;
213
-
214
-          // This function resets the max/min values - the current position may be overwritten below.
215
-          set_axis_is_at_home(X_AXIS);
216
-
217
-          #if ENABLED(DEBUG_LEVELING_FEATURE)
218
-            if (DEBUGGING(LEVELING)) DEBUG_POS("New Extruder", current_position);
219
-          #endif
220
-
221
-          // Only when auto-parking are carriages safe to move
222
-          if (dual_x_carriage_mode != DXC_AUTO_PARK_MODE) no_move = true;
223
-
224
-          switch (dual_x_carriage_mode) {
225
-            case DXC_FULL_CONTROL_MODE:
226
-              // New current position is the position of the activated extruder
227
-              current_position[X_AXIS] = inactive_extruder_x_pos;
228
-              // Save the inactive extruder's position (from the old current_position)
229
-              inactive_extruder_x_pos = destination[X_AXIS];
230
-              break;
231
-            case DXC_AUTO_PARK_MODE:
232
-              // record raised toolhead position for use by unpark
233
-              COPY(raised_parked_position, current_position);
234
-              raised_parked_position[Z_AXIS] += TOOLCHANGE_UNPARK_ZLIFT;
235
-              #if ENABLED(MAX_SOFTWARE_ENDSTOPS)
236
-                NOMORE(raised_parked_position[Z_AXIS], soft_endstop_max[Z_AXIS]);
237
-              #endif
238
-              active_extruder_parked = true;
239
-              delayed_move_time = 0;
240
-              break;
241
-            case DXC_DUPLICATION_MODE:
242
-              // If the new extruder is the left one, set it "parked"
243
-              // This triggers the second extruder to move into the duplication position
244
-              active_extruder_parked = (active_extruder == 0);
245
-
246
-              if (active_extruder_parked)
247
-                current_position[X_AXIS] = inactive_extruder_x_pos;
248
-              else
249
-                current_position[X_AXIS] = destination[X_AXIS] + duplicate_extruder_x_offset;
250
-              inactive_extruder_x_pos = destination[X_AXIS];
251
-              extruder_duplication_enabled = false;
252
-              #if ENABLED(DEBUG_LEVELING_FEATURE)
253
-                if (DEBUGGING(LEVELING)) {
254
-                  SERIAL_ECHOLNPAIR("Set inactive_extruder_x_pos=", inactive_extruder_x_pos);
255
-                  SERIAL_ECHOLNPGM("Clear extruder_duplication_enabled");
256
-                }
257
-              #endif
258
-              break;
259
-          }
260
-
261
-          #if ENABLED(DEBUG_LEVELING_FEATURE)
262
-            if (DEBUGGING(LEVELING)) {
263
-              SERIAL_ECHOLNPAIR("Active extruder parked: ", active_extruder_parked ? "yes" : "no");
264
-              DEBUG_POS("New extruder (parked)", current_position);
265
-            }
266
-          #endif
267
-
268
-          // No extra case for HAS_ABL in DUAL_X_CARRIAGE. Does that mean they don't work together?
386
+          dualx_tool_change(tmp_extruder, no_move); // Can modify no_move
269 387
 
270 388
         #else // !DUAL_X_CARRIAGE
271 389
 
272
-          #if ENABLED(PARKING_EXTRUDER) // Dual Parking extruder
273
-            float z_raise = PARKING_EXTRUDER_SECURITY_RAISE;
274
-            if (!no_move) {
275
-
276
-              const float parkingposx[] = PARKING_EXTRUDER_PARKING_X,
277
-                          midpos = (parkingposx[0] + parkingposx[1]) * 0.5 + hotend_offset[X_AXIS][active_extruder],
278
-                          grabpos = parkingposx[tmp_extruder] + hotend_offset[X_AXIS][active_extruder]
279
-                                    + (tmp_extruder == 0 ? -(PARKING_EXTRUDER_GRAB_DISTANCE) : PARKING_EXTRUDER_GRAB_DISTANCE);
280
-              /**
281
-               *  Steps:
282
-               *    1. Raise Z-Axis to give enough clearance
283
-               *    2. Move to park position of old extruder
284
-               *    3. Disengage magnetic field, wait for delay
285
-               *    4. Move near new extruder
286
-               *    5. Engage magnetic field for new extruder
287
-               *    6. Move to parking incl. offset of new extruder
288
-               *    7. Lower Z-Axis
289
-               */
290
-
291
-              // STEP 1
292
-              #if ENABLED(DEBUG_LEVELING_FEATURE)
293
-                SERIAL_ECHOLNPGM("Starting Autopark");
294
-                if (DEBUGGING(LEVELING)) DEBUG_POS("current position:", current_position);
295
-              #endif
296
-              current_position[Z_AXIS] += z_raise;
297
-              #if ENABLED(DEBUG_LEVELING_FEATURE)
298
-                SERIAL_ECHOLNPGM("(1) Raise Z-Axis ");
299
-                if (DEBUGGING(LEVELING)) DEBUG_POS("Moving to Raised Z-Position", current_position);
300
-              #endif
301
-              planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[Z_AXIS], active_extruder);
302
-              stepper.synchronize();
303
-
304
-              // STEP 2
305
-              current_position[X_AXIS] = parkingposx[active_extruder] + hotend_offset[X_AXIS][active_extruder];
306
-              #if ENABLED(DEBUG_LEVELING_FEATURE)
307
-                SERIAL_ECHOLNPAIR("(2) Park extruder ", active_extruder);
308
-                if (DEBUGGING(LEVELING)) DEBUG_POS("Moving ParkPos", current_position);
309
-              #endif
310
-              planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[X_AXIS], active_extruder);
311
-              stepper.synchronize();
312
-
313
-              // STEP 3
314
-              #if ENABLED(DEBUG_LEVELING_FEATURE)
315
-                SERIAL_ECHOLNPGM("(3) Disengage magnet ");
316
-              #endif
317
-              pe_deactivate_magnet(active_extruder);
318
-
319
-              // STEP 4
320
-              #if ENABLED(DEBUG_LEVELING_FEATURE)
321
-                SERIAL_ECHOLNPGM("(4) Move to position near new extruder");
322
-              #endif
323
-              current_position[X_AXIS] += (active_extruder == 0 ? 10 : -10); // move 10mm away from parked extruder
324
-
325
-              #if ENABLED(DEBUG_LEVELING_FEATURE)
326
-                if (DEBUGGING(LEVELING)) DEBUG_POS("Moving away from parked extruder", current_position);
327
-              #endif
328
-              planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[X_AXIS], active_extruder);
329
-              stepper.synchronize();
330
-
331
-              // STEP 5
332
-              #if ENABLED(DEBUG_LEVELING_FEATURE)
333
-                SERIAL_ECHOLNPGM("(5) Engage magnetic field");
334
-              #endif
335
-
336
-              #if ENABLED(PARKING_EXTRUDER_SOLENOIDS_INVERT)
337
-                pe_activate_magnet(active_extruder); //just save power for inverted magnets
338
-              #endif
339
-              pe_activate_magnet(tmp_extruder);
340
-
341
-              // STEP 6
342
-              current_position[X_AXIS] = grabpos + (tmp_extruder == 0 ? (+10) : (-10));
343
-              planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[X_AXIS], active_extruder);
344
-              current_position[X_AXIS] = grabpos;
345
-              #if ENABLED(DEBUG_LEVELING_FEATURE)
346
-                SERIAL_ECHOLNPAIR("(6) Unpark extruder ", tmp_extruder);
347
-                if (DEBUGGING(LEVELING)) DEBUG_POS("Move UnparkPos", current_position);
348
-              #endif
349
-              planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[X_AXIS]/2, active_extruder);
350
-              stepper.synchronize();
351
-
352
-              // Step 7
353
-              current_position[X_AXIS] = midpos - hotend_offset[X_AXIS][tmp_extruder];
354
-              #if ENABLED(DEBUG_LEVELING_FEATURE)
355
-                SERIAL_ECHOLNPGM("(7) Move midway between hotends");
356
-                if (DEBUGGING(LEVELING)) DEBUG_POS("Move midway to new extruder", current_position);
357
-              #endif
358
-              planner.buffer_line_kinematic(current_position, planner.max_feedrate_mm_s[X_AXIS], active_extruder);
359
-              stepper.synchronize();
360
-              #if ENABLED(DEBUG_LEVELING_FEATURE)
361
-                SERIAL_ECHOLNPGM("Autopark done.");
362
-              #endif
363
-            }
364
-            else { // nomove == true
365
-              // Only engage magnetic field for new extruder
366
-              pe_activate_magnet(tmp_extruder);
367
-              #if ENABLED(PARKING_EXTRUDER_SOLENOIDS_INVERT)
368
-                pe_activate_magnet(active_extruder); // Just save power for inverted magnets
369
-              #endif
370
-            }
371
-            current_position[Z_AXIS] -= hotend_offset[Z_AXIS][tmp_extruder] - hotend_offset[Z_AXIS][active_extruder]; // Apply Zoffset
372
-
373
-            #if ENABLED(DEBUG_LEVELING_FEATURE)
374
-              if (DEBUGGING(LEVELING)) DEBUG_POS("Applying Z-offset", current_position);
375
-            #endif
376
-
377
-          #endif // dualParking extruder
390
+          #if ENABLED(PARKING_EXTRUDER)
391
+            parking_extruder_tool_change(tmp_extruder, no_move);
392
+          #endif
378 393
 
379 394
           #if ENABLED(SWITCHING_NOZZLE)
380 395
             #define DONT_SWITCH (SWITCHING_EXTRUDER_SERVO_NR == SWITCHING_NOZZLE_SERVO_NR)

Loading…
Cancel
Save