Browse Source

Merge pull request #4054 from jbrazio/feature/g12-clean-tool

Implements clean nozzle feature (Lulzbot's REWIPE)
Scott Lahteine 8 years ago
parent
commit
8bf6861af8
27 changed files with 1302 additions and 18 deletions
  1. 6
    0
      .travis.yml
  2. 48
    0
      Marlin/Configuration.h
  3. 30
    15
      Marlin/Marlin_main.cpp
  4. 7
    0
      Marlin/SanityCheck.h
  5. 51
    3
      Marlin/example_configurations/Cartesio/Configuration.h
  6. 48
    0
      Marlin/example_configurations/Felix/Configuration.h
  7. 48
    0
      Marlin/example_configurations/Felix/DUAL/Configuration.h
  8. 48
    0
      Marlin/example_configurations/Hephestos/Configuration.h
  9. 48
    0
      Marlin/example_configurations/Hephestos_2/Configuration.h
  10. 48
    0
      Marlin/example_configurations/K8200/Configuration.h
  11. 48
    0
      Marlin/example_configurations/K8400/Configuration.h
  12. 48
    0
      Marlin/example_configurations/K8400/Dual-head/Configuration.h
  13. 48
    0
      Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h
  14. 48
    0
      Marlin/example_configurations/RigidBot/Configuration.h
  15. 48
    0
      Marlin/example_configurations/SCARA/Configuration.h
  16. 48
    0
      Marlin/example_configurations/TAZ4/Configuration.h
  17. 48
    0
      Marlin/example_configurations/WITBOX/Configuration.h
  18. 48
    0
      Marlin/example_configurations/adafruit/ST7565/Configuration.h
  19. 48
    0
      Marlin/example_configurations/delta/biv2.5/Configuration.h
  20. 48
    0
      Marlin/example_configurations/delta/generic/Configuration.h
  21. 48
    0
      Marlin/example_configurations/delta/kossel_mini/Configuration.h
  22. 48
    0
      Marlin/example_configurations/delta/kossel_pro/Configuration.h
  23. 48
    0
      Marlin/example_configurations/delta/kossel_xl/Configuration.h
  24. 48
    0
      Marlin/example_configurations/makibox/Configuration.h
  25. 48
    0
      Marlin/example_configurations/tvrrug/Round2/Configuration.h
  26. 154
    0
      Marlin/nozzle.h
  27. 46
    0
      Marlin/point_t.h

+ 6
- 0
.travis.yml View File

@@ -211,6 +211,12 @@ script:
211 211
   - opt_enable PRINTCOUNTER
212 212
   - build_marlin
213 213
   #
214
+  # Test CLEAN_NOZZLE_FEATURE
215
+  #
216
+  - restore_configs
217
+  - opt_enable AUTO_BED_LEVELING_FEATURE CLEAN_NOZZLE_FEATURE FIX_MOUNTED_PROBE
218
+  - build_marlin
219
+  #
214 220
   #
215 221
   ######## STANDARD LCD/PANELS ##############
216 222
   #

+ 48
- 0
Marlin/Configuration.h View File

@@ -788,6 +788,54 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
788 788
 #define PREHEAT_2_FAN_SPEED     0 // Value from 0 to 255
789 789
 
790 790
 //
791
+// Clean Nozzle Feature -- EXPERIMENTAL
792
+//
793
+// When enabled allows the user to send G12 to start the nozzle cleaning
794
+// process, the G-Code accepts two parameters:
795
+//   "P" for pattern selection
796
+//   "S" for defining the number of strokes/repetitions
797
+//
798
+// Available list of patterns:
799
+//   P0: This is the default pattern, this process requires a sponge type
800
+//       material at a fixed bed location, the cleaning process is based on
801
+//       "strokes" i.e. back-and-forth movements between the starting and end
802
+//       points.
803
+//
804
+//   P1: This starts a zig-zag pattern between (X0, Y0) and (X1, Y1), "T"
805
+//       defines the number of zig-zag triangles to be done. "S" defines the
806
+//       number of strokes aka one back-and-forth movement. As an example
807
+//       sending "G12 P1 S1 T3" will execute:
808
+//
809
+//          --
810
+//         |  (X0, Y1) |     /\        /\        /\     | (X1, Y1)
811
+//         |           |    /  \      /  \      /  \    |
812
+//       A |           |   /    \    /    \    /    \   |
813
+//         |           |  /      \  /      \  /      \  |
814
+//         |  (X0, Y0) | /        \/        \/        \ | (X1, Y0)
815
+//          --         +--------------------------------+
816
+//                       |________|_________|_________|
817
+//                           T1        T2        T3
818
+//
819
+// Caveats: End point Z should use the same value as Start point Z.
820
+//
821
+// Attention: This is an EXPERIMENTAL feature, in the future the G-code arguments
822
+// may change to add new functionality like different wipe patterns.
823
+//
824
+//#define NOZZLE_CLEAN_FEATURE
825
+
826
+#if ENABLED(NOZZLE_CLEAN_FEATURE)
827
+  // Number of pattern repetitions
828
+  #define NOZZLE_CLEAN_STROKES  12
829
+
830
+  //                            {  X,  Y,               Z}
831
+  #define NOZZLE_CLEAN_START_PT { 30, 30, (Z_MIN_POS + 5)}
832
+  #define NOZZLE_CLEAN_END_PT   {100, 60, (Z_MIN_POS + 5)}
833
+
834
+  // Moves the nozzle to the parked position
835
+  #define NOZZLE_CLEAN_PARK
836
+#endif
837
+
838
+//
791 839
 // Print job timer
792 840
 //
793 841
 // Enable this option to automatically start and stop the

+ 30
- 15
Marlin/Marlin_main.cpp View File

@@ -106,8 +106,9 @@
106 106
  * G3  - CCW ARC
107 107
  * G4  - Dwell S<seconds> or P<milliseconds>
108 108
  * G5  - Cubic B-spline with XYZE destination and IJPQ offsets
109
- * G10 - retract filament according to settings of M207
110
- * G11 - retract recover filament according to settings of M208
109
+ * G10 - Retract filament according to settings of M207
110
+ * G11 - Retract recover filament according to settings of M208
111
+ * G12 - Clean tool
111 112
  * G20 - Set input units to inches
112 113
  * G21 - Set input units to millimeters
113 114
  * G28 - Home one or more axes
@@ -1695,6 +1696,10 @@ static void clean_up_after_endstop_or_probe_move() {
1695 1696
     do_blocking_move_to(x, current_position[Y_AXIS], current_position[Z_AXIS], feed_rate);
1696 1697
   }
1697 1698
 
1699
+  inline void do_blocking_move_to_y(float y) {
1700
+    do_blocking_move_to(current_position[X_AXIS], y, current_position[Z_AXIS]);
1701
+  }
1702
+
1698 1703
   inline void do_blocking_move_to_z(float z, float feed_rate = 0.0) {
1699 1704
     do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z, feed_rate);
1700 1705
   }
@@ -2704,6 +2709,21 @@ inline void gcode_G4() {
2704 2709
 
2705 2710
 #endif //FWRETRACT
2706 2711
 
2712
+#if ENABLED(NOZZLE_CLEAN_FEATURE) && ENABLED(AUTO_BED_LEVELING_FEATURE)
2713
+  #include "nozzle.h"
2714
+
2715
+  inline void gcode_G12() {
2716
+    // Don't allow nozzle cleaning without homing first
2717
+    if (axis_unhomed_error(true, true, true)) { return; }
2718
+
2719
+    uint8_t const pattern = code_seen('P') ? code_value_ushort() : 0;
2720
+    uint8_t const strokes = code_seen('S') ? code_value_ushort() : NOZZLE_CLEAN_STROKES;
2721
+    uint8_t const objects = code_seen('T') ? code_value_ushort() : 3;
2722
+
2723
+    Nozzle::clean(pattern, strokes, objects);
2724
+  }
2725
+#endif
2726
+
2707 2727
 #if ENABLED(INCH_MODE_SUPPORT)
2708 2728
   /**
2709 2729
    * G20: Set input mode to inches
@@ -6750,12 +6770,10 @@ void process_next_command() {
6750 6770
 
6751 6771
       // G2, G3
6752 6772
       #if ENABLED(ARC_SUPPORT) && DISABLED(SCARA)
6753
-
6754 6773
         case 2: // G2  - CW ARC
6755 6774
         case 3: // G3  - CCW ARC
6756 6775
           gcode_G2_G3(codenum == 2);
6757 6776
           break;
6758
-
6759 6777
       #endif
6760 6778
 
6761 6779
       // G4 Dwell
@@ -6764,23 +6782,25 @@ void process_next_command() {
6764 6782
         break;
6765 6783
 
6766 6784
       #if ENABLED(BEZIER_CURVE_SUPPORT)
6767
-
6768 6785
         // G5
6769 6786
         case 5: // G5  - Cubic B_spline
6770 6787
           gcode_G5();
6771 6788
           break;
6772
-
6773 6789
       #endif // BEZIER_CURVE_SUPPORT
6774 6790
 
6775 6791
       #if ENABLED(FWRETRACT)
6776
-
6777 6792
         case 10: // G10: retract
6778 6793
         case 11: // G11: retract_recover
6779 6794
           gcode_G10_G11(codenum == 10);
6780 6795
           break;
6781
-
6782 6796
       #endif // FWRETRACT
6783 6797
 
6798
+      #if ENABLED(NOZZLE_CLEAN_FEATURE) && HAS_BED_PROBE
6799
+        case 12:
6800
+          gcode_G12(); // G12: Clean Nozzle
6801
+          break;
6802
+      #endif // NOZZLE_CLEAN_FEATURE
6803
+
6784 6804
       #if ENABLED(INCH_MODE_SUPPORT)
6785 6805
         case 20: //G20: Inch Mode
6786 6806
           gcode_G20();
@@ -6789,7 +6809,7 @@ void process_next_command() {
6789 6809
         case 21: //G21: MM Mode
6790 6810
           gcode_G21();
6791 6811
           break;
6792
-      #endif
6812
+      #endif // INCH_MODE_SUPPORT
6793 6813
 
6794 6814
       case 28: // G28: Home all axes, one at a time
6795 6815
         gcode_G28();
@@ -6799,7 +6819,7 @@ void process_next_command() {
6799 6819
         case 29: // G29 Detailed Z probe, probes the bed at 3 or more points.
6800 6820
           gcode_G29();
6801 6821
           break;
6802
-      #endif
6822
+      #endif // AUTO_BED_LEVELING_FEATURE
6803 6823
 
6804 6824
       #if HAS_BED_PROBE
6805 6825
 
@@ -6818,7 +6838,6 @@ void process_next_command() {
6818 6838
               break;
6819 6839
 
6820 6840
         #endif // Z_PROBE_SLED
6821
-
6822 6841
       #endif // HAS_BED_PROBE
6823 6842
 
6824 6843
       case 90: // G90
@@ -6847,7 +6866,6 @@ void process_next_command() {
6847 6866
         break;
6848 6867
 
6849 6868
       #if ENABLED(SDSUPPORT)
6850
-
6851 6869
         case 20: // M20 - list SD card
6852 6870
           gcode_M20(); break;
6853 6871
         case 21: // M21 - init SD card
@@ -6880,7 +6898,6 @@ void process_next_command() {
6880 6898
 
6881 6899
         case 928: //M928 - Start SD write
6882 6900
           gcode_M928(); break;
6883
-
6884 6901
       #endif //SDSUPPORT
6885 6902
 
6886 6903
       case 31: //M31 take time since the start of the SD print or an M109 command
@@ -6950,11 +6967,9 @@ void process_next_command() {
6950 6967
       #endif
6951 6968
 
6952 6969
       #if ENABLED(HOST_KEEPALIVE_FEATURE)
6953
-
6954 6970
         case 113: // M113: Set Host Keepalive interval
6955 6971
           gcode_M113();
6956 6972
           break;
6957
-
6958 6973
       #endif
6959 6974
 
6960 6975
       case 140: // M140: Set bed temp

+ 7
- 0
Marlin/SanityCheck.h View File

@@ -646,4 +646,11 @@
646 646
   #error "ABS_PREHEAT_FAN_SPEED is now PREHEAT_2_FAN_SPEED. Please update your configuration."
647 647
 #endif
648 648
 
649
+/**
650
+ * Nozzle cleaning
651
+ */
652
+#if ENABLED(NOZZLE_CLEAN_FEATURE) && !HAS_BED_PROBE
653
+  #error Due to internal dependencies you must have a bed probe for NOZZLE_CLEAN_FEATURE to work
654
+#endif
655
+
649 656
 #endif //SANITYCHECK_H

+ 51
- 3
Marlin/example_configurations/Cartesio/Configuration.h View File

@@ -268,12 +268,12 @@
268 268
     #define  DEFAULT_Kp 18
269 269
     #define  DEFAULT_Ki 1
270 270
     #define  DEFAULT_Kd 100
271
-    
271
+
272 272
     // Cartesio extruderV6 40W Volcano
273 273
     //#define  DEFAULT_Kp 50
274 274
     //#define  DEFAULT_Ki 9
275 275
     //#define  DEFAULT_Kd 70
276
-    
276
+
277 277
     // Cartesio extruderV6 40W Cyclops
278 278
     //#define  DEFAULT_Kp 18
279 279
     //#define  DEFAULT_Ki 1
@@ -313,7 +313,7 @@
313 313
     #define  DEFAULT_bedKp 390
314 314
     #define  DEFAULT_bedKi 70
315 315
     #define  DEFAULT_bedKd 546
316
-   
316
+
317 317
     //24V 250W silicone heater on to 4mm glass CartesioM
318 318
     //#define  DEFAULT_bedKp 303
319 319
     //#define  DEFAULT_bedKi 42
@@ -787,6 +787,54 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
787 787
 #define PREHEAT_2_FAN_SPEED     0 // Value from 0 to 255
788 788
 
789 789
 //
790
+// Clean Nozzle Feature -- EXPERIMENTAL
791
+//
792
+// When enabled allows the user to send G12 to start the nozzle cleaning
793
+// process, the G-Code accepts two parameters:
794
+//   "P" for pattern selection
795
+//   "S" for defining the number of strokes/repetitions
796
+//
797
+// Available list of patterns:
798
+//   P0: This is the default pattern, this process requires a sponge type
799
+//       material at a fixed bed location, the cleaning process is based on
800
+//       "strokes" i.e. back-and-forth movements between the starting and end
801
+//       points.
802
+//
803
+//   P1: This starts a zig-zag pattern between (X0, Y0) and (X1, Y1), "T"
804
+//       defines the number of zig-zag triangles to be done. "S" defines the
805
+//       number of strokes aka one back-and-forth movement. As an example
806
+//       sending "G12 P1 S1 T3" will execute:
807
+//
808
+//          --
809
+//         |  (X0, Y1) |     /\        /\        /\     | (X1, Y1)
810
+//         |           |    /  \      /  \      /  \    |
811
+//       A |           |   /    \    /    \    /    \   |
812
+//         |           |  /      \  /      \  /      \  |
813
+//         |  (X0, Y0) | /        \/        \/        \ | (X1, Y0)
814
+//          --         +--------------------------------+
815
+//                       |________|_________|_________|
816
+//                           T1        T2        T3
817
+//
818
+// Caveats: End point Z should use the same value as Start point Z.
819
+//
820
+// Attention: This is an EXPERIMENTAL feature, in the future the G-code arguments
821
+// may change to add new functionality like different wipe patterns.
822
+//
823
+//#define NOZZLE_CLEAN_FEATURE
824
+
825
+#if ENABLED(NOZZLE_CLEAN_FEATURE)
826
+  // Number of pattern repetitions
827
+  #define NOZZLE_CLEAN_STROKES  12
828
+
829
+  //                            {  X,  Y,               Z}
830
+  #define NOZZLE_CLEAN_START_PT { 30, 30, (Z_MIN_POS + 5)}
831
+  #define NOZZLE_CLEAN_END_PT   {100, 60, (Z_MIN_POS + 5)}
832
+
833
+  // Moves the nozzle to the parked position
834
+  #define NOZZLE_CLEAN_PARK
835
+#endif
836
+
837
+//
790 838
 // Print job timer
791 839
 //
792 840
 // Enable this option to automatically start and stop the

+ 48
- 0
Marlin/example_configurations/Felix/Configuration.h View File

@@ -771,6 +771,54 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
771 771
 #define PREHEAT_2_FAN_SPEED   255 // Value from 0 to 255
772 772
 
773 773
 //
774
+// Clean Nozzle Feature -- EXPERIMENTAL
775
+//
776
+// When enabled allows the user to send G12 to start the nozzle cleaning
777
+// process, the G-Code accepts two parameters:
778
+//   "P" for pattern selection
779
+//   "S" for defining the number of strokes/repetitions
780
+//
781
+// Available list of patterns:
782
+//   P0: This is the default pattern, this process requires a sponge type
783
+//       material at a fixed bed location, the cleaning process is based on
784
+//       "strokes" i.e. back-and-forth movements between the starting and end
785
+//       points.
786
+//
787
+//   P1: This starts a zig-zag pattern between (X0, Y0) and (X1, Y1), "T"
788
+//       defines the number of zig-zag triangles to be done. "S" defines the
789
+//       number of strokes aka one back-and-forth movement. As an example
790
+//       sending "G12 P1 S1 T3" will execute:
791
+//
792
+//          --
793
+//         |  (X0, Y1) |     /\        /\        /\     | (X1, Y1)
794
+//         |           |    /  \      /  \      /  \    |
795
+//       A |           |   /    \    /    \    /    \   |
796
+//         |           |  /      \  /      \  /      \  |
797
+//         |  (X0, Y0) | /        \/        \/        \ | (X1, Y0)
798
+//          --         +--------------------------------+
799
+//                       |________|_________|_________|
800
+//                           T1        T2        T3
801
+//
802
+// Caveats: End point Z should use the same value as Start point Z.
803
+//
804
+// Attention: This is an EXPERIMENTAL feature, in the future the G-code arguments
805
+// may change to add new functionality like different wipe patterns.
806
+//
807
+//#define NOZZLE_CLEAN_FEATURE
808
+
809
+#if ENABLED(NOZZLE_CLEAN_FEATURE)
810
+  // Number of pattern repetitions
811
+  #define NOZZLE_CLEAN_STROKES  12
812
+
813
+  //                            {  X,  Y,               Z}
814
+  #define NOZZLE_CLEAN_START_PT { 30, 30, (Z_MIN_POS + 5)}
815
+  #define NOZZLE_CLEAN_END_PT   {100, 60, (Z_MIN_POS + 5)}
816
+
817
+  // Moves the nozzle to the parked position
818
+  #define NOZZLE_CLEAN_PARK
819
+#endif
820
+
821
+//
774 822
 // Print job timer
775 823
 //
776 824
 // Enable this option to automatically start and stop the

+ 48
- 0
Marlin/example_configurations/Felix/DUAL/Configuration.h View File

@@ -769,6 +769,54 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
769 769
 #define PREHEAT_2_FAN_SPEED   255 // Value from 0 to 255
770 770
 
771 771
 //
772
+// Clean Nozzle Feature -- EXPERIMENTAL
773
+//
774
+// When enabled allows the user to send G12 to start the nozzle cleaning
775
+// process, the G-Code accepts two parameters:
776
+//   "P" for pattern selection
777
+//   "S" for defining the number of strokes/repetitions
778
+//
779
+// Available list of patterns:
780
+//   P0: This is the default pattern, this process requires a sponge type
781
+//       material at a fixed bed location, the cleaning process is based on
782
+//       "strokes" i.e. back-and-forth movements between the starting and end
783
+//       points.
784
+//
785
+//   P1: This starts a zig-zag pattern between (X0, Y0) and (X1, Y1), "T"
786
+//       defines the number of zig-zag triangles to be done. "S" defines the
787
+//       number of strokes aka one back-and-forth movement. As an example
788
+//       sending "G12 P1 S1 T3" will execute:
789
+//
790
+//          --
791
+//         |  (X0, Y1) |     /\        /\        /\     | (X1, Y1)
792
+//         |           |    /  \      /  \      /  \    |
793
+//       A |           |   /    \    /    \    /    \   |
794
+//         |           |  /      \  /      \  /      \  |
795
+//         |  (X0, Y0) | /        \/        \/        \ | (X1, Y0)
796
+//          --         +--------------------------------+
797
+//                       |________|_________|_________|
798
+//                           T1        T2        T3
799
+//
800
+// Caveats: End point Z should use the same value as Start point Z.
801
+//
802
+// Attention: This is an EXPERIMENTAL feature, in the future the G-code arguments
803
+// may change to add new functionality like different wipe patterns.
804
+//
805
+//#define NOZZLE_CLEAN_FEATURE
806
+
807
+#if ENABLED(NOZZLE_CLEAN_FEATURE)
808
+  // Number of pattern repetitions
809
+  #define NOZZLE_CLEAN_STROKES  12
810
+
811
+  //                            {  X,  Y,               Z}
812
+  #define NOZZLE_CLEAN_START_PT { 30, 30, (Z_MIN_POS + 5)}
813
+  #define NOZZLE_CLEAN_END_PT   {100, 60, (Z_MIN_POS + 5)}
814
+
815
+  // Moves the nozzle to the parked position
816
+  #define NOZZLE_CLEAN_PARK
817
+#endif
818
+
819
+//
772 820
 // Print job timer
773 821
 //
774 822
 // Enable this option to automatically start and stop the

+ 48
- 0
Marlin/example_configurations/Hephestos/Configuration.h View File

@@ -780,6 +780,54 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo
780 780
 #define PREHEAT_2_FAN_SPEED   255 // Value from 0 to 255
781 781
 
782 782
 //
783
+// Clean Nozzle Feature -- EXPERIMENTAL
784
+//
785
+// When enabled allows the user to send G12 to start the nozzle cleaning
786
+// process, the G-Code accepts two parameters:
787
+//   "P" for pattern selection
788
+//   "S" for defining the number of strokes/repetitions
789
+//
790
+// Available list of patterns:
791
+//   P0: This is the default pattern, this process requires a sponge type
792
+//       material at a fixed bed location, the cleaning process is based on
793
+//       "strokes" i.e. back-and-forth movements between the starting and end
794
+//       points.
795
+//
796
+//   P1: This starts a zig-zag pattern between (X0, Y0) and (X1, Y1), "T"
797
+//       defines the number of zig-zag triangles to be done. "S" defines the
798
+//       number of strokes aka one back-and-forth movement. As an example
799
+//       sending "G12 P1 S1 T3" will execute:
800
+//
801
+//          --
802
+//         |  (X0, Y1) |     /\        /\        /\     | (X1, Y1)
803
+//         |           |    /  \      /  \      /  \    |
804
+//       A |           |   /    \    /    \    /    \   |
805
+//         |           |  /      \  /      \  /      \  |
806
+//         |  (X0, Y0) | /        \/        \/        \ | (X1, Y0)
807
+//          --         +--------------------------------+
808
+//                       |________|_________|_________|
809
+//                           T1        T2        T3
810
+//
811
+// Caveats: End point Z should use the same value as Start point Z.
812
+//
813
+// Attention: This is an EXPERIMENTAL feature, in the future the G-code arguments
814
+// may change to add new functionality like different wipe patterns.
815
+//
816
+//#define NOZZLE_CLEAN_FEATURE
817
+
818
+#if ENABLED(NOZZLE_CLEAN_FEATURE)
819
+  // Number of pattern repetitions
820
+  #define NOZZLE_CLEAN_STROKES  12
821
+
822
+  //                            {  X,  Y,               Z}
823
+  #define NOZZLE_CLEAN_START_PT { 30, 30, (Z_MIN_POS + 5)}
824
+  #define NOZZLE_CLEAN_END_PT   {100, 60, (Z_MIN_POS + 5)}
825
+
826
+  // Moves the nozzle to the parked position
827
+  #define NOZZLE_CLEAN_PARK
828
+#endif
829
+
830
+//
783 831
 // Print job timer
784 832
 //
785 833
 // Enable this option to automatically start and stop the

+ 48
- 0
Marlin/example_configurations/Hephestos_2/Configuration.h View File

@@ -782,6 +782,54 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
782 782
 #define PREHEAT_2_FAN_SPEED     0 // Value from 0 to 255
783 783
 
784 784
 //
785
+// Clean Nozzle Feature -- EXPERIMENTAL
786
+//
787
+// When enabled allows the user to send G12 to start the nozzle cleaning
788
+// process, the G-Code accepts two parameters:
789
+//   "P" for pattern selection
790
+//   "S" for defining the number of strokes/repetitions
791
+//
792
+// Available list of patterns:
793
+//   P0: This is the default pattern, this process requires a sponge type
794
+//       material at a fixed bed location, the cleaning process is based on
795
+//       "strokes" i.e. back-and-forth movements between the starting and end
796
+//       points.
797
+//
798
+//   P1: This starts a zig-zag pattern between (X0, Y0) and (X1, Y1), "T"
799
+//       defines the number of zig-zag triangles to be done. "S" defines the
800
+//       number of strokes aka one back-and-forth movement. As an example
801
+//       sending "G12 P1 S1 T3" will execute:
802
+//
803
+//          --
804
+//         |  (X0, Y1) |     /\        /\        /\     | (X1, Y1)
805
+//         |           |    /  \      /  \      /  \    |
806
+//       A |           |   /    \    /    \    /    \   |
807
+//         |           |  /      \  /      \  /      \  |
808
+//         |  (X0, Y0) | /        \/        \/        \ | (X1, Y0)
809
+//          --         +--------------------------------+
810
+//                       |________|_________|_________|
811
+//                           T1        T2        T3
812
+//
813
+// Caveats: End point Z should use the same value as Start point Z.
814
+//
815
+// Attention: This is an EXPERIMENTAL feature, in the future the G-code arguments
816
+// may change to add new functionality like different wipe patterns.
817
+//
818
+//#define NOZZLE_CLEAN_FEATURE
819
+
820
+#if ENABLED(NOZZLE_CLEAN_FEATURE)
821
+  // Number of pattern repetitions
822
+  #define NOZZLE_CLEAN_STROKES  12
823
+
824
+  //                            {  X,  Y,               Z}
825
+  #define NOZZLE_CLEAN_START_PT { 30, 30, (Z_MIN_POS + 5)}
826
+  #define NOZZLE_CLEAN_END_PT   {100, 60, (Z_MIN_POS + 5)}
827
+
828
+  // Moves the nozzle to the parked position
829
+  #define NOZZLE_CLEAN_PARK
830
+#endif
831
+
832
+//
785 833
 // Print job timer
786 834
 //
787 835
 // Enable this option to automatically start and stop the

+ 48
- 0
Marlin/example_configurations/K8200/Configuration.h View File

@@ -805,6 +805,54 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
805 805
 #define PREHEAT_2_FAN_SPEED     0 // Value from 0 to 255
806 806
 
807 807
 //
808
+// Clean Nozzle Feature -- EXPERIMENTAL
809
+//
810
+// When enabled allows the user to send G12 to start the nozzle cleaning
811
+// process, the G-Code accepts two parameters:
812
+//   "P" for pattern selection
813
+//   "S" for defining the number of strokes/repetitions
814
+//
815
+// Available list of patterns:
816
+//   P0: This is the default pattern, this process requires a sponge type
817
+//       material at a fixed bed location, the cleaning process is based on
818
+//       "strokes" i.e. back-and-forth movements between the starting and end
819
+//       points.
820
+//
821
+//   P1: This starts a zig-zag pattern between (X0, Y0) and (X1, Y1), "T"
822
+//       defines the number of zig-zag triangles to be done. "S" defines the
823
+//       number of strokes aka one back-and-forth movement. As an example
824
+//       sending "G12 P1 S1 T3" will execute:
825
+//
826
+//          --
827
+//         |  (X0, Y1) |     /\        /\        /\     | (X1, Y1)
828
+//         |           |    /  \      /  \      /  \    |
829
+//       A |           |   /    \    /    \    /    \   |
830
+//         |           |  /      \  /      \  /      \  |
831
+//         |  (X0, Y0) | /        \/        \/        \ | (X1, Y0)
832
+//          --         +--------------------------------+
833
+//                       |________|_________|_________|
834
+//                           T1        T2        T3
835
+//
836
+// Caveats: End point Z should use the same value as Start point Z.
837
+//
838
+// Attention: This is an EXPERIMENTAL feature, in the future the G-code arguments
839
+// may change to add new functionality like different wipe patterns.
840
+//
841
+//#define NOZZLE_CLEAN_FEATURE
842
+
843
+#if ENABLED(NOZZLE_CLEAN_FEATURE)
844
+  // Number of pattern repetitions
845
+  #define NOZZLE_CLEAN_STROKES  12
846
+
847
+  //                            {  X,  Y,               Z}
848
+  #define NOZZLE_CLEAN_START_PT { 30, 30, (Z_MIN_POS + 5)}
849
+  #define NOZZLE_CLEAN_END_PT   {100, 60, (Z_MIN_POS + 5)}
850
+
851
+  // Moves the nozzle to the parked position
852
+  #define NOZZLE_CLEAN_PARK
853
+#endif
854
+
855
+//
808 856
 // Print job timer
809 857
 //
810 858
 // Enable this option to automatically start and stop the

+ 48
- 0
Marlin/example_configurations/K8400/Configuration.h View File

@@ -788,6 +788,54 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo
788 788
 #define PREHEAT_2_FAN_SPEED   165 // Value from 0 to 255
789 789
 
790 790
 //
791
+// Clean Nozzle Feature -- EXPERIMENTAL
792
+//
793
+// When enabled allows the user to send G12 to start the nozzle cleaning
794
+// process, the G-Code accepts two parameters:
795
+//   "P" for pattern selection
796
+//   "S" for defining the number of strokes/repetitions
797
+//
798
+// Available list of patterns:
799
+//   P0: This is the default pattern, this process requires a sponge type
800
+//       material at a fixed bed location, the cleaning process is based on
801
+//       "strokes" i.e. back-and-forth movements between the starting and end
802
+//       points.
803
+//
804
+//   P1: This starts a zig-zag pattern between (X0, Y0) and (X1, Y1), "T"
805
+//       defines the number of zig-zag triangles to be done. "S" defines the
806
+//       number of strokes aka one back-and-forth movement. As an example
807
+//       sending "G12 P1 S1 T3" will execute:
808
+//
809
+//          --
810
+//         |  (X0, Y1) |     /\        /\        /\     | (X1, Y1)
811
+//         |           |    /  \      /  \      /  \    |
812
+//       A |           |   /    \    /    \    /    \   |
813
+//         |           |  /      \  /      \  /      \  |
814
+//         |  (X0, Y0) | /        \/        \/        \ | (X1, Y0)
815
+//          --         +--------------------------------+
816
+//                       |________|_________|_________|
817
+//                           T1        T2        T3
818
+//
819
+// Caveats: End point Z should use the same value as Start point Z.
820
+//
821
+// Attention: This is an EXPERIMENTAL feature, in the future the G-code arguments
822
+// may change to add new functionality like different wipe patterns.
823
+//
824
+//#define NOZZLE_CLEAN_FEATURE
825
+
826
+#if ENABLED(NOZZLE_CLEAN_FEATURE)
827
+  // Number of pattern repetitions
828
+  #define NOZZLE_CLEAN_STROKES  12
829
+
830
+  //                            {  X,  Y,               Z}
831
+  #define NOZZLE_CLEAN_START_PT { 30, 30, (Z_MIN_POS + 5)}
832
+  #define NOZZLE_CLEAN_END_PT   {100, 60, (Z_MIN_POS + 5)}
833
+
834
+  // Moves the nozzle to the parked position
835
+  #define NOZZLE_CLEAN_PARK
836
+#endif
837
+
838
+//
791 839
 // Print job timer
792 840
 //
793 841
 // Enable this option to automatically start and stop the

Marlin/example_configurations/K8400/Dual Heads/Configuration.h → Marlin/example_configurations/K8400/Dual-head/Configuration.h View File

@@ -788,6 +788,54 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo
788 788
 #define PREHEAT_2_FAN_SPEED   165 // Value from 0 to 255
789 789
 
790 790
 //
791
+// Clean Nozzle Feature -- EXPERIMENTAL
792
+//
793
+// When enabled allows the user to send G12 to start the nozzle cleaning
794
+// process, the G-Code accepts two parameters:
795
+//   "P" for pattern selection
796
+//   "S" for defining the number of strokes/repetitions
797
+//
798
+// Available list of patterns:
799
+//   P0: This is the default pattern, this process requires a sponge type
800
+//       material at a fixed bed location, the cleaning process is based on
801
+//       "strokes" i.e. back-and-forth movements between the starting and end
802
+//       points.
803
+//
804
+//   P1: This starts a zig-zag pattern between (X0, Y0) and (X1, Y1), "T"
805
+//       defines the number of zig-zag triangles to be done. "S" defines the
806
+//       number of strokes aka one back-and-forth movement. As an example
807
+//       sending "G12 P1 S1 T3" will execute:
808
+//
809
+//          --
810
+//         |  (X0, Y1) |     /\        /\        /\     | (X1, Y1)
811
+//         |           |    /  \      /  \      /  \    |
812
+//       A |           |   /    \    /    \    /    \   |
813
+//         |           |  /      \  /      \  /      \  |
814
+//         |  (X0, Y0) | /        \/        \/        \ | (X1, Y0)
815
+//          --         +--------------------------------+
816
+//                       |________|_________|_________|
817
+//                           T1        T2        T3
818
+//
819
+// Caveats: End point Z should use the same value as Start point Z.
820
+//
821
+// Attention: This is an EXPERIMENTAL feature, in the future the G-code arguments
822
+// may change to add new functionality like different wipe patterns.
823
+//
824
+//#define NOZZLE_CLEAN_FEATURE
825
+
826
+#if ENABLED(NOZZLE_CLEAN_FEATURE)
827
+  // Number of pattern repetitions
828
+  #define NOZZLE_CLEAN_STROKES  12
829
+
830
+  //                            {  X,  Y,               Z}
831
+  #define NOZZLE_CLEAN_START_PT { 30, 30, (Z_MIN_POS + 5)}
832
+  #define NOZZLE_CLEAN_END_PT   {100, 60, (Z_MIN_POS + 5)}
833
+
834
+  // Moves the nozzle to the parked position
835
+  #define NOZZLE_CLEAN_PARK
836
+#endif
837
+
838
+//
791 839
 // Print job timer
792 840
 //
793 841
 // Enable this option to automatically start and stop the

+ 48
- 0
Marlin/example_configurations/RepRapWorld/Megatronics/Configuration.h View File

@@ -788,6 +788,54 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
788 788
 #define PREHEAT_2_FAN_SPEED     0 // Value from 0 to 255
789 789
 
790 790
 //
791
+// Clean Nozzle Feature -- EXPERIMENTAL
792
+//
793
+// When enabled allows the user to send G12 to start the nozzle cleaning
794
+// process, the G-Code accepts two parameters:
795
+//   "P" for pattern selection
796
+//   "S" for defining the number of strokes/repetitions
797
+//
798
+// Available list of patterns:
799
+//   P0: This is the default pattern, this process requires a sponge type
800
+//       material at a fixed bed location, the cleaning process is based on
801
+//       "strokes" i.e. back-and-forth movements between the starting and end
802
+//       points.
803
+//
804
+//   P1: This starts a zig-zag pattern between (X0, Y0) and (X1, Y1), "T"
805
+//       defines the number of zig-zag triangles to be done. "S" defines the
806
+//       number of strokes aka one back-and-forth movement. As an example
807
+//       sending "G12 P1 S1 T3" will execute:
808
+//
809
+//          --
810
+//         |  (X0, Y1) |     /\        /\        /\     | (X1, Y1)
811
+//         |           |    /  \      /  \      /  \    |
812
+//       A |           |   /    \    /    \    /    \   |
813
+//         |           |  /      \  /      \  /      \  |
814
+//         |  (X0, Y0) | /        \/        \/        \ | (X1, Y0)
815
+//          --         +--------------------------------+
816
+//                       |________|_________|_________|
817
+//                           T1        T2        T3
818
+//
819
+// Caveats: End point Z should use the same value as Start point Z.
820
+//
821
+// Attention: This is an EXPERIMENTAL feature, in the future the G-code arguments
822
+// may change to add new functionality like different wipe patterns.
823
+//
824
+//#define NOZZLE_CLEAN_FEATURE
825
+
826
+#if ENABLED(NOZZLE_CLEAN_FEATURE)
827
+  // Number of pattern repetitions
828
+  #define NOZZLE_CLEAN_STROKES  12
829
+
830
+  //                            {  X,  Y,               Z}
831
+  #define NOZZLE_CLEAN_START_PT { 30, 30, (Z_MIN_POS + 5)}
832
+  #define NOZZLE_CLEAN_END_PT   {100, 60, (Z_MIN_POS + 5)}
833
+
834
+  // Moves the nozzle to the parked position
835
+  #define NOZZLE_CLEAN_PARK
836
+#endif
837
+
838
+//
791 839
 // Print job timer
792 840
 //
793 841
 // Enable this option to automatically start and stop the

+ 48
- 0
Marlin/example_configurations/RigidBot/Configuration.h View File

@@ -786,6 +786,54 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
786 786
 #define PREHEAT_2_FAN_SPEED   255 // Value from 0 to 255
787 787
 
788 788
 //
789
+// Clean Nozzle Feature -- EXPERIMENTAL
790
+//
791
+// When enabled allows the user to send G12 to start the nozzle cleaning
792
+// process, the G-Code accepts two parameters:
793
+//   "P" for pattern selection
794
+//   "S" for defining the number of strokes/repetitions
795
+//
796
+// Available list of patterns:
797
+//   P0: This is the default pattern, this process requires a sponge type
798
+//       material at a fixed bed location, the cleaning process is based on
799
+//       "strokes" i.e. back-and-forth movements between the starting and end
800
+//       points.
801
+//
802
+//   P1: This starts a zig-zag pattern between (X0, Y0) and (X1, Y1), "T"
803
+//       defines the number of zig-zag triangles to be done. "S" defines the
804
+//       number of strokes aka one back-and-forth movement. As an example
805
+//       sending "G12 P1 S1 T3" will execute:
806
+//
807
+//          --
808
+//         |  (X0, Y1) |     /\        /\        /\     | (X1, Y1)
809
+//         |           |    /  \      /  \      /  \    |
810
+//       A |           |   /    \    /    \    /    \   |
811
+//         |           |  /      \  /      \  /      \  |
812
+//         |  (X0, Y0) | /        \/        \/        \ | (X1, Y0)
813
+//          --         +--------------------------------+
814
+//                       |________|_________|_________|
815
+//                           T1        T2        T3
816
+//
817
+// Caveats: End point Z should use the same value as Start point Z.
818
+//
819
+// Attention: This is an EXPERIMENTAL feature, in the future the G-code arguments
820
+// may change to add new functionality like different wipe patterns.
821
+//
822
+//#define NOZZLE_CLEAN_FEATURE
823
+
824
+#if ENABLED(NOZZLE_CLEAN_FEATURE)
825
+  // Number of pattern repetitions
826
+  #define NOZZLE_CLEAN_STROKES  12
827
+
828
+  //                            {  X,  Y,               Z}
829
+  #define NOZZLE_CLEAN_START_PT { 30, 30, (Z_MIN_POS + 5)}
830
+  #define NOZZLE_CLEAN_END_PT   {100, 60, (Z_MIN_POS + 5)}
831
+
832
+  // Moves the nozzle to the parked position
833
+  #define NOZZLE_CLEAN_PARK
834
+#endif
835
+
836
+//
789 837
 // Print job timer
790 838
 //
791 839
 // Enable this option to automatically start and stop the

+ 48
- 0
Marlin/example_configurations/SCARA/Configuration.h View File

@@ -796,6 +796,54 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
796 796
 #define PREHEAT_2_FAN_SPEED   255 // Value from 0 to 255
797 797
 
798 798
 //
799
+// Clean Nozzle Feature -- EXPERIMENTAL
800
+//
801
+// When enabled allows the user to send G12 to start the nozzle cleaning
802
+// process, the G-Code accepts two parameters:
803
+//   "P" for pattern selection
804
+//   "S" for defining the number of strokes/repetitions
805
+//
806
+// Available list of patterns:
807
+//   P0: This is the default pattern, this process requires a sponge type
808
+//       material at a fixed bed location, the cleaning process is based on
809
+//       "strokes" i.e. back-and-forth movements between the starting and end
810
+//       points.
811
+//
812
+//   P1: This starts a zig-zag pattern between (X0, Y0) and (X1, Y1), "T"
813
+//       defines the number of zig-zag triangles to be done. "S" defines the
814
+//       number of strokes aka one back-and-forth movement. As an example
815
+//       sending "G12 P1 S1 T3" will execute:
816
+//
817
+//          --
818
+//         |  (X0, Y1) |     /\        /\        /\     | (X1, Y1)
819
+//         |           |    /  \      /  \      /  \    |
820
+//       A |           |   /    \    /    \    /    \   |
821
+//         |           |  /      \  /      \  /      \  |
822
+//         |  (X0, Y0) | /        \/        \/        \ | (X1, Y0)
823
+//          --         +--------------------------------+
824
+//                       |________|_________|_________|
825
+//                           T1        T2        T3
826
+//
827
+// Caveats: End point Z should use the same value as Start point Z.
828
+//
829
+// Attention: This is an EXPERIMENTAL feature, in the future the G-code arguments
830
+// may change to add new functionality like different wipe patterns.
831
+//
832
+//#define NOZZLE_CLEAN_FEATURE
833
+
834
+#if ENABLED(NOZZLE_CLEAN_FEATURE)
835
+  // Number of pattern repetitions
836
+  #define NOZZLE_CLEAN_STROKES  12
837
+
838
+  //                            {  X,  Y,               Z}
839
+  #define NOZZLE_CLEAN_START_PT { 30, 30, (Z_MIN_POS + 5)}
840
+  #define NOZZLE_CLEAN_END_PT   {100, 60, (Z_MIN_POS + 5)}
841
+
842
+  // Moves the nozzle to the parked position
843
+  #define NOZZLE_CLEAN_PARK
844
+#endif
845
+
846
+//
799 847
 // Print job timer
800 848
 //
801 849
 // Enable this option to automatically start and stop the

+ 48
- 0
Marlin/example_configurations/TAZ4/Configuration.h View File

@@ -809,6 +809,54 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
809 809
 #define PREHEAT_2_FAN_SPEED     0 // Value from 0 to 255
810 810
 
811 811
 //
812
+// Clean Nozzle Feature -- EXPERIMENTAL
813
+//
814
+// When enabled allows the user to send G12 to start the nozzle cleaning
815
+// process, the G-Code accepts two parameters:
816
+//   "P" for pattern selection
817
+//   "S" for defining the number of strokes/repetitions
818
+//
819
+// Available list of patterns:
820
+//   P0: This is the default pattern, this process requires a sponge type
821
+//       material at a fixed bed location, the cleaning process is based on
822
+//       "strokes" i.e. back-and-forth movements between the starting and end
823
+//       points.
824
+//
825
+//   P1: This starts a zig-zag pattern between (X0, Y0) and (X1, Y1), "T"
826
+//       defines the number of zig-zag triangles to be done. "S" defines the
827
+//       number of strokes aka one back-and-forth movement. As an example
828
+//       sending "G12 P1 S1 T3" will execute:
829
+//
830
+//          --
831
+//         |  (X0, Y1) |     /\        /\        /\     | (X1, Y1)
832
+//         |           |    /  \      /  \      /  \    |
833
+//       A |           |   /    \    /    \    /    \   |
834
+//         |           |  /      \  /      \  /      \  |
835
+//         |  (X0, Y0) | /        \/        \/        \ | (X1, Y0)
836
+//          --         +--------------------------------+
837
+//                       |________|_________|_________|
838
+//                           T1        T2        T3
839
+//
840
+// Caveats: End point Z should use the same value as Start point Z.
841
+//
842
+// Attention: This is an EXPERIMENTAL feature, in the future the G-code arguments
843
+// may change to add new functionality like different wipe patterns.
844
+//
845
+//#define NOZZLE_CLEAN_FEATURE
846
+
847
+#if ENABLED(NOZZLE_CLEAN_FEATURE)
848
+  // Number of pattern repetitions
849
+  #define NOZZLE_CLEAN_STROKES  12
850
+
851
+  //                            {  X,  Y,               Z}
852
+  #define NOZZLE_CLEAN_START_PT { 30, 30, (Z_MIN_POS + 5)}
853
+  #define NOZZLE_CLEAN_END_PT   {100, 60, (Z_MIN_POS + 5)}
854
+
855
+  // Moves the nozzle to the parked position
856
+  #define NOZZLE_CLEAN_PARK
857
+#endif
858
+
859
+//
812 860
 // Print job timer
813 861
 //
814 862
 // Enable this option to automatically start and stop the

+ 48
- 0
Marlin/example_configurations/WITBOX/Configuration.h View File

@@ -780,6 +780,54 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo
780 780
 #define PREHEAT_2_FAN_SPEED   255 // Value from 0 to 255
781 781
 
782 782
 //
783
+// Clean Nozzle Feature -- EXPERIMENTAL
784
+//
785
+// When enabled allows the user to send G12 to start the nozzle cleaning
786
+// process, the G-Code accepts two parameters:
787
+//   "P" for pattern selection
788
+//   "S" for defining the number of strokes/repetitions
789
+//
790
+// Available list of patterns:
791
+//   P0: This is the default pattern, this process requires a sponge type
792
+//       material at a fixed bed location, the cleaning process is based on
793
+//       "strokes" i.e. back-and-forth movements between the starting and end
794
+//       points.
795
+//
796
+//   P1: This starts a zig-zag pattern between (X0, Y0) and (X1, Y1), "T"
797
+//       defines the number of zig-zag triangles to be done. "S" defines the
798
+//       number of strokes aka one back-and-forth movement. As an example
799
+//       sending "G12 P1 S1 T3" will execute:
800
+//
801
+//          --
802
+//         |  (X0, Y1) |     /\        /\        /\     | (X1, Y1)
803
+//         |           |    /  \      /  \      /  \    |
804
+//       A |           |   /    \    /    \    /    \   |
805
+//         |           |  /      \  /      \  /      \  |
806
+//         |  (X0, Y0) | /        \/        \/        \ | (X1, Y0)
807
+//          --         +--------------------------------+
808
+//                       |________|_________|_________|
809
+//                           T1        T2        T3
810
+//
811
+// Caveats: End point Z should use the same value as Start point Z.
812
+//
813
+// Attention: This is an EXPERIMENTAL feature, in the future the G-code arguments
814
+// may change to add new functionality like different wipe patterns.
815
+//
816
+//#define NOZZLE_CLEAN_FEATURE
817
+
818
+#if ENABLED(NOZZLE_CLEAN_FEATURE)
819
+  // Number of pattern repetitions
820
+  #define NOZZLE_CLEAN_STROKES  12
821
+
822
+  //                            {  X,  Y,               Z}
823
+  #define NOZZLE_CLEAN_START_PT { 30, 30, (Z_MIN_POS + 5)}
824
+  #define NOZZLE_CLEAN_END_PT   {100, 60, (Z_MIN_POS + 5)}
825
+
826
+  // Moves the nozzle to the parked position
827
+  #define NOZZLE_CLEAN_PARK
828
+#endif
829
+
830
+//
783 831
 // Print job timer
784 832
 //
785 833
 // Enable this option to automatically start and stop the

+ 48
- 0
Marlin/example_configurations/adafruit/ST7565/Configuration.h View File

@@ -788,6 +788,54 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
788 788
 #define PREHEAT_2_FAN_SPEED     0 // Value from 0 to 255
789 789
 
790 790
 //
791
+// Clean Nozzle Feature -- EXPERIMENTAL
792
+//
793
+// When enabled allows the user to send G12 to start the nozzle cleaning
794
+// process, the G-Code accepts two parameters:
795
+//   "P" for pattern selection
796
+//   "S" for defining the number of strokes/repetitions
797
+//
798
+// Available list of patterns:
799
+//   P0: This is the default pattern, this process requires a sponge type
800
+//       material at a fixed bed location, the cleaning process is based on
801
+//       "strokes" i.e. back-and-forth movements between the starting and end
802
+//       points.
803
+//
804
+//   P1: This starts a zig-zag pattern between (X0, Y0) and (X1, Y1), "T"
805
+//       defines the number of zig-zag triangles to be done. "S" defines the
806
+//       number of strokes aka one back-and-forth movement. As an example
807
+//       sending "G12 P1 S1 T3" will execute:
808
+//
809
+//          --
810
+//         |  (X0, Y1) |     /\        /\        /\     | (X1, Y1)
811
+//         |           |    /  \      /  \      /  \    |
812
+//       A |           |   /    \    /    \    /    \   |
813
+//         |           |  /      \  /      \  /      \  |
814
+//         |  (X0, Y0) | /        \/        \/        \ | (X1, Y0)
815
+//          --         +--------------------------------+
816
+//                       |________|_________|_________|
817
+//                           T1        T2        T3
818
+//
819
+// Caveats: End point Z should use the same value as Start point Z.
820
+//
821
+// Attention: This is an EXPERIMENTAL feature, in the future the G-code arguments
822
+// may change to add new functionality like different wipe patterns.
823
+//
824
+//#define NOZZLE_CLEAN_FEATURE
825
+
826
+#if ENABLED(NOZZLE_CLEAN_FEATURE)
827
+  // Number of pattern repetitions
828
+  #define NOZZLE_CLEAN_STROKES  12
829
+
830
+  //                            {  X,  Y,               Z}
831
+  #define NOZZLE_CLEAN_START_PT { 30, 30, (Z_MIN_POS + 5)}
832
+  #define NOZZLE_CLEAN_END_PT   {100, 60, (Z_MIN_POS + 5)}
833
+
834
+  // Moves the nozzle to the parked position
835
+  #define NOZZLE_CLEAN_PARK
836
+#endif
837
+
838
+//
791 839
 // Print job timer
792 840
 //
793 841
 // Enable this option to automatically start and stop the

+ 48
- 0
Marlin/example_configurations/delta/biv2.5/Configuration.h View File

@@ -883,6 +883,54 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo
883 883
 #define PREHEAT_2_FAN_SPEED   255 // Value from 0 to 255
884 884
 
885 885
 //
886
+// Clean Nozzle Feature -- EXPERIMENTAL
887
+//
888
+// When enabled allows the user to send G12 to start the nozzle cleaning
889
+// process, the G-Code accepts two parameters:
890
+//   "P" for pattern selection
891
+//   "S" for defining the number of strokes/repetitions
892
+//
893
+// Available list of patterns:
894
+//   P0: This is the default pattern, this process requires a sponge type
895
+//       material at a fixed bed location, the cleaning process is based on
896
+//       "strokes" i.e. back-and-forth movements between the starting and end
897
+//       points.
898
+//
899
+//   P1: This starts a zig-zag pattern between (X0, Y0) and (X1, Y1), "T"
900
+//       defines the number of zig-zag triangles to be done. "S" defines the
901
+//       number of strokes aka one back-and-forth movement. As an example
902
+//       sending "G12 P1 S1 T3" will execute:
903
+//
904
+//          --
905
+//         |  (X0, Y1) |     /\        /\        /\     | (X1, Y1)
906
+//         |           |    /  \      /  \      /  \    |
907
+//       A |           |   /    \    /    \    /    \   |
908
+//         |           |  /      \  /      \  /      \  |
909
+//         |  (X0, Y0) | /        \/        \/        \ | (X1, Y0)
910
+//          --         +--------------------------------+
911
+//                       |________|_________|_________|
912
+//                           T1        T2        T3
913
+//
914
+// Caveats: End point Z should use the same value as Start point Z.
915
+//
916
+// Attention: This is an EXPERIMENTAL feature, in the future the G-code arguments
917
+// may change to add new functionality like different wipe patterns.
918
+//
919
+//#define NOZZLE_CLEAN_FEATURE
920
+
921
+#if ENABLED(NOZZLE_CLEAN_FEATURE)
922
+  // Number of pattern repetitions
923
+  #define NOZZLE_CLEAN_STROKES  12
924
+
925
+  //                            {  X,  Y,               Z}
926
+  #define NOZZLE_CLEAN_START_PT { 30, 30, (Z_MIN_POS + 5)}
927
+  #define NOZZLE_CLEAN_END_PT   {100, 60, (Z_MIN_POS + 5)}
928
+
929
+  // Moves the nozzle to the parked position
930
+  #define NOZZLE_CLEAN_PARK
931
+#endif
932
+
933
+//
886 934
 // Print job timer
887 935
 //
888 936
 // Enable this option to automatically start and stop the

+ 48
- 0
Marlin/example_configurations/delta/generic/Configuration.h View File

@@ -877,6 +877,54 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo
877 877
 #define PREHEAT_2_FAN_SPEED   255 // Value from 0 to 255
878 878
 
879 879
 //
880
+// Clean Nozzle Feature -- EXPERIMENTAL
881
+//
882
+// When enabled allows the user to send G12 to start the nozzle cleaning
883
+// process, the G-Code accepts two parameters:
884
+//   "P" for pattern selection
885
+//   "S" for defining the number of strokes/repetitions
886
+//
887
+// Available list of patterns:
888
+//   P0: This is the default pattern, this process requires a sponge type
889
+//       material at a fixed bed location, the cleaning process is based on
890
+//       "strokes" i.e. back-and-forth movements between the starting and end
891
+//       points.
892
+//
893
+//   P1: This starts a zig-zag pattern between (X0, Y0) and (X1, Y1), "T"
894
+//       defines the number of zig-zag triangles to be done. "S" defines the
895
+//       number of strokes aka one back-and-forth movement. As an example
896
+//       sending "G12 P1 S1 T3" will execute:
897
+//
898
+//          --
899
+//         |  (X0, Y1) |     /\        /\        /\     | (X1, Y1)
900
+//         |           |    /  \      /  \      /  \    |
901
+//       A |           |   /    \    /    \    /    \   |
902
+//         |           |  /      \  /      \  /      \  |
903
+//         |  (X0, Y0) | /        \/        \/        \ | (X1, Y0)
904
+//          --         +--------------------------------+
905
+//                       |________|_________|_________|
906
+//                           T1        T2        T3
907
+//
908
+// Caveats: End point Z should use the same value as Start point Z.
909
+//
910
+// Attention: This is an EXPERIMENTAL feature, in the future the G-code arguments
911
+// may change to add new functionality like different wipe patterns.
912
+//
913
+//#define NOZZLE_CLEAN_FEATURE
914
+
915
+#if ENABLED(NOZZLE_CLEAN_FEATURE)
916
+  // Number of pattern repetitions
917
+  #define NOZZLE_CLEAN_STROKES  12
918
+
919
+  //                            {  X,  Y,               Z}
920
+  #define NOZZLE_CLEAN_START_PT { 30, 30, (Z_MIN_POS + 5)}
921
+  #define NOZZLE_CLEAN_END_PT   {100, 60, (Z_MIN_POS + 5)}
922
+
923
+  // Moves the nozzle to the parked position
924
+  #define NOZZLE_CLEAN_PARK
925
+#endif
926
+
927
+//
880 928
 // Print job timer
881 929
 //
882 930
 // Enable this option to automatically start and stop the

+ 48
- 0
Marlin/example_configurations/delta/kossel_mini/Configuration.h View File

@@ -880,6 +880,54 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
880 880
 #define PREHEAT_2_FAN_SPEED   255 // Value from 0 to 255
881 881
 
882 882
 //
883
+// Clean Nozzle Feature -- EXPERIMENTAL
884
+//
885
+// When enabled allows the user to send G12 to start the nozzle cleaning
886
+// process, the G-Code accepts two parameters:
887
+//   "P" for pattern selection
888
+//   "S" for defining the number of strokes/repetitions
889
+//
890
+// Available list of patterns:
891
+//   P0: This is the default pattern, this process requires a sponge type
892
+//       material at a fixed bed location, the cleaning process is based on
893
+//       "strokes" i.e. back-and-forth movements between the starting and end
894
+//       points.
895
+//
896
+//   P1: This starts a zig-zag pattern between (X0, Y0) and (X1, Y1), "T"
897
+//       defines the number of zig-zag triangles to be done. "S" defines the
898
+//       number of strokes aka one back-and-forth movement. As an example
899
+//       sending "G12 P1 S1 T3" will execute:
900
+//
901
+//          --
902
+//         |  (X0, Y1) |     /\        /\        /\     | (X1, Y1)
903
+//         |           |    /  \      /  \      /  \    |
904
+//       A |           |   /    \    /    \    /    \   |
905
+//         |           |  /      \  /      \  /      \  |
906
+//         |  (X0, Y0) | /        \/        \/        \ | (X1, Y0)
907
+//          --         +--------------------------------+
908
+//                       |________|_________|_________|
909
+//                           T1        T2        T3
910
+//
911
+// Caveats: End point Z should use the same value as Start point Z.
912
+//
913
+// Attention: This is an EXPERIMENTAL feature, in the future the G-code arguments
914
+// may change to add new functionality like different wipe patterns.
915
+//
916
+//#define NOZZLE_CLEAN_FEATURE
917
+
918
+#if ENABLED(NOZZLE_CLEAN_FEATURE)
919
+  // Number of pattern repetitions
920
+  #define NOZZLE_CLEAN_STROKES  12
921
+
922
+  //                            {  X,  Y,               Z}
923
+  #define NOZZLE_CLEAN_START_PT { 30, 30, (Z_MIN_POS + 5)}
924
+  #define NOZZLE_CLEAN_END_PT   {100, 60, (Z_MIN_POS + 5)}
925
+
926
+  // Moves the nozzle to the parked position
927
+  #define NOZZLE_CLEAN_PARK
928
+#endif
929
+
930
+//
883 931
 // Print job timer
884 932
 //
885 933
 // Enable this option to automatically start and stop the

+ 48
- 0
Marlin/example_configurations/delta/kossel_pro/Configuration.h View File

@@ -880,6 +880,54 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
880 880
 #define PREHEAT_2_FAN_SPEED   255 // Value from 0 to 255
881 881
 
882 882
 //
883
+// Clean Nozzle Feature -- EXPERIMENTAL
884
+//
885
+// When enabled allows the user to send G12 to start the nozzle cleaning
886
+// process, the G-Code accepts two parameters:
887
+//   "P" for pattern selection
888
+//   "S" for defining the number of strokes/repetitions
889
+//
890
+// Available list of patterns:
891
+//   P0: This is the default pattern, this process requires a sponge type
892
+//       material at a fixed bed location, the cleaning process is based on
893
+//       "strokes" i.e. back-and-forth movements between the starting and end
894
+//       points.
895
+//
896
+//   P1: This starts a zig-zag pattern between (X0, Y0) and (X1, Y1), "T"
897
+//       defines the number of zig-zag triangles to be done. "S" defines the
898
+//       number of strokes aka one back-and-forth movement. As an example
899
+//       sending "G12 P1 S1 T3" will execute:
900
+//
901
+//          --
902
+//         |  (X0, Y1) |     /\        /\        /\     | (X1, Y1)
903
+//         |           |    /  \      /  \      /  \    |
904
+//       A |           |   /    \    /    \    /    \   |
905
+//         |           |  /      \  /      \  /      \  |
906
+//         |  (X0, Y0) | /        \/        \/        \ | (X1, Y0)
907
+//          --         +--------------------------------+
908
+//                       |________|_________|_________|
909
+//                           T1        T2        T3
910
+//
911
+// Caveats: End point Z should use the same value as Start point Z.
912
+//
913
+// Attention: This is an EXPERIMENTAL feature, in the future the G-code arguments
914
+// may change to add new functionality like different wipe patterns.
915
+//
916
+//#define NOZZLE_CLEAN_FEATURE
917
+
918
+#if ENABLED(NOZZLE_CLEAN_FEATURE)
919
+  // Number of pattern repetitions
920
+  #define NOZZLE_CLEAN_STROKES  12
921
+
922
+  //                            {  X,  Y,               Z}
923
+  #define NOZZLE_CLEAN_START_PT { 30, 30, (Z_MIN_POS + 5)}
924
+  #define NOZZLE_CLEAN_END_PT   {100, 60, (Z_MIN_POS + 5)}
925
+
926
+  // Moves the nozzle to the parked position
927
+  #define NOZZLE_CLEAN_PARK
928
+#endif
929
+
930
+//
883 931
 // Print job timer
884 932
 //
885 933
 // Enable this option to automatically start and stop the

+ 48
- 0
Marlin/example_configurations/delta/kossel_xl/Configuration.h View File

@@ -882,6 +882,54 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
882 882
 #define PREHEAT_2_FAN_SPEED   255 // Value from 0 to 255
883 883
 
884 884
 //
885
+// Clean Nozzle Feature -- EXPERIMENTAL
886
+//
887
+// When enabled allows the user to send G12 to start the nozzle cleaning
888
+// process, the G-Code accepts two parameters:
889
+//   "P" for pattern selection
890
+//   "S" for defining the number of strokes/repetitions
891
+//
892
+// Available list of patterns:
893
+//   P0: This is the default pattern, this process requires a sponge type
894
+//       material at a fixed bed location, the cleaning process is based on
895
+//       "strokes" i.e. back-and-forth movements between the starting and end
896
+//       points.
897
+//
898
+//   P1: This starts a zig-zag pattern between (X0, Y0) and (X1, Y1), "T"
899
+//       defines the number of zig-zag triangles to be done. "S" defines the
900
+//       number of strokes aka one back-and-forth movement. As an example
901
+//       sending "G12 P1 S1 T3" will execute:
902
+//
903
+//          --
904
+//         |  (X0, Y1) |     /\        /\        /\     | (X1, Y1)
905
+//         |           |    /  \      /  \      /  \    |
906
+//       A |           |   /    \    /    \    /    \   |
907
+//         |           |  /      \  /      \  /      \  |
908
+//         |  (X0, Y0) | /        \/        \/        \ | (X1, Y0)
909
+//          --         +--------------------------------+
910
+//                       |________|_________|_________|
911
+//                           T1        T2        T3
912
+//
913
+// Caveats: End point Z should use the same value as Start point Z.
914
+//
915
+// Attention: This is an EXPERIMENTAL feature, in the future the G-code arguments
916
+// may change to add new functionality like different wipe patterns.
917
+//
918
+//#define NOZZLE_CLEAN_FEATURE
919
+
920
+#if ENABLED(NOZZLE_CLEAN_FEATURE)
921
+  // Number of pattern repetitions
922
+  #define NOZZLE_CLEAN_STROKES  12
923
+
924
+  //                            {  X,  Y,               Z}
925
+  #define NOZZLE_CLEAN_START_PT { 30, 30, (Z_MIN_POS + 5)}
926
+  #define NOZZLE_CLEAN_END_PT   {100, 60, (Z_MIN_POS + 5)}
927
+
928
+  // Moves the nozzle to the parked position
929
+  #define NOZZLE_CLEAN_PARK
930
+#endif
931
+
932
+//
885 933
 // Print job timer
886 934
 //
887 935
 // Enable this option to automatically start and stop the

+ 48
- 0
Marlin/example_configurations/makibox/Configuration.h View File

@@ -791,6 +791,54 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
791 791
 #define PREHEAT_2_FAN_SPEED   255 // Value from 0 to 255
792 792
 
793 793
 //
794
+// Clean Nozzle Feature -- EXPERIMENTAL
795
+//
796
+// When enabled allows the user to send G12 to start the nozzle cleaning
797
+// process, the G-Code accepts two parameters:
798
+//   "P" for pattern selection
799
+//   "S" for defining the number of strokes/repetitions
800
+//
801
+// Available list of patterns:
802
+//   P0: This is the default pattern, this process requires a sponge type
803
+//       material at a fixed bed location, the cleaning process is based on
804
+//       "strokes" i.e. back-and-forth movements between the starting and end
805
+//       points.
806
+//
807
+//   P1: This starts a zig-zag pattern between (X0, Y0) and (X1, Y1), "T"
808
+//       defines the number of zig-zag triangles to be done. "S" defines the
809
+//       number of strokes aka one back-and-forth movement. As an example
810
+//       sending "G12 P1 S1 T3" will execute:
811
+//
812
+//          --
813
+//         |  (X0, Y1) |     /\        /\        /\     | (X1, Y1)
814
+//         |           |    /  \      /  \      /  \    |
815
+//       A |           |   /    \    /    \    /    \   |
816
+//         |           |  /      \  /      \  /      \  |
817
+//         |  (X0, Y0) | /        \/        \/        \ | (X1, Y0)
818
+//          --         +--------------------------------+
819
+//                       |________|_________|_________|
820
+//                           T1        T2        T3
821
+//
822
+// Caveats: End point Z should use the same value as Start point Z.
823
+//
824
+// Attention: This is an EXPERIMENTAL feature, in the future the G-code arguments
825
+// may change to add new functionality like different wipe patterns.
826
+//
827
+//#define NOZZLE_CLEAN_FEATURE
828
+
829
+#if ENABLED(NOZZLE_CLEAN_FEATURE)
830
+  // Number of pattern repetitions
831
+  #define NOZZLE_CLEAN_STROKES  12
832
+
833
+  //                            {  X,  Y,               Z}
834
+  #define NOZZLE_CLEAN_START_PT { 30, 30, (Z_MIN_POS + 5)}
835
+  #define NOZZLE_CLEAN_END_PT   {100, 60, (Z_MIN_POS + 5)}
836
+
837
+  // Moves the nozzle to the parked position
838
+  #define NOZZLE_CLEAN_PARK
839
+#endif
840
+
841
+//
794 842
 // Print job timer
795 843
 //
796 844
 // Enable this option to automatically start and stop the

+ 48
- 0
Marlin/example_configurations/tvrrug/Round2/Configuration.h View File

@@ -782,6 +782,54 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = true; // set to true to invert the lo
782 782
 #define PREHEAT_2_FAN_SPEED   255 // Value from 0 to 255
783 783
 
784 784
 //
785
+// Clean Nozzle Feature -- EXPERIMENTAL
786
+//
787
+// When enabled allows the user to send G12 to start the nozzle cleaning
788
+// process, the G-Code accepts two parameters:
789
+//   "P" for pattern selection
790
+//   "S" for defining the number of strokes/repetitions
791
+//
792
+// Available list of patterns:
793
+//   P0: This is the default pattern, this process requires a sponge type
794
+//       material at a fixed bed location, the cleaning process is based on
795
+//       "strokes" i.e. back-and-forth movements between the starting and end
796
+//       points.
797
+//
798
+//   P1: This starts a zig-zag pattern between (X0, Y0) and (X1, Y1), "T"
799
+//       defines the number of zig-zag triangles to be done. "S" defines the
800
+//       number of strokes aka one back-and-forth movement. As an example
801
+//       sending "G12 P1 S1 T3" will execute:
802
+//
803
+//          --
804
+//         |  (X0, Y1) |     /\        /\        /\     | (X1, Y1)
805
+//         |           |    /  \      /  \      /  \    |
806
+//       A |           |   /    \    /    \    /    \   |
807
+//         |           |  /      \  /      \  /      \  |
808
+//         |  (X0, Y0) | /        \/        \/        \ | (X1, Y0)
809
+//          --         +--------------------------------+
810
+//                       |________|_________|_________|
811
+//                           T1        T2        T3
812
+//
813
+// Caveats: End point Z should use the same value as Start point Z.
814
+//
815
+// Attention: This is an EXPERIMENTAL feature, in the future the G-code arguments
816
+// may change to add new functionality like different wipe patterns.
817
+//
818
+//#define NOZZLE_CLEAN_FEATURE
819
+
820
+#if ENABLED(NOZZLE_CLEAN_FEATURE)
821
+  // Number of pattern repetitions
822
+  #define NOZZLE_CLEAN_STROKES  12
823
+
824
+  //                            {  X,  Y,               Z}
825
+  #define NOZZLE_CLEAN_START_PT { 30, 30, (Z_MIN_POS + 5)}
826
+  #define NOZZLE_CLEAN_END_PT   {100, 60, (Z_MIN_POS + 5)}
827
+
828
+  // Moves the nozzle to the parked position
829
+  #define NOZZLE_CLEAN_PARK
830
+#endif
831
+
832
+//
785 833
 // Print job timer
786 834
 //
787 835
 // Enable this option to automatically start and stop the

+ 154
- 0
Marlin/nozzle.h View File

@@ -0,0 +1,154 @@
1
+/*
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+#ifndef __NOZZLE_H__
24
+#define __NOZZLE_H__
25
+
26
+#include "Marlin.h"
27
+#include "point_t.h"
28
+
29
+/**
30
+ * @brief Nozzle class
31
+ *
32
+ * @todo: Do not ignore the end.z value and allow XYZ movements
33
+ * @todo: Currently this feature needs HAS_BED_PROBE to be active
34
+ *  due to the do_blocking_move_to*() functions.
35
+ */
36
+class Nozzle {
37
+  private:
38
+    /**
39
+     * @brief Stroke clean pattern
40
+     * @details Wipes the nozzle back and forth in a linear movement
41
+     *
42
+     * @param start point_t defining the starting point
43
+     * @param end point_t defining the ending point
44
+     * @param strokes number of strokes to execute
45
+     */
46
+    static void stroke(point_t const &start, point_t const &end, uint8_t const &strokes)
47
+    __attribute__ ((optimize ("Os"))) {
48
+
49
+      #if ENABLED(NOZZLE_CLEAN_PARK)
50
+        // Store the current coords
51
+        point_t const initial = {
52
+          current_position[X_AXIS],
53
+          current_position[Y_AXIS],
54
+          current_position[Z_AXIS],
55
+          current_position[E_AXIS]
56
+        };
57
+      #endif
58
+
59
+      // Move to the starting point
60
+      do_blocking_move_to_xy(start.x, start.y);
61
+      do_blocking_move_to_z(start.z);
62
+
63
+      // Start the stroke pattern
64
+      for (uint8_t i = 0; i < (strokes >>1); i++) {
65
+        do_blocking_move_to_xy(end.x, end.y);
66
+        do_blocking_move_to_xy(start.x, start.y);
67
+      }
68
+
69
+      #if ENABLED(NOZZLE_CLEAN_PARK)
70
+        // Move the nozzle to the initial point
71
+        do_blocking_move_to_z(initial.z);
72
+        do_blocking_move_to_xy(initial.x, initial.y);
73
+      #endif
74
+    }
75
+
76
+    /**
77
+     * @brief Zig-zag clean pattern
78
+     * @details Apply a zig-zag cleanning pattern
79
+     *
80
+     * @param start point_t defining the starting point
81
+     * @param end point_t defining the ending point
82
+     * @param strokes number of strokes to execute
83
+     * @param objects number of objects to create
84
+     */
85
+    static void zigzag(point_t const &start,
86
+      point_t const &end, uint8_t const &strokes, uint8_t const &objects)
87
+    __attribute__ ((optimize ("Os"))) {
88
+      float A = fabs(end.y - start.y); // [twice the] Amplitude
89
+      float P = fabs(end.x - start.x) / (objects << 1); // Period
90
+
91
+      // Don't allow impossible triangles
92
+      if (A <= 0.0f || P <= 0.0f ) return;
93
+
94
+      #if ENABLED(NOZZLE_CLEAN_PARK)
95
+        // Store the current coords
96
+        point_t const initial = {
97
+          current_position[X_AXIS],
98
+          current_position[Y_AXIS],
99
+          current_position[Z_AXIS],
100
+          current_position[E_AXIS]
101
+        };
102
+      #endif
103
+
104
+      for (uint8_t j = 0; j < strokes; j++) {
105
+        for (uint8_t i = 0; i < (objects << 1); i++) {
106
+          float const x = start.x + i * P;
107
+          float const y = start.y + (A/P) * (P - fabs(fmod((i*P), (2*P)) - P));
108
+
109
+          do_blocking_move_to_xy(x, y);
110
+          if (i == 0) do_blocking_move_to_z(start.z);
111
+        }
112
+
113
+        for (int i = (objects << 1); i > -1; i--) {
114
+          float const x = start.x + i * P;
115
+          float const y = start.y + (A/P) * (P - fabs(fmod((i*P), (2*P)) - P));
116
+
117
+          do_blocking_move_to_xy(x, y);
118
+        }
119
+      }
120
+
121
+      #if ENABLED(NOZZLE_CLEAN_PARK)
122
+        // Move the nozzle to the initial point
123
+        do_blocking_move_to_z(initial.z);
124
+        do_blocking_move_to_xy(initial.x, initial.y);
125
+      #endif
126
+    }
127
+
128
+  public:
129
+    /**
130
+     * @brief Clean the nozzle
131
+     * @details Starts the selected clean procedure pattern
132
+     *
133
+     * @param pattern one of the available patterns
134
+     * @param argument depends on the cleaning pattern
135
+     */
136
+    static void clean(uint8_t const &pattern,
137
+      uint8_t const &strokes, uint8_t const &objects = 0)
138
+    __attribute__ ((optimize ("Os"))) {
139
+      switch (pattern) {
140
+        case 1:
141
+          Nozzle::zigzag(
142
+            NOZZLE_CLEAN_START_PT,
143
+            NOZZLE_CLEAN_END_PT, strokes, objects);
144
+          break;
145
+
146
+        default:
147
+          Nozzle::stroke(
148
+            NOZZLE_CLEAN_START_PT,
149
+            NOZZLE_CLEAN_END_PT, strokes);
150
+      }
151
+    }
152
+};
153
+
154
+#endif

+ 46
- 0
Marlin/point_t.h View File

@@ -0,0 +1,46 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+#ifndef __POINT_T__
24
+#define __POINT_T__
25
+
26
+struct point_t {
27
+  float x;
28
+  float y;
29
+  float z;
30
+  float e;
31
+
32
+  point_t(float const x, float const y)
33
+    : point_t(x, y, NAN, NAN) {}
34
+
35
+  point_t(float const x, float const y, float const z)
36
+    : point_t(x, y, z, NAN) {}
37
+
38
+  point_t(float const x, float const y, float const z, float const e) {
39
+    this->x = x;
40
+    this->y = y;
41
+    this->z = z;
42
+    this->e = e;
43
+  }
44
+};
45
+
46
+#endif

Loading…
Cancel
Save