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
   // Number of pattern repetitions
894
   // Number of pattern repetitions
895
   #define NOZZLE_CLEAN_STROKES  12
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
 #endif
903
 #endif
904
 
904
 
905
 //
905
 //

+ 10
- 0
Marlin/Marlin.h View File

404
   #endif
404
   #endif
405
 #endif
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
 #endif //MARLIN_H
417
 #endif //MARLIN_H

+ 12
- 22
Marlin/Marlin_main.cpp View File

59
 #include "language.h"
59
 #include "language.h"
60
 #include "pins_arduino.h"
60
 #include "pins_arduino.h"
61
 #include "math.h"
61
 #include "math.h"
62
+#include "nozzle.h"
62
 
63
 
63
 #if ENABLED(USE_WATCHDOG)
64
 #if ENABLED(USE_WATCHDOG)
64
   #include "watchdog.h"
65
   #include "watchdog.h"
1660
  *  Plan a move to (X, Y, Z) and set the current_position
1661
  *  Plan a move to (X, Y, Z) and set the current_position
1661
  *  The final current_position may not be the one that was requested
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
   float old_feedrate_mm_m = feedrate_mm_m;
1665
   float old_feedrate_mm_m = feedrate_mm_m;
1665
 
1666
 
1666
   #if ENABLED(DEBUG_LEVELING_FEATURE)
1667
   #if ENABLED(DEBUG_LEVELING_FEATURE)
1708
   feedrate_mm_m = old_feedrate_mm_m;
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
 // Prepare to do endstop or probe moves
1722
 // Prepare to do endstop or probe moves
2784
 
2778
 
2785
 #endif //FWRETRACT
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
    * G12: Clean the nozzle
2783
    * G12: Clean the nozzle
2792
    */
2784
    */
2819
 #endif
2811
 #endif
2820
 
2812
 
2821
 #if ENABLED(NOZZLE_PARK_FEATURE)
2813
 #if ENABLED(NOZZLE_PARK_FEATURE)
2822
-  #include "nozzle.h"
2823
-
2824
   /**
2814
   /**
2825
    * G27: Park the nozzle
2815
    * G27: Park the nozzle
2826
    */
2816
    */
3301
         }
3291
         }
3302
         // For each G29 S2...
3292
         // For each G29 S2...
3303
         if (probe_point == 0) {
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
           current_position[Z_AXIS] = MESH_HOME_SEARCH_Z
3295
           current_position[Z_AXIS] = MESH_HOME_SEARCH_Z
3306
             #if Z_HOME_DIR > 0
3296
             #if Z_HOME_DIR > 0
3307
               + Z_MAX_POS
3297
               + Z_MAX_POS
7084
           break;
7074
           break;
7085
       #endif // FWRETRACT
7075
       #endif // FWRETRACT
7086
 
7076
 
7087
-      #if ENABLED(NOZZLE_CLEAN_FEATURE) && HAS_BED_PROBE
7077
+      #if ENABLED(NOZZLE_CLEAN_FEATURE)
7088
         case 12:
7078
         case 12:
7089
           gcode_G12(); // G12: Nozzle Clean
7079
           gcode_G12(); // G12: Nozzle Clean
7090
           break;
7080
           break;

+ 0
- 7
Marlin/SanityCheck.h View File

684
   #error "ENDSTOPS_ONLY_FOR_HOMING is deprecated. Use (disable) ENDSTOPS_ALWAYS_ON_DEFAULT instead."
684
   #error "ENDSTOPS_ONLY_FOR_HOMING is deprecated. Use (disable) ENDSTOPS_ALWAYS_ON_DEFAULT instead."
685
 #endif
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
 #endif //SANITYCHECK_H
687
 #endif //SANITYCHECK_H

+ 12
- 12
Marlin/nozzle.h View File

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

Loading…
Cancel
Save