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
No known key found for this signature in database
GPG Key ID: 5B042737EBEEB736
3 changed files with 53 additions and 26 deletions

View File

@ -44,8 +44,9 @@
#endif #endif
#define EXTRUSION_MULTIPLIER 1.0 #define EXTRUSION_MULTIPLIER 1.0
#define RETRACTION_MULTIPLIER 6 #define RETRACTION_LENGTH 1
#define PRIME_LENGTH 25.0 #define UNRETRACTION_LENGTH 1.2
#define PRIME_LENGTH 5
#define OOZE_AMOUNT 2.25 #define OOZE_AMOUNT 2.25
#define INTERSECTION_CIRCLE_RADIUS 5 #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 * 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. * an LCD, you must specify a value if you use P.
* *
* Q # Multiplier Retraction Multiplier. Normally not needed. Retraction defaults to 1.0mm and * Q # Retract Retraction length. Defaults to 1mm if not specified.
* un-retraction is at 1.2mm These numbers will be scaled by the specified amount * 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. * 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. * 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. // retracts/recovers won't result in a bad state.
static float g26_extrusion_multiplier, static float g26_extrusion_multiplier,
g26_retraction_multiplier, g26_retraction_length,
g26_unretraction_length,
g26_layer_height, g26_layer_height,
g26_prime_length, g26_prime_length,
g26_x_pos, g26_y_pos; g26_x_pos, g26_y_pos;
@ -223,13 +226,13 @@
void retract_filament(const float where[XYZE]) { void retract_filament(const float where[XYZE]) {
if (!g26_retracted) { // Only retract if we are not already retracted! if (!g26_retracted) { // Only retract if we are not already retracted!
g26_retracted = true; 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]) { void recover_filament(const float where[XYZE]) {
if (g26_retracted) { // Only un-retract if we are retracted. 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; g26_retracted = false;
} }
} }
@ -564,7 +567,8 @@
if (axis_unhomed_error()) return; if (axis_unhomed_error()) return;
g26_extrusion_multiplier = EXTRUSION_MULTIPLIER; 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_layer_height = MESH_TEST_LAYER_HEIGHT;
g26_prime_length = PRIME_LENGTH; g26_prime_length = PRIME_LENGTH;
g26_bed_temp = MESH_TEST_BED_TEMP; g26_bed_temp = MESH_TEST_BED_TEMP;
@ -596,14 +600,44 @@
if (parser.seen('Q')) { if (parser.seen('Q')) {
if (parser.has_value()) { if (parser.has_value()) {
g26_retraction_multiplier = parser.value_float(); g26_retraction_length = parser.value_float();
if (!WITHIN(g26_retraction_multiplier, 0.05, 15.0)) { if (!WITHIN(g26_retraction_length, 0.05, 15.0)) {
SERIAL_PROTOCOLLNPGM("?Specified Retraction Multiplier not plausible."); SERIAL_PROTOCOLLNPGM("?Specified Retraction length not plausible.");
return; return;
} }
} }
else { 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; return;
} }
} }

View File

@ -41,7 +41,7 @@
* Defines the version of the Marlin-AI3M build. Not to be confused with * Defines the version of the Marlin-AI3M build. Not to be confused with
* Marlin's own build number, e.g. 1.1.9. * 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 * 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 * here we define this default string as the date where the latest release
* version was tagged. * 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. * Required minimum Configuration.h and Configuration_adv.h file versions.

View File

@ -1,26 +1,18 @@
# Anycubic i3 Mega Marlin 1.1.9 by davidramiro # Anycubic i3 Mega / Mega-S Marlin 1.1.9 by davidramiro
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3MFT8QMP5ZRCE&source=url) [![Downloads](https://img.shields.io/github/downloads/davidramiro/Marlin-AI3M/total.svg?style=flat)](https://github.com/davidramiro/Marlin-AI3M/releases) [![Open Issues](https://img.shields.io/github/issues-raw/davidramiro/Marlin-AI3M.svg?style=flat)](https://github.com/davidramiro/Marlin-AI3M/issues?q=is%3Aopen+is%3Aissue) [![Closed Issues](https://img.shields.io/github/issues-closed-raw/davidramiro/Marlin-AI3M.svg?style=flat)](https://github.com/davidramiro/Marlin-AI3M/issues?q=is%3Aissue+is%3Aclosed) [![License](https://img.shields.io/github/license/davidramiro/Marlin-AI3M.svg?style=flat)](https://github.com/davidramiro/Marlin-AI3M/blob/master/LICENSE) [![Latest Release](https://img.shields.io/github/release/davidramiro/Marlin-AI3m.svg?style=flat)](https://github.com/davidramiro/Marlin-AI3M/releases/latest/) ![](https://img.shields.io/github/last-commit/davidramiro/Marlin-AI3m.svg?style=flat) [![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3MFT8QMP5ZRCE&source=url) [![Downloads](https://img.shields.io/github/downloads/davidramiro/Marlin-AI3M/total.svg?style=flat)](https://github.com/davidramiro/Marlin-AI3M/releases) [![Open Issues](https://img.shields.io/github/issues-raw/davidramiro/Marlin-AI3M.svg?style=flat)](https://github.com/davidramiro/Marlin-AI3M/issues?q=is%3Aopen+is%3Aissue) [![Closed Issues](https://img.shields.io/github/issues-closed-raw/davidramiro/Marlin-AI3M.svg?style=flat)](https://github.com/davidramiro/Marlin-AI3M/issues?q=is%3Aissue+is%3Aclosed) [![License](https://img.shields.io/github/license/davidramiro/Marlin-AI3M.svg?style=flat)](https://github.com/davidramiro/Marlin-AI3M/blob/master/LICENSE) [![Latest Release](https://img.shields.io/github/release/davidramiro/Marlin-AI3m.svg?style=flat)](https://github.com/davidramiro/Marlin-AI3M/releases/latest/) ![](https://img.shields.io/github/last-commit/davidramiro/Marlin-AI3m.svg?style=flat)
This is my slightly customized version of the [Marlin Firmware](https://github.com/MarlinFirmware/Marlin), gratefully based on [derhopp's repo](https://github.com/derhopp/Marlin-with-Anycubic-i3-Mega-TFT) with his remarkable efforts to get the Anycubic i3 Mega TFT screen to work. This is a custom version of the [Marlin Firmware](https://github.com/MarlinFirmware/Marlin) for the i3 Mega/Mega-S, gratefully based on [derhopp's repo](https://github.com/derhopp/Marlin-with-Anycubic-i3-Mega-TFT) with his remarkable efforts to get the Anycubic TFT screen to work with the latest versions of Marlin.
Feel free to discuss issues and work with me further optimizing this firmware!
This firmware works on every i3 Mega that has two Z-axis endstops. If you have an older model with only one Z endstop, a small [adjustment](https://github.com/davidramiro/Marlin-AI3M/wiki/Customization-&-Compiling#single-z-endstop) is required.
The new **Mega-S** should work too, but you will need to enter two additional commands after flashing the firmware, mentioned in the instructions below.
Looking for a **BLtouch firmware**? Head [this way](https://github.com/MNieddu91/Marlin-AI3M-BLTouch)! Mounting and configuration instructions are included. Looking for a **BLtouch firmware**? Head [this way](https://github.com/MNieddu91/Marlin-AI3M-BLTouch)! Mounting and configuration instructions are included.
Note: This is just a firmware, not magic. A big part of print quality still depends on your slicer settings and mechanical condition of your machine.
#### Make sure to take a look at the [Wiki](https://github.com/davidramiro/Marlin-AI3M/wiki/), especially the [FAQ](https://github.com/davidramiro/Marlin-AI3M/wiki/Frequently-Asked-Questions). #### Make sure to take a look at the [Wiki](https://github.com/davidramiro/Marlin-AI3M/wiki/), especially the [FAQ](https://github.com/davidramiro/Marlin-AI3M/wiki/Frequently-Asked-Questions).
A German translation of the instructions can be found [here](https://kore.cc/i3mega/download/marlin-ai3m_german.pdf). A German translation of the instructions can be found [here](https://kore.cc/i3mega/download/marlin-ai3m_german.pdf).
## Why use this? ## Why use this?
While the i3 Mega is a great printer for its price and produces fantastic results in stock, there are some issues that are easily addressed: While the i3 Mega is a great printer for its price and produces fantastic results in stock, there are some improvements and additional features that this firmware provides:
- Many people have issues getting the Ultrabase leveled perfectly, using Manual Mesh Bed Leveling the printer generates a mesh of the flatness of the bed and compensates for it on the Z-axis for perfect prints without having to level with the screws. - Many people have issues getting the Ultrabase leveled perfectly, using Manual Mesh Bed Leveling the printer generates a mesh of the flatness of the bed and compensates for it on the Z-axis for perfect prints without having to level with the screws.
- Much more efficient bed heating by using PID control. This uses less power and holds the temperature at a steady level. Highly recommended for printing ABS. - Much more efficient bed heating by using PID control. This uses less power and holds the temperature at a steady level. Highly recommended for printing ABS.
@ -156,10 +148,11 @@ M420 S1
- No need to download or create a bed leveling test, simply send those commands to your printer: - No need to download or create a bed leveling test, simply send those commands to your printer:
``` ```
G28 G28
G26 C H200 P25 R25 G26 C H200 P5 R25 Q4.2 Z4
``` ```
- To adjust your filament's needed temperature, change the number of the `H` parameter - To adjust your filament's needed temperature, change the number of the `H` parameter
- Default bed temperature is 60°C, if you need another temperature, add e.g. `B80` - Default bed temperature is 60°C, if you need another temperature, add e.g. `B80`
- `Q` parameter sets retraction length in mm, `Z` sets unretraction.
- If your leveling is good, you will have a complete pattern of your mesh on your bed that you can peel off in one piece - If your leveling is good, you will have a complete pattern of your mesh on your bed that you can peel off in one piece
- Don't worry if the test looks a bit messy, the important thing is just that the line width is the same all over the mesh - Don't worry if the test looks a bit messy, the important thing is just that the line width is the same all over the mesh
- Optional: Hang it up on a wall to display it as a trophy of how great your leveling skills are. - Optional: Hang it up on a wall to display it as a trophy of how great your leveling skills are.