Browse Source

Adjust G26 arguments

Scott Lahteine 8 years ago
parent
commit
ee50dfaaf3
1 changed files with 17 additions and 36 deletions
  1. 17
    36
      Marlin/G26_Mesh_Validation_Tool.cpp

+ 17
- 36
Marlin/G26_Mesh_Validation_Tool.cpp View File

152
   bool turn_on_heaters();
152
   bool turn_on_heaters();
153
   bool prime_nozzle();
153
   bool prime_nozzle();
154
 
154
 
155
-  static uint16_t circle_flags[16], horizontal_mesh_line_flags[16], vertical_mesh_line_flags[16], continue_with_closest = 0;
155
+  static uint16_t circle_flags[16], horizontal_mesh_line_flags[16], vertical_mesh_line_flags[16];
156
   float g26_e_axis_feedrate = 0.020,
156
   float g26_e_axis_feedrate = 0.020,
157
         random_deviation = 0.0,
157
         random_deviation = 0.0,
158
         layer_height = LAYER_HEIGHT;
158
         layer_height = LAYER_HEIGHT;
176
 
176
 
177
   static int8_t prime_flag = 0;
177
   static int8_t prime_flag = 0;
178
 
178
 
179
-  static bool keep_heaters_on = false;
179
+  static bool continue_with_closest, keep_heaters_on;
180
 
180
 
181
   static int16_t g26_repeats;
181
   static int16_t g26_repeats;
182
 
182
 
361
 
361
 
362
       //debug_current_and_destination(PSTR("Done with current circle."));
362
       //debug_current_and_destination(PSTR("Done with current circle."));
363
 
363
 
364
-    } while (location.x_index >= 0 && location.y_index >= 0 && g26_repeats--);
364
+    } while (--g26_repeats && location.x_index >= 0 && location.y_index >= 0);
365
 
365
 
366
     LEAVE:
366
     LEAVE:
367
     lcd_reset_alert_level();
367
     lcd_reset_alert_level();
623
 
623
 
624
       //if (ubl.g26_debug_flag) SERIAL_ECHOLNPGM("  Z bumping by 0.500 to minimize scraping.");
624
       //if (ubl.g26_debug_flag) SERIAL_ECHOLNPGM("  Z bumping by 0.500 to minimize scraping.");
625
       //todo:  parameterize the bump height with a define
625
       //todo:  parameterize the bump height with a define
626
-      move_to(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS]+0.500, 0.0);  // Z bump to minimize scraping
627
-      move_to(sx, sy, sz+0.500, 0.0); // Get to the starting point with no extrusion while bumped
626
+      move_to(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS] + 0.500, 0.0);  // Z bump to minimize scraping
627
+      move_to(sx, sy, sz + 0.500, 0.0); // Get to the starting point with no extrusion while bumped
628
     }
628
     }
629
 
629
 
630
     move_to(sx, sy, sz, 0.0); // Get to the starting point with no extrusion / un-Z bump
630
     move_to(sx, sy, sz, 0.0); // Get to the starting point with no extrusion / un-Z bump
655
     prime_length          = PRIME_LENGTH;
655
     prime_length          = PRIME_LENGTH;
656
     bed_temp              = BED_TEMP;
656
     bed_temp              = BED_TEMP;
657
     hotend_temp           = HOTEND_TEMP;
657
     hotend_temp           = HOTEND_TEMP;
658
-    ooze_amount           = OOZE_AMOUNT;
659
     prime_flag            = 0;
658
     prime_flag            = 0;
660
-    keep_heaters_on       = false;
659
+
660
+    ooze_amount           = code_seen('O') && code_has_value() ? code_value_linear_units() : OOZE_AMOUNT;
661
+    keep_heaters_on       = code_seen('K') && code_value_bool();
662
+    continue_with_closest = code_seen('C') && code_value_bool();
661
 
663
 
662
     if (code_seen('B')) {
664
     if (code_seen('B')) {
663
       bed_temp = code_value_temp_abs();
665
       bed_temp = code_value_temp_abs();
667
       }
669
       }
668
     }
670
     }
669
 
671
 
670
-    if (code_seen('C')) continue_with_closest++;
671
-
672
     if (code_seen('L')) {
672
     if (code_seen('L')) {
673
       layer_height = code_value_linear_units();
673
       layer_height = code_value_linear_units();
674
       if (!WITHIN(layer_height, 0.0, 2.0)) {
674
       if (!WITHIN(layer_height, 0.0, 2.0)) {
699
       }
699
       }
700
     }
700
     }
701
 
701
 
702
-    if (code_seen('K')) keep_heaters_on++;
703
-
704
-    if (code_seen('O') && code_has_value())
705
-      ooze_amount = code_value_linear_units();
706
-
707
     if (code_seen('P')) {
702
     if (code_seen('P')) {
708
       if (!code_has_value())
703
       if (!code_has_value())
709
         prime_flag = -1;
704
         prime_flag = -1;
740
 
735
 
741
     if (code_seen('M')) {
736
     if (code_seen('M')) {
742
       randomSeed(millis());
737
       randomSeed(millis());
738
+      // This setting will persist for the next G26
743
       random_deviation = code_has_value() ? code_value_float() : 50.0;
739
       random_deviation = code_has_value() ? code_value_float() : 50.0;
744
     }
740
     }
745
 
741
 
746
-    if (code_seen('R')) {
747
-      g26_repeats = code_has_value() ? code_value_int() : 999;
748
-
749
-      if (g26_repeats <= 0) {
750
-        SERIAL_PROTOCOLLNPGM("?(R)epeat value not plausible; must be greater than 0.");
751
-        return UBL_ERR;
752
-      }
753
-
754
-      g26_repeats--;
755
-    }
756
-
757
-
758
-    x_pos = current_position[X_AXIS];
759
-    y_pos = current_position[Y_AXIS];
760
-
761
-    if (code_seen('X')) {
762
-      x_pos = code_value_float();
763
-    }
764
-
765
-    if (code_seen('Y')) {
766
-      y_pos = code_value_float();
742
+    g26_repeats = code_seen('R') ? (code_has_value() ? code_value_int() : 999) : 1;
743
+    if (g26_repeats < 1) {
744
+      SERIAL_PROTOCOLLNPGM("?(R)epeat value not plausible; must be at least 1.");
745
+      return UBL_ERR;
767
     }
746
     }
768
 
747
 
769
-    if ( ! position_is_reachable_xy( x_pos, y_pos )) {
748
+    x_pos = code_seen('X') ? code_value_linear_units() : current_position[X_AXIS];
749
+    y_pos = code_seen('Y') ? code_value_linear_units() : current_position[Y_AXIS];
750
+    if (!position_is_reachable_xy(x_pos, y_pos)) {
770
       SERIAL_PROTOCOLLNPGM("?Specified X,Y coordinate out of bounds.");
751
       SERIAL_PROTOCOLLNPGM("?Specified X,Y coordinate out of bounds.");
771
       return UBL_ERR;
752
       return UBL_ERR;
772
     }
753
     }

Loading…
Cancel
Save