|
@@ -558,8 +558,8 @@ static uint8_t target_extruder;
|
558
|
558
|
#endif
|
559
|
559
|
|
560
|
560
|
#if ENABLED(FWRETRACT) // Initialized by settings.load()...
|
561
|
|
- bool autoretract_enabled, // M209 S - Autoretract switch
|
562
|
|
- retracted[EXTRUDERS] = { false }; // Which extruders are currently retracted
|
|
561
|
+ bool autoretract_enabled, // M209 S - Autoretract switch
|
|
562
|
+ retracted[EXTRUDERS] = { false }; // Which extruders are currently retracted
|
563
|
563
|
float retract_length, // M207 S - G10 Retract length
|
564
|
564
|
retract_feedrate_mm_s, // M207 F - G10 Retract feedrate
|
565
|
565
|
retract_zlift, // M207 Z - G10 Retract hop size
|
|
@@ -3350,14 +3350,16 @@ inline void gcode_G0_G1(
|
3350
|
3350
|
gcode_get_destination(); // For X Y Z E F
|
3351
|
3351
|
|
3352
|
3352
|
#if ENABLED(FWRETRACT)
|
3353
|
|
- // When M209 Autoretract is enabled, convert E-only moves to firmware retract/recover moves
|
3354
|
|
- if (autoretract_enabled && parser.seen('E') && !(parser.seen('X') || parser.seen('Y') || parser.seen('Z'))) {
|
3355
|
|
- const float echange = destination[E_AXIS] - current_position[E_AXIS];
|
3356
|
|
- // Is this a retract or recover move?
|
3357
|
|
- if (WITHIN(FABS(echange), MIN_AUTORETRACT, MAX_AUTORETRACT) && retracted[active_extruder] == (echange > 0.0)) {
|
3358
|
|
- current_position[E_AXIS] = destination[E_AXIS]; // Hide a G1-based retract/recover from calculations
|
3359
|
|
- sync_plan_position_e(); // AND from the planner
|
3360
|
|
- return retract(echange < 0.0); // Firmware-based retract/recover (double-retract ignored)
|
|
3353
|
+ if (MIN_AUTORETRACT <= MAX_AUTORETRACT) {
|
|
3354
|
+ // When M209 Autoretract is enabled, convert E-only moves to firmware retract/recover moves
|
|
3355
|
+ if (autoretract_enabled && parser.seen('E') && !(parser.seen('X') || parser.seen('Y') || parser.seen('Z'))) {
|
|
3356
|
+ const float echange = destination[E_AXIS] - current_position[E_AXIS];
|
|
3357
|
+ // Is this a retract or recover move?
|
|
3358
|
+ if (WITHIN(FABS(echange), MIN_AUTORETRACT, MAX_AUTORETRACT) && retracted[active_extruder] == (echange > 0.0)) {
|
|
3359
|
+ current_position[E_AXIS] = destination[E_AXIS]; // Hide a G1-based retract/recover from calculations
|
|
3360
|
+ sync_plan_position_e(); // AND from the planner
|
|
3361
|
+ return retract(echange < 0.0); // Firmware-based retract/recover (double-retract ignored)
|
|
3362
|
+ }
|
3361
|
3363
|
}
|
3362
|
3364
|
}
|
3363
|
3365
|
#endif // FWRETRACT
|
|
@@ -8584,9 +8586,11 @@ inline void gcode_M205() {
|
8584
|
8586
|
* moves will be classified as retraction.
|
8585
|
8587
|
*/
|
8586
|
8588
|
inline void gcode_M209() {
|
8587
|
|
- if (parser.seen('S')) {
|
8588
|
|
- autoretract_enabled = parser.value_bool();
|
8589
|
|
- for (int i = 0; i < EXTRUDERS; i++) retracted[i] = false;
|
|
8589
|
+ if (MIN_AUTORETRACT <= MAX_AUTORETRACT) {
|
|
8590
|
+ if (parser.seen('S')) {
|
|
8591
|
+ autoretract_enabled = parser.value_bool();
|
|
8592
|
+ for (uint8_t i = 0; i < EXTRUDERS; i++) retracted[i] = false;
|
|
8593
|
+ }
|
8590
|
8594
|
}
|
8591
|
8595
|
}
|
8592
|
8596
|
|
|
@@ -11051,7 +11055,7 @@ void process_next_command() {
|
11051
|
11055
|
gcode_M208();
|
11052
|
11056
|
break;
|
11053
|
11057
|
case 209: // M209: Turn Automatic Retract Detection on/off
|
11054
|
|
- gcode_M209();
|
|
11058
|
+ if (MIN_AUTORETRACT <= MAX_AUTORETRACT) gcode_M209();
|
11055
|
11059
|
break;
|
11056
|
11060
|
#endif // FWRETRACT
|
11057
|
11061
|
|