|
@ -558,8 +558,8 @@ static uint8_t target_extruder; |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#if ENABLED(FWRETRACT) // Initialized by settings.load()...
|
|
|
#if ENABLED(FWRETRACT) // Initialized by settings.load()...
|
|
|
bool autoretract_enabled, // M209 S - Autoretract switch
|
|
|
bool autoretract_enabled, // M209 S - Autoretract switch
|
|
|
retracted[EXTRUDERS] = { false }; // Which extruders are currently retracted
|
|
|
retracted[EXTRUDERS] = { false }; // Which extruders are currently retracted
|
|
|
float retract_length, // M207 S - G10 Retract length
|
|
|
float retract_length, // M207 S - G10 Retract length
|
|
|
retract_feedrate_mm_s, // M207 F - G10 Retract feedrate
|
|
|
retract_feedrate_mm_s, // M207 F - G10 Retract feedrate
|
|
|
retract_zlift, // M207 Z - G10 Retract hop size
|
|
|
retract_zlift, // M207 Z - G10 Retract hop size
|
|
@ -3350,14 +3350,16 @@ inline void gcode_G0_G1( |
|
|
gcode_get_destination(); // For X Y Z E F
|
|
|
gcode_get_destination(); // For X Y Z E F
|
|
|
|
|
|
|
|
|
#if ENABLED(FWRETRACT) |
|
|
#if ENABLED(FWRETRACT) |
|
|
// When M209 Autoretract is enabled, convert E-only moves to firmware retract/recover moves
|
|
|
if (MIN_AUTORETRACT <= MAX_AUTORETRACT) { |
|
|
if (autoretract_enabled && parser.seen('E') && !(parser.seen('X') || parser.seen('Y') || parser.seen('Z'))) { |
|
|
// When M209 Autoretract is enabled, convert E-only moves to firmware retract/recover moves
|
|
|
const float echange = destination[E_AXIS] - current_position[E_AXIS]; |
|
|
if (autoretract_enabled && parser.seen('E') && !(parser.seen('X') || parser.seen('Y') || parser.seen('Z'))) { |
|
|
// Is this a retract or recover move?
|
|
|
const float echange = destination[E_AXIS] - current_position[E_AXIS]; |
|
|
if (WITHIN(FABS(echange), MIN_AUTORETRACT, MAX_AUTORETRACT) && retracted[active_extruder] == (echange > 0.0)) { |
|
|
// Is this a retract or recover move?
|
|
|
current_position[E_AXIS] = destination[E_AXIS]; // Hide a G1-based retract/recover from calculations
|
|
|
if (WITHIN(FABS(echange), MIN_AUTORETRACT, MAX_AUTORETRACT) && retracted[active_extruder] == (echange > 0.0)) { |
|
|
sync_plan_position_e(); // AND from the planner
|
|
|
current_position[E_AXIS] = destination[E_AXIS]; // Hide a G1-based retract/recover from calculations
|
|
|
return retract(echange < 0.0); // Firmware-based retract/recover (double-retract ignored)
|
|
|
sync_plan_position_e(); // AND from the planner
|
|
|
|
|
|
return retract(echange < 0.0); // Firmware-based retract/recover (double-retract ignored)
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
#endif // FWRETRACT
|
|
|
#endif // FWRETRACT
|
|
@ -8584,9 +8586,11 @@ inline void gcode_M205() { |
|
|
* moves will be classified as retraction. |
|
|
* moves will be classified as retraction. |
|
|
*/ |
|
|
*/ |
|
|
inline void gcode_M209() { |
|
|
inline void gcode_M209() { |
|
|
if (parser.seen('S')) { |
|
|
if (MIN_AUTORETRACT <= MAX_AUTORETRACT) { |
|
|
autoretract_enabled = parser.value_bool(); |
|
|
if (parser.seen('S')) { |
|
|
for (int i = 0; i < EXTRUDERS; i++) retracted[i] = false; |
|
|
autoretract_enabled = parser.value_bool(); |
|
|
|
|
|
for (uint8_t i = 0; i < EXTRUDERS; i++) retracted[i] = false; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -11051,7 +11055,7 @@ void process_next_command() { |
|
|
gcode_M208(); |
|
|
gcode_M208(); |
|
|
break; |
|
|
break; |
|
|
case 209: // M209: Turn Automatic Retract Detection on/off
|
|
|
case 209: // M209: Turn Automatic Retract Detection on/off
|
|
|
gcode_M209(); |
|
|
if (MIN_AUTORETRACT <= MAX_AUTORETRACT) gcode_M209(); |
|
|
break; |
|
|
break; |
|
|
#endif // FWRETRACT
|
|
|
#endif // FWRETRACT
|
|
|
|
|
|
|
|
|