Kaynağa Gözat

G26: Add 'Repeat' Option

- Allows for specifying number of points to print/validate, using 'R' code like with G29 P4 Rx
- Moved the code for Random to 'M' so we could be consistent with G29 P4
- G26 instructions indenting/cleanup
Brian 7 yıl önce
ebeveyn
işleme
f7a201b0d0
1 değiştirilmiş dosya ile 52 ekleme ve 36 silme
  1. 52
    36
      Marlin/G26_Mesh_Validation_Tool.cpp

+ 52
- 36
Marlin/G26_Mesh_Validation_Tool.cpp Dosyayı Görüntüle

@@ -66,54 +66,58 @@
66 66
    *   the user can specify the X and Y position of interest with command parameters.  This allows the user to
67 67
    *   focus on a particular area of the Mesh where attention is needed.
68 68
    *
69
-   *   B #  Bed   Set the Bed Temperature.  If not specified, a default of 60 C. will be assumed.
69
+   *   B #  Bed         Set the Bed Temperature.  If not specified, a default of 60 C. will be assumed.
70 70
    *
71
-   *   C    Current   When searching for Mesh Intersection points to draw, use the current nozzle location
72
-   *        as the base for any distance comparison.
71
+   *   C    Current     When searching for Mesh Intersection points to draw, use the current nozzle location
72
+                        as the base for any distance comparison.
73 73
    *
74
-   *   D    Disable   Disable the Unified Bed Leveling System.  In the normal case the user is invoking this
75
-   *        command to see how well a Mesh as been adjusted to match a print surface.  In order to do
76
-   *        this the Unified Bed Leveling System is turned on by the G26 command.  The D parameter
77
-   *        alters the command's normal behaviour and disables the Unified Bed Leveling System even if
78
-   *        it is on.
74
+   *   D    Disable     Disable the Unified Bed Leveling System.  In the normal case the user is invoking this
75
+   *                    command to see how well a Mesh as been adjusted to match a print surface.  In order to do
76
+   *                    this the Unified Bed Leveling System is turned on by the G26 command.  The D parameter
77
+   *                    alters the command's normal behaviour and disables the Unified Bed Leveling System even if
78
+   *                    it is on.
79 79
    *
80
-   *   H #  Hotend    Set the Nozzle Temperature.  If not specified, a default of 205 C. will be assumed.
80
+   *   H #  Hotend      Set the Nozzle Temperature.  If not specified, a default of 205 C. will be assumed.
81 81
    *
82
-   *   F #  Filament  Used to specify the diameter of the filament being used.  If not specified
83
-   *        1.75mm filament is assumed.  If you are not getting acceptable results by using the
84
-   *        'correct' numbers, you can scale this number up or down a little bit to change the amount
85
-   *        of filament that is being extruded during the printing of the various lines on the bed.
82
+   *   F #  Filament    Used to specify the diameter of the filament being used.  If not specified
83
+   *                    1.75mm filament is assumed.  If you are not getting acceptable results by using the
84
+   *                    'correct' numbers, you can scale this number up or down a little bit to change the amount
85
+   *                    of filament that is being extruded during the printing of the various lines on the bed.
86 86
    *
87
-   *   K    Keep-On   Keep the heaters turned on at the end of the command.
87
+   *   K    Keep-On     Keep the heaters turned on at the end of the command.
88 88
    *
89
-   *   L #  Layer   Layer height.  (Height of nozzle above bed)  If not specified .20mm will be used.
89
+   *   L #  Layer       Layer height.  (Height of nozzle above bed)  If not specified .20mm will be used.
90 90
    *
91 91
    *   Q #  Multiplier  Retraction Multiplier.  Normally not needed.  Retraction defaults to 1.0mm and
92
-   *        un-retraction is at 1.2mm   These numbers will be scaled by the specified amount
92
+   *                    un-retraction is at 1.2mm   These numbers will be scaled by the specified amount
93 93
    *
94
-   *   N #  Nozzle    Used to control the size of nozzle diameter.  If not specified, a .4mm nozzle is assumed.
95
-   *        'n' can be used instead if your host program does not appreciate you using 'N'.
94
+   *   M #  Random      Randomize the order that the circles are drawn on the bed.  The search for the closest
95
+   *                    undrawn cicle is still done.  But the distance to the location for each circle has a
96
+   *                    random number of the size specified added to it.  Specifying R50 will give an interesting
97
+   *                    deviation from the normal behaviour on a 10 x 10 Mesh.
98
+
99
+   *   N #  Nozzle      Used to control the size of nozzle diameter.  If not specified, a .4mm nozzle is assumed.
100
+   *                    'n' can be used instead if your host program does not appreciate you using 'N'.
96 101
    *
97
-   *   O #  Ooooze    How much your nozzle will Ooooze filament while getting in position to print.  This
98
-   *        is over kill, but using this parameter will let you get the very first 'cicle' perfect
99
-   *        so you have a trophy to peel off of the bed and hang up to show how perfectly you have your
100
-   *        Mesh calibrated.  If not specified, a filament length of .3mm is assumed.
102
+   *   O #  Ooooze      How much your nozzle will Ooooze filament while getting in position to print.  This
103
+   *                    is over kill, but using this parameter will let you get the very first 'cicle' perfect
104
+   *                    so you have a trophy to peel off of the bed and hang up to show how perfectly you have your
105
+   *                    Mesh calibrated.  If not specified, a filament length of .3mm is assumed.
101 106
    *
102
-   *   P #  Prime   Prime the nozzle with specified length of filament.  If this parameter is not
103
-   *        given, no prime action will take place.  If the parameter specifies an amount, that much
104
-   *        will be purged before continuing.  If no amount is specified the command will start
105
-   *        purging filament until the user provides an LCD Click and then it will continue with
106
-   *        printing the Mesh.  You can carefully remove the spent filament with a needle nose
107
-   *        pliers while holding the LCD Click wheel in a depressed state.
107
+   *   P #  Prime       Prime the nozzle with specified length of filament.  If this parameter is not
108
+   *                    given, no prime action will take place.  If the parameter specifies an amount, that much
109
+   *                    will be purged before continuing.  If no amount is specified the command will start
110
+   *                    purging filament until the user provides an LCD Click and then it will continue with
111
+   *                    printing the Mesh.  You can carefully remove the spent filament with a needle nose
112
+   *                    pliers while holding the LCD Click wheel in a depressed state.
108 113
    *
109
-   *   R #  Random    Randomize the order that the circles are drawn on the bed.  The search for the closest
110
-   *        undrawn cicle is still done.  But the distance to the location for each circle has a
111
-   *        random number of the size specified added to it.  Specifying R50 will give an interesting
112
-   *        deviation from the normal behaviour on a 10 x 10 Mesh.
114
+   *   R #  Repeat      Prints the number of patterns given as a parameter, starting at the current location.
115
+   *                    If a parameter isn't given, every point will be printed unless G26 is interrupted.
116
+   *                    This works the same way that the UBL G29 P4 R parameter works.
113 117
    *
114
-   *   X #  X coordinate  Specify the starting location of the drawing activity.
118
+   *   X #  X Coord.    Specify the starting location of the drawing activity.
115 119
    *
116
-   *   Y #  Y coordinate  Specify the starting location of the drawing activity.
120
+   *   Y #  Y Coord.    Specify the starting location of the drawing activity.
117 121
    */
118 122
 
119 123
   // External references
@@ -176,6 +180,8 @@
176 180
 
177 181
   static bool keep_heaters_on = false;
178 182
 
183
+  static int16_t g26_repeats;
184
+
179 185
   /**
180 186
    * G26: Mesh Validation Pattern generation.
181 187
    *
@@ -359,7 +365,7 @@
359 365
 
360 366
       //debug_current_and_destination(PSTR("Done with current circle."));
361 367
 
362
-    } while (location.x_index >= 0 && location.y_index >= 0);
368
+    } while (location.x_index >= 0 && location.y_index >= 0 && g26_repeats--);
363 369
 
364 370
     LEAVE:
365 371
     lcd_reset_alert_level();
@@ -722,11 +728,21 @@
722 728
       }
723 729
     }
724 730
 
725
-    if (code_seen('R')) {
731
+    if (code_seen('M')) {
726 732
       randomSeed(millis());
727 733
       random_deviation = code_has_value() ? code_value_float() : 50.0;
728 734
     }
729 735
 
736
+    if (code_seen('R')) {
737
+      g26_repeats = code_has_value() ? code_value_int() - 1 : 999;
738
+
739
+      if (g26_repeats <= 0) {
740
+        SERIAL_PROTOCOLLNPGM("?(R)epeat value not plausible; must be greater than 0.");
741
+        return UBL_ERR;
742
+      }
743
+    }
744
+
745
+
730 746
     x_pos = current_position[X_AXIS];
731 747
     y_pos = current_position[Y_AXIS];
732 748
 

Loading…
İptal
Kaydet