Browse Source

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
pull/1/head
Brian 8 years ago
parent
commit
f7a201b0d0
  1. 34
      Marlin/G26_Mesh_Validation_Tool.cpp

34
Marlin/G26_Mesh_Validation_Tool.cpp

@ -69,7 +69,7 @@
* B # Bed Set the Bed Temperature. If not specified, a default of 60 C. will be assumed. * B # Bed Set the Bed Temperature. If not specified, a default of 60 C. will be assumed.
* *
* C Current When searching for Mesh Intersection points to draw, use the current nozzle location * C Current When searching for Mesh Intersection points to draw, use the current nozzle location
* as the base for any distance comparison. as the base for any distance comparison.
* *
* D Disable Disable the Unified Bed Leveling System. In the normal case the user is invoking this * D Disable Disable the Unified Bed Leveling System. In the normal case the user is invoking this
* command to see how well a Mesh as been adjusted to match a print surface. In order to do * command to see how well a Mesh as been adjusted to match a print surface. In order to do
@ -91,6 +91,11 @@
* Q # Multiplier Retraction Multiplier. Normally not needed. Retraction defaults to 1.0mm and * Q # Multiplier Retraction Multiplier. Normally not needed. Retraction defaults to 1.0mm and
* un-retraction is at 1.2mm These numbers will be scaled by the specified amount * un-retraction is at 1.2mm These numbers will be scaled by the specified amount
* *
* M # Random Randomize the order that the circles are drawn on the bed. The search for the closest
* undrawn cicle is still done. But the distance to the location for each circle has a
* random number of the size specified added to it. Specifying R50 will give an interesting
* deviation from the normal behaviour on a 10 x 10 Mesh.
* N # Nozzle Used to control the size of nozzle diameter. If not specified, a .4mm nozzle is assumed. * N # Nozzle Used to control the size of nozzle diameter. If not specified, a .4mm nozzle is assumed.
* 'n' can be used instead if your host program does not appreciate you using 'N'. * 'n' can be used instead if your host program does not appreciate you using 'N'.
* *
@ -106,14 +111,13 @@
* printing the Mesh. You can carefully remove the spent filament with a needle nose * printing the Mesh. You can carefully remove the spent filament with a needle nose
* pliers while holding the LCD Click wheel in a depressed state. * pliers while holding the LCD Click wheel in a depressed state.
* *
* R # Random Randomize the order that the circles are drawn on the bed. The search for the closest * R # Repeat Prints the number of patterns given as a parameter, starting at the current location.
* undrawn cicle is still done. But the distance to the location for each circle has a * If a parameter isn't given, every point will be printed unless G26 is interrupted.
* random number of the size specified added to it. Specifying R50 will give an interesting * This works the same way that the UBL G29 P4 R parameter works.
* deviation from the normal behaviour on a 10 x 10 Mesh.
* *
* X # X coordinate Specify the starting location of the drawing activity. * X # X Coord. Specify the starting location of the drawing activity.
* *
* Y # Y coordinate Specify the starting location of the drawing activity. * Y # Y Coord. Specify the starting location of the drawing activity.
*/ */
// External references // External references
@ -176,6 +180,8 @@
static bool keep_heaters_on = false; static bool keep_heaters_on = false;
static int16_t g26_repeats;
/** /**
* G26: Mesh Validation Pattern generation. * G26: Mesh Validation Pattern generation.
* *
@ -359,7 +365,7 @@
//debug_current_and_destination(PSTR("Done with current circle.")); //debug_current_and_destination(PSTR("Done with current circle."));
} while (location.x_index >= 0 && location.y_index >= 0); } while (location.x_index >= 0 && location.y_index >= 0 && g26_repeats--);
LEAVE: LEAVE:
lcd_reset_alert_level(); lcd_reset_alert_level();
@ -722,11 +728,21 @@
} }
} }
if (code_seen('R')) { if (code_seen('M')) {
randomSeed(millis()); randomSeed(millis());
random_deviation = code_has_value() ? code_value_float() : 50.0; random_deviation = code_has_value() ? code_value_float() : 50.0;
} }
if (code_seen('R')) {
g26_repeats = code_has_value() ? code_value_int() - 1 : 999;
if (g26_repeats <= 0) {
SERIAL_PROTOCOLLNPGM("?(R)epeat value not plausible; must be greater than 0.");
return UBL_ERR;
}
}
x_pos = current_position[X_AXIS]; x_pos = current_position[X_AXIS];
y_pos = current_position[Y_AXIS]; y_pos = current_position[Y_AXIS];

Loading…
Cancel
Save