Browse Source

Indent tool_change_prime

Scott Lahteine 4 years ago
parent
commit
d2e1e9a0ac
1 changed files with 56 additions and 55 deletions
  1. 56
    55
      Marlin/src/module/tool_change.cpp

+ 56
- 55
Marlin/src/module/tool_change.cpp View File

@@ -793,75 +793,76 @@ inline void fast_line_to_current(const AxisEnum fr_axis) { _line_to_current(fr_a
793 793
  */
794 794
 #if ENABLED(TOOLCHANGE_FILAMENT_SWAP)
795 795
 
796
-void tool_change_prime() {
797
-  if (toolchange_settings.extra_prime > 0
798
-    && TERN(PREVENT_COLD_EXTRUSION, !thermalManager.targetTooColdToExtrude(active_extruder), 1)
799
-  ) {
800
-    destination = current_position; // Remember the old position
801
-
802
-    const bool ok = TERN1(TOOLCHANGE_PARK, all_axes_homed() && toolchange_settings.enable_park);
796
+  void tool_change_prime() {
797
+    if (toolchange_settings.extra_prime > 0
798
+      && TERN(PREVENT_COLD_EXTRUSION, !thermalManager.targetTooColdToExtrude(active_extruder), 1)
799
+    ) {
800
+      destination = current_position; // Remember the old position
803 801
 
804
-    #if HAS_FAN && TOOLCHANGE_FS_FAN >= 0
805
-      // Store and stop fan. Restored on any exit.
806
-      REMEMBER(fan, thermalManager.fan_speed[TOOLCHANGE_FS_FAN], 0);
807
-    #endif
802
+      const bool ok = TERN1(TOOLCHANGE_PARK, all_axes_homed() && toolchange_settings.enable_park);
808 803
 
809
-    // Z raise
810
-    if (ok) {
811
-      // Do a small lift to avoid the workpiece in the move back (below)
812
-      current_position.z += toolchange_settings.z_raise;
813
-      #if HAS_SOFTWARE_ENDSTOPS
814
-        NOMORE(current_position.z, soft_endstop.max.z);
804
+      #if HAS_FAN && TOOLCHANGE_FS_FAN >= 0
805
+        // Store and stop fan. Restored on any exit.
806
+        REMEMBER(fan, thermalManager.fan_speed[TOOLCHANGE_FS_FAN], 0);
815 807
       #endif
816
-      fast_line_to_current(Z_AXIS);
817
-      planner.synchronize();
818
-    }
819 808
 
820
-    // Park
821
-    #if ENABLED(TOOLCHANGE_PARK)
809
+      // Z raise
822 810
       if (ok) {
823
-        IF_DISABLED(TOOLCHANGE_PARK_Y_ONLY, current_position.x = toolchange_settings.change_point.x);
824
-        IF_DISABLED(TOOLCHANGE_PARK_X_ONLY, current_position.y = toolchange_settings.change_point.y);
825
-        planner.buffer_line(current_position, MMM_TO_MMS(TOOLCHANGE_PARK_XY_FEEDRATE), active_extruder);
811
+        // Do a small lift to avoid the workpiece in the move back (below)
812
+        current_position.z += toolchange_settings.z_raise;
813
+        #if HAS_SOFTWARE_ENDSTOPS
814
+          NOMORE(current_position.z, soft_endstop.max.z);
815
+        #endif
816
+        fast_line_to_current(Z_AXIS);
826 817
         planner.synchronize();
827 818
       }
828
-    #endif
829 819
 
830
-    // Prime (All distances are added and slowed down to ensure secure priming in all circumstances)
831
-    unscaled_e_move(toolchange_settings.swap_length + toolchange_settings.extra_prime, MMM_TO_MMS(toolchange_settings.prime_speed));
820
+      // Park
821
+      #if ENABLED(TOOLCHANGE_PARK)
822
+        if (ok) {
823
+          IF_DISABLED(TOOLCHANGE_PARK_Y_ONLY, current_position.x = toolchange_settings.change_point.x);
824
+          IF_DISABLED(TOOLCHANGE_PARK_X_ONLY, current_position.y = toolchange_settings.change_point.y);
825
+          planner.buffer_line(current_position, MMM_TO_MMS(TOOLCHANGE_PARK_XY_FEEDRATE), active_extruder);
826
+          planner.synchronize();
827
+        }
828
+      #endif
832 829
 
833
-    // Cutting retraction
834
-    #if TOOLCHANGE_FS_WIPE_RETRACT
835
-      unscaled_e_move(-(TOOLCHANGE_FS_WIPE_RETRACT), MMM_TO_MMS(toolchange_settings.retract_speed));
836
-    #endif
830
+      // Prime (All distances are added and slowed down to ensure secure priming in all circumstances)
831
+      unscaled_e_move(toolchange_settings.swap_length + toolchange_settings.extra_prime, MMM_TO_MMS(toolchange_settings.prime_speed));
837 832
 
838
-    // Cool down with fan
839
-    #if HAS_FAN && TOOLCHANGE_FS_FAN >= 0
840
-      thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = toolchange_settings.fan_speed;
841
-      gcode.dwell(toolchange_settings.fan_time * 1000);
842
-      thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = 0;
843
-    #endif
833
+      // Cutting retraction
834
+      #if TOOLCHANGE_FS_WIPE_RETRACT
835
+        unscaled_e_move(-(TOOLCHANGE_FS_WIPE_RETRACT), MMM_TO_MMS(toolchange_settings.retract_speed));
836
+      #endif
844 837
 
845
-    // Move back
846
-    #if ENABLED(TOOLCHANGE_PARK)
847
-      if (ok) {
848
-        #if ENABLED(TOOLCHANGE_NO_RETURN)
849
-          do_blocking_move_to_z(destination.z, planner.settings.max_feedrate_mm_s[Z_AXIS]);
850
-        #else
851
-          do_blocking_move_to(destination, MMM_TO_MMS(TOOLCHANGE_PARK_XY_FEEDRATE));
852
-        #endif
853
-      }
854
-    #endif
838
+      // Cool down with fan
839
+      #if HAS_FAN && TOOLCHANGE_FS_FAN >= 0
840
+        thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = toolchange_settings.fan_speed;
841
+        gcode.dwell(toolchange_settings.fan_time * 1000);
842
+        thermalManager.fan_speed[TOOLCHANGE_FS_FAN] = 0;
843
+      #endif
844
+
845
+      // Move back
846
+      #if ENABLED(TOOLCHANGE_PARK)
847
+        if (ok) {
848
+          #if ENABLED(TOOLCHANGE_NO_RETURN)
849
+            do_blocking_move_to_z(destination.z, planner.settings.max_feedrate_mm_s[Z_AXIS]);
850
+          #else
851
+            do_blocking_move_to(destination, MMM_TO_MMS(TOOLCHANGE_PARK_XY_FEEDRATE));
852
+          #endif
853
+        }
854
+      #endif
855 855
 
856
-    // Cutting recover
857
-    unscaled_e_move(toolchange_settings.extra_resume + TOOLCHANGE_FS_WIPE_RETRACT, MMM_TO_MMS(toolchange_settings.unretract_speed));
856
+      // Cutting recover
857
+      unscaled_e_move(toolchange_settings.extra_resume + TOOLCHANGE_FS_WIPE_RETRACT, MMM_TO_MMS(toolchange_settings.unretract_speed));
858 858
 
859
-    planner.synchronize();
860
-    current_position.e = destination.e;
861
-    sync_plan_position_e(); // Resume at the old E position
859
+      planner.synchronize();
860
+      current_position.e = destination.e;
861
+      sync_plan_position_e(); // Resume at the old E position
862
+    }
862 863
   }
863
-}
864
-#endif
864
+
865
+#endif // TOOLCHANGE_FILAMENT_SWAP
865 866
 
866 867
 /**
867 868
  * Perform a tool-change, which may result in moving the

Loading…
Cancel
Save