Add unretraction parameter to G26

G26 Gcode:
- Change Q parameter to only specify retraction length
- Add Z parameter for unretraction length
- Preserve fixed multiplier of 1.2 if Z isn't specified
- Add check to avoid implausible retract/unretract ratios
- Change default config values

Referencing #31. Thanks to @BlackMulch for the feedback!
This commit is contained in:
David Ramiro
2019-03-24 21:20:54 +01:00
parent 589e972102
commit 3f19385e03
3 changed files with 53 additions and 26 deletions

View File

@@ -44,8 +44,9 @@
#endif
#define EXTRUSION_MULTIPLIER 1.0
#define RETRACTION_MULTIPLIER 6
#define PRIME_LENGTH 25.0
#define RETRACTION_LENGTH 1
#define UNRETRACTION_LENGTH 1.2
#define PRIME_LENGTH 5
#define OOZE_AMOUNT 2.25
#define INTERSECTION_CIRCLE_RADIUS 5
@@ -107,8 +108,9 @@
* pliers while holding the LCD Click wheel in a depressed state. If you do not have
* an LCD, you must specify a value if you use P.
*
* 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
* Q # Retract Retraction length. Defaults to 1mm if not specified.
* Z # Unretract Unretraction length. Defaults to 1.2mm if not specified.
* Note: If Q is specified but Z isn't, Z defaults to Q * 1.2.
*
* R # Repeat Prints the number of patterns given as a parameter, starting at the current location.
* If a parameter isn't given, every point will be printed unless G26 is interrupted.
@@ -145,7 +147,8 @@
// retracts/recovers won't result in a bad state.
static float g26_extrusion_multiplier,
g26_retraction_multiplier,
g26_retraction_length,
g26_unretraction_length,
g26_layer_height,
g26_prime_length,
g26_x_pos, g26_y_pos;
@@ -223,13 +226,13 @@
void retract_filament(const float where[XYZE]) {
if (!g26_retracted) { // Only retract if we are not already retracted!
g26_retracted = true;
move_to(where, -1.0 * g26_retraction_multiplier);
move_to(where, -1.0 * g26_retraction_length);
}
}
void recover_filament(const float where[XYZE]) {
if (g26_retracted) { // Only un-retract if we are retracted.
move_to(where, 1.2 * g26_retraction_multiplier);
move_to(where, g26_unretraction_length);
g26_retracted = false;
}
}
@@ -564,7 +567,8 @@
if (axis_unhomed_error()) return;
g26_extrusion_multiplier = EXTRUSION_MULTIPLIER;
g26_retraction_multiplier = RETRACTION_MULTIPLIER;
g26_retraction_length = RETRACTION_LENGTH;
g26_unretraction_length = UNRETRACTION_LENGTH;
g26_layer_height = MESH_TEST_LAYER_HEIGHT;
g26_prime_length = PRIME_LENGTH;
g26_bed_temp = MESH_TEST_BED_TEMP;
@@ -596,14 +600,44 @@
if (parser.seen('Q')) {
if (parser.has_value()) {
g26_retraction_multiplier = parser.value_float();
if (!WITHIN(g26_retraction_multiplier, 0.05, 15.0)) {
SERIAL_PROTOCOLLNPGM("?Specified Retraction Multiplier not plausible.");
g26_retraction_length = parser.value_float();
if (!WITHIN(g26_retraction_length, 0.05, 15.0)) {
SERIAL_PROTOCOLLNPGM("?Specified Retraction length not plausible.");
return;
}
}
else {
SERIAL_PROTOCOLLNPGM("?Retraction Multiplier must be specified.");
SERIAL_PROTOCOLLNPGM("?Retraction length must be specified.");
return;
}
}
if (parser.seen('Z')) {
if (parser.has_value()) {
g26_unretraction_length = parser.value_float();
if (!WITHIN(g26_unretraction_length, 0.05, 15.0)) {
SERIAL_PROTOCOLLNPGM("?Specified Unretraction length not plausible.");
return;
}
}
else {
SERIAL_PROTOCOLLNPGM("?Unretraction length must be specified.");
return;
}
}
if (!parser.seen('Z') && parser.seen('Q')) {
// retraction without unretraction specified, use 1.2 multiplier (preserve Gcode spec)
g26_unretraction_length = g26_retraction_length * 1.2;
SERIAL_ECHOPAIR(" Unretraction amount automatically set to ", g26_unretraction_length);
SERIAL_EOL();
}
if (parser.seen('Z') && parser.seen('Q')) {
// consider typos or unreasonable retract/unretract ratios
float g26_retract_unretract_delta = g26_unretraction_length - g26_retraction_length;
if (!WITHIN(g26_retract_unretract_delta, -5, 5)) {
SERIAL_PROTOCOLLNPGM("?Invalid Retraction/Unretraction ratio. Must be within 5mm.");
return;
}
}

View File

@@ -41,7 +41,7 @@
* Defines the version of the Marlin-AI3M build. Not to be confused with
* Marlin's own build number, e.g. 1.1.9.
*/
#define CUSTOM_BUILD_VERSION "v1.4.4"
#define CUSTOM_BUILD_VERSION "v1.4.5"
/**
* Verbose version identifier which should contain a reference to the location
@@ -54,7 +54,7 @@
* here we define this default string as the date where the latest release
* version was tagged.
*/
#define STRING_DISTRIBUTION_DATE "2019-03-13"
#define STRING_DISTRIBUTION_DATE "2019-03-24"
/**
* Required minimum Configuration.h and Configuration_adv.h file versions.