Browse Source

Nozzle::clean() no longer requires HAS_BED_PROBE

João Brázio 8 years ago
parent
commit
47fef80848
5 changed files with 39 additions and 46 deletions
  1. 5
    5
      Marlin/Configuration.h
  2. 10
    0
      Marlin/Marlin.h
  3. 12
    22
      Marlin/Marlin_main.cpp
  4. 0
    7
      Marlin/SanityCheck.h
  5. 12
    12
      Marlin/nozzle.h

+ 5
- 5
Marlin/Configuration.h View File

@@ -894,12 +894,12 @@
894 894
   // Number of pattern repetitions
895 895
   #define NOZZLE_CLEAN_STROKES  12
896 896
 
897
-  //                            {  X,  Y,               Z}
898
-  #define NOZZLE_CLEAN_START_PT { 30, 30, (Z_MIN_POS + 5)}
899
-  #define NOZZLE_CLEAN_END_PT   {100, 60, (Z_MIN_POS + 5)}
897
+  // Specify positions as { X, Y, Z }
898
+  #define NOZZLE_CLEAN_START_POINT { 30, 30, (Z_MIN_POS + 1)}
899
+  #define NOZZLE_CLEAN_END_POINT   {100, 60, (Z_MIN_POS + 1)}
900 900
 
901
-  // Moves the nozzle to the parked position
902
-  #define NOZZLE_CLEAN_PARK
901
+  // Moves the nozzle to the initial position
902
+  #define NOZZLE_CLEAN_GOBACK
903 903
 #endif
904 904
 
905 905
 //

+ 10
- 0
Marlin/Marlin.h View File

@@ -404,4 +404,14 @@ void calculate_volumetric_multipliers();
404 404
   #endif
405 405
 #endif
406 406
 
407
+/**
408
+ * Blocking movement and shorthand functions
409
+ */
410
+static void do_blocking_move_to(float x, float y, float z, float fr_mm_m=0.0);
411
+static void do_blocking_move_to_axis_pos(AxisEnum axis, float where, float fr_mm_m=0.0);
412
+static void do_blocking_move_to_x(float x, float fr_mm_m=0.0);
413
+static void do_blocking_move_to_y(float y);
414
+static void do_blocking_move_to_z(float z, float fr_mm_m=0.0);
415
+static void do_blocking_move_to_xy(float x, float y, float fr_mm_m=0.0);
416
+
407 417
 #endif //MARLIN_H

+ 12
- 22
Marlin/Marlin_main.cpp View File

@@ -59,6 +59,7 @@
59 59
 #include "language.h"
60 60
 #include "pins_arduino.h"
61 61
 #include "math.h"
62
+#include "nozzle.h"
62 63
 
63 64
 #if ENABLED(USE_WATCHDOG)
64 65
   #include "watchdog.h"
@@ -1660,7 +1661,7 @@ inline void set_destination_to_current() { memcpy(destination, current_position,
1660 1661
  *  Plan a move to (X, Y, Z) and set the current_position
1661 1662
  *  The final current_position may not be the one that was requested
1662 1663
  */
1663
-static void do_blocking_move_to(float x, float y, float z, float fr_mm_m = 0.0) {
1664
+void do_blocking_move_to(float x, float y, float z, float fr_mm_m /*=0.0*/) {
1664 1665
   float old_feedrate_mm_m = feedrate_mm_m;
1665 1666
 
1666 1667
   #if ENABLED(DEBUG_LEVELING_FEATURE)
@@ -1708,21 +1709,14 @@ static void do_blocking_move_to(float x, float y, float z, float fr_mm_m = 0.0)
1708 1709
   feedrate_mm_m = old_feedrate_mm_m;
1709 1710
 }
1710 1711
 
1711
-inline void do_blocking_move_to_x(float x, float fr_mm_m = 0.0) {
1712
-  do_blocking_move_to(x, current_position[Y_AXIS], current_position[Z_AXIS], fr_mm_m);
1713
-}
1714
-
1715
-inline void do_blocking_move_to_y(float y) {
1716
-  do_blocking_move_to(current_position[X_AXIS], y, current_position[Z_AXIS]);
1717
-}
1718
-
1719
-inline void do_blocking_move_to_xy(float x, float y, float fr_mm_m = 0.0) {
1720
-  do_blocking_move_to(x, y, current_position[Z_AXIS], fr_mm_m);
1721
-}
1722
-
1723
-inline void do_blocking_move_to_z(float z, float fr_mm_m = 0.0) {
1724
-  do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z, fr_mm_m);
1712
+void do_blocking_move_to_axis_pos(AxisEnum axis, float where, float fr_mm_m/*=0.0*/) {
1713
+  current_position[axis] = where;
1714
+  do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], fr_mm_m);
1725 1715
 }
1716
+void do_blocking_move_to_x(float x, float fr_mm_m/*=0.0*/) { do_blocking_move_to_axis_pos(X_AXIS, x, fr_mm_m); }
1717
+void do_blocking_move_to_y(float y) { do_blocking_move_to_axis_pos(Y_AXIS, y); }
1718
+void do_blocking_move_to_z(float z, float fr_mm_m/*=0.0*/) { do_blocking_move_to_axis_pos(Z_AXIS, z, fr_mm_m); }
1719
+void do_blocking_move_to_xy(float x, float y, float fr_mm_m/*=0.0*/) { do_blocking_move_to(x, y, current_position[Z_AXIS], fr_mm_m); }
1726 1720
 
1727 1721
 //
1728 1722
 // Prepare to do endstop or probe moves
@@ -2784,9 +2778,7 @@ inline void gcode_G4() {
2784 2778
 
2785 2779
 #endif //FWRETRACT
2786 2780
 
2787
-#if ENABLED(NOZZLE_CLEAN_FEATURE) && HAS_BED_PROBE
2788
-  #include "nozzle.h"
2789
-
2781
+#if ENABLED(NOZZLE_CLEAN_FEATURE)
2790 2782
   /**
2791 2783
    * G12: Clean the nozzle
2792 2784
    */
@@ -2819,8 +2811,6 @@ inline void gcode_G4() {
2819 2811
 #endif
2820 2812
 
2821 2813
 #if ENABLED(NOZZLE_PARK_FEATURE)
2822
-  #include "nozzle.h"
2823
-
2824 2814
   /**
2825 2815
    * G27: Park the nozzle
2826 2816
    */
@@ -3301,7 +3291,7 @@ inline void gcode_G28() {
3301 3291
         }
3302 3292
         // For each G29 S2...
3303 3293
         if (probe_point == 0) {
3304
-          // For the intial G29 S2 make Z a positive value (e.g., 4.0)
3294
+          // For the initial G29 S2 make Z a positive value (e.g., 4.0)
3305 3295
           current_position[Z_AXIS] = MESH_HOME_SEARCH_Z
3306 3296
             #if Z_HOME_DIR > 0
3307 3297
               + Z_MAX_POS
@@ -7084,7 +7074,7 @@ void process_next_command() {
7084 7074
           break;
7085 7075
       #endif // FWRETRACT
7086 7076
 
7087
-      #if ENABLED(NOZZLE_CLEAN_FEATURE) && HAS_BED_PROBE
7077
+      #if ENABLED(NOZZLE_CLEAN_FEATURE)
7088 7078
         case 12:
7089 7079
           gcode_G12(); // G12: Nozzle Clean
7090 7080
           break;

+ 0
- 7
Marlin/SanityCheck.h View File

@@ -684,11 +684,4 @@
684 684
   #error "ENDSTOPS_ONLY_FOR_HOMING is deprecated. Use (disable) ENDSTOPS_ALWAYS_ON_DEFAULT instead."
685 685
 #endif
686 686
 
687
-/**
688
- * Nozzle cleaning
689
- */
690
-#if ENABLED(NOZZLE_CLEAN_FEATURE) && !HAS_BED_PROBE
691
-  #error Due to internal dependencies you must have a bed probe for NOZZLE_CLEAN_FEATURE to work
692
-#endif
693
-
694 687
 #endif //SANITYCHECK_H

+ 12
- 12
Marlin/nozzle.h View File

@@ -48,7 +48,7 @@ class Nozzle {
48 48
     ) __attribute__((optimize ("Os"))) {
49 49
       #if ENABLED(NOZZLE_CLEAN_FEATURE)
50 50
 
51
-        #if ENABLED(NOZZLE_CLEAN_PARK)
51
+        #if ENABLED(NOZZLE_CLEAN_GOBACK)
52 52
           // Store the current coords
53 53
           point_t const initial = {
54 54
             current_position[X_AXIS],
@@ -56,7 +56,7 @@ class Nozzle {
56 56
             current_position[Z_AXIS],
57 57
             current_position[E_AXIS]
58 58
           };
59
-        #endif // NOZZLE_CLEAN_PARK
59
+        #endif // NOZZLE_CLEAN_GOBACK
60 60
 
61 61
         // Move to the starting point
62 62
         do_blocking_move_to_xy(start.x, start.y);
@@ -68,11 +68,11 @@ class Nozzle {
68 68
           do_blocking_move_to_xy(start.x, start.y);
69 69
         }
70 70
 
71
-        #if ENABLED(NOZZLE_CLEAN_PARK)
71
+        #if ENABLED(NOZZLE_CLEAN_GOBACK)
72 72
           // Move the nozzle to the initial point
73 73
           do_blocking_move_to_z(initial.z);
74 74
           do_blocking_move_to_xy(initial.x, initial.y);
75
-        #endif // NOZZLE_CLEAN_PARK
75
+        #endif // NOZZLE_CLEAN_GOBACK
76 76
 
77 77
       #endif // NOZZLE_CLEAN_FEATURE
78 78
     }
@@ -99,7 +99,7 @@ class Nozzle {
99 99
         // Don't allow impossible triangles
100 100
         if (A <= 0.0f || P <= 0.0f ) return;
101 101
 
102
-        #if ENABLED(NOZZLE_CLEAN_PARK)
102
+        #if ENABLED(NOZZLE_CLEAN_GOBACK)
103 103
           // Store the current coords
104 104
           point_t const initial = {
105 105
             current_position[X_AXIS],
@@ -107,7 +107,7 @@ class Nozzle {
107 107
             current_position[Z_AXIS],
108 108
             current_position[E_AXIS]
109 109
           };
110
-        #endif // NOZZLE_CLEAN_PARK
110
+        #endif // NOZZLE_CLEAN_GOBACK
111 111
 
112 112
         for (uint8_t j = 0; j < strokes; j++) {
113 113
           for (uint8_t i = 0; i < (objects << 1); i++) {
@@ -126,11 +126,11 @@ class Nozzle {
126 126
           }
127 127
         }
128 128
 
129
-        #if ENABLED(NOZZLE_CLEAN_PARK)
129
+        #if ENABLED(NOZZLE_CLEAN_GOBACK)
130 130
           // Move the nozzle to the initial point
131 131
           do_blocking_move_to_z(initial.z);
132 132
           do_blocking_move_to_xy(initial.x, initial.y);
133
-        #endif // NOZZLE_CLEAN_PARK
133
+        #endif // NOZZLE_CLEAN_GOBACK
134 134
 
135 135
       #endif // NOZZLE_CLEAN_FEATURE
136 136
     }
@@ -152,14 +152,14 @@ class Nozzle {
152 152
         switch (pattern) {
153 153
           case 1:
154 154
             Nozzle::zigzag(
155
-              NOZZLE_CLEAN_START_PT,
156
-              NOZZLE_CLEAN_END_PT, strokes, objects);
155
+              NOZZLE_CLEAN_START_POINT,
156
+              NOZZLE_CLEAN_END_POINT, strokes, objects);
157 157
             break;
158 158
 
159 159
           default:
160 160
             Nozzle::stroke(
161
-              NOZZLE_CLEAN_START_PT,
162
-              NOZZLE_CLEAN_END_PT, strokes);
161
+              NOZZLE_CLEAN_START_POINT,
162
+              NOZZLE_CLEAN_END_POINT, strokes);
163 163
         }
164 164
       #endif // NOZZLE_CLEAN_FEATURE
165 165
     }

Loading…
Cancel
Save