hop_amount => current_hop
This commit is contained in:
parent
eafd62308e
commit
0c01099f17
@ -54,7 +54,7 @@ float FWRetract::retract_length, // M207 S - G10 Retract len
|
|||||||
FWRetract::swap_retract_length, // M207 W - G10 Swap Retract length
|
FWRetract::swap_retract_length, // M207 W - G10 Swap Retract length
|
||||||
FWRetract::swap_retract_recover_length, // M208 W - G11 Swap Recover length
|
FWRetract::swap_retract_recover_length, // M208 W - G11 Swap Recover length
|
||||||
FWRetract::swap_retract_recover_feedrate_mm_s, // M208 R - G11 Swap Recover feedrate
|
FWRetract::swap_retract_recover_feedrate_mm_s, // M208 R - G11 Swap Recover feedrate
|
||||||
FWRetract::hop_amount;
|
FWRetract::current_hop;
|
||||||
|
|
||||||
void FWRetract::reset() {
|
void FWRetract::reset() {
|
||||||
autoretract_enabled = false;
|
autoretract_enabled = false;
|
||||||
@ -66,7 +66,7 @@ void FWRetract::reset() {
|
|||||||
swap_retract_length = RETRACT_LENGTH_SWAP;
|
swap_retract_length = RETRACT_LENGTH_SWAP;
|
||||||
swap_retract_recover_length = RETRACT_RECOVER_LENGTH_SWAP;
|
swap_retract_recover_length = RETRACT_RECOVER_LENGTH_SWAP;
|
||||||
swap_retract_recover_feedrate_mm_s = RETRACT_RECOVER_FEEDRATE_SWAP;
|
swap_retract_recover_feedrate_mm_s = RETRACT_RECOVER_FEEDRATE_SWAP;
|
||||||
hop_amount = 0.0;
|
current_hop = 0.0;
|
||||||
|
|
||||||
for (uint8_t i = 0; i < EXTRUDERS; ++i) {
|
for (uint8_t i = 0; i < EXTRUDERS; ++i) {
|
||||||
retracted[i] = false;
|
retracted[i] = false;
|
||||||
@ -96,7 +96,7 @@ void FWRetract::retract(const bool retracting
|
|||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
|
|
||||||
static float hop_amount = 0.0; // Total amount lifted, for use in recover
|
static float current_hop = 0.0; // Total amount lifted, for use in recover
|
||||||
|
|
||||||
// Prevent two retracts or recovers in a row
|
// Prevent two retracts or recovers in a row
|
||||||
if (retracted[active_extruder] == retracting) return;
|
if (retracted[active_extruder] == retracting) return;
|
||||||
@ -125,7 +125,7 @@ void FWRetract::retract(const bool retracting
|
|||||||
}
|
}
|
||||||
SERIAL_ECHOLNPAIR("current_position[z] ", current_position[Z_AXIS]);
|
SERIAL_ECHOLNPAIR("current_position[z] ", current_position[Z_AXIS]);
|
||||||
SERIAL_ECHOLNPAIR("current_position[e] ", current_position[E_AXIS]);
|
SERIAL_ECHOLNPAIR("current_position[e] ", current_position[E_AXIS]);
|
||||||
SERIAL_ECHOLNPAIR("hop_amount ", hop_amount);
|
SERIAL_ECHOLNPAIR("current_hop ", current_hop);
|
||||||
//*/
|
//*/
|
||||||
|
|
||||||
const float old_feedrate_mm_s = feedrate_mm_s,
|
const float old_feedrate_mm_s = feedrate_mm_s,
|
||||||
@ -144,8 +144,8 @@ void FWRetract::retract(const bool retracting
|
|||||||
prepare_move_to_destination(); // set_current_to_destination
|
prepare_move_to_destination(); // set_current_to_destination
|
||||||
|
|
||||||
// Is a Z hop set, and has the hop not yet been done?
|
// Is a Z hop set, and has the hop not yet been done?
|
||||||
if (retract_zlift > 0.01 && !hop_amount) { // Apply hop only once
|
if (retract_zlift > 0.01 && !current_hop) { // Apply hop only once
|
||||||
hop_amount += retract_zlift; // Add to the hop total (again, only once)
|
current_hop += retract_zlift; // Add to the hop total (again, only once)
|
||||||
destination[Z_AXIS] += retract_zlift; // Raise Z by the zlift (M207 Z) amount
|
destination[Z_AXIS] += retract_zlift; // Raise Z by the zlift (M207 Z) amount
|
||||||
feedrate_mm_s = planner.max_feedrate_mm_s[Z_AXIS]; // Maximum Z feedrate
|
feedrate_mm_s = planner.max_feedrate_mm_s[Z_AXIS]; // Maximum Z feedrate
|
||||||
prepare_move_to_destination(); // Raise up, set_current_to_destination
|
prepare_move_to_destination(); // Raise up, set_current_to_destination
|
||||||
@ -153,12 +153,12 @@ void FWRetract::retract(const bool retracting
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// If a hop was done and Z hasn't changed, undo the Z hop
|
// If a hop was done and Z hasn't changed, undo the Z hop
|
||||||
if (hop_amount) {
|
if (current_hop) {
|
||||||
current_position[Z_AXIS] += hop_amount; // Restore the actual Z position
|
current_position[Z_AXIS] += current_hop; // Restore the actual Z position
|
||||||
SYNC_PLAN_POSITION_KINEMATIC(); // Unspoof the position planner
|
SYNC_PLAN_POSITION_KINEMATIC(); // Unspoof the position planner
|
||||||
feedrate_mm_s = planner.max_feedrate_mm_s[Z_AXIS]; // Z feedrate to max
|
feedrate_mm_s = planner.max_feedrate_mm_s[Z_AXIS]; // Z feedrate to max
|
||||||
prepare_move_to_destination(); // Lower Z, set_current_to_destination
|
prepare_move_to_destination(); // Lower Z, set_current_to_destination
|
||||||
hop_amount = 0.0; // Clear the hop amount
|
current_hop = 0.0; // Clear the hop amount
|
||||||
}
|
}
|
||||||
|
|
||||||
destination[E_AXIS] += (base_retract + (swapping ? swap_retract_recover_length : retract_recover_length)) * renormalize;
|
destination[E_AXIS] += (base_retract + (swapping ? swap_retract_recover_length : retract_recover_length)) * renormalize;
|
||||||
@ -192,7 +192,7 @@ void FWRetract::retract(const bool retracting
|
|||||||
}
|
}
|
||||||
SERIAL_ECHOLNPAIR("current_position[z] ", current_position[Z_AXIS]);
|
SERIAL_ECHOLNPAIR("current_position[z] ", current_position[Z_AXIS]);
|
||||||
SERIAL_ECHOLNPAIR("current_position[e] ", current_position[E_AXIS]);
|
SERIAL_ECHOLNPAIR("current_position[e] ", current_position[E_AXIS]);
|
||||||
SERIAL_ECHOLNPAIR("hop_amount ", hop_amount);
|
SERIAL_ECHOLNPAIR("current_hop ", current_hop);
|
||||||
//*/
|
//*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ public:
|
|||||||
swap_retract_length, // M207 W - G10 Swap Retract length
|
swap_retract_length, // M207 W - G10 Swap Retract length
|
||||||
swap_retract_recover_length, // M208 W - G11 Swap Recover length
|
swap_retract_recover_length, // M208 W - G11 Swap Recover length
|
||||||
swap_retract_recover_feedrate_mm_s, // M208 R - G11 Swap Recover feedrate
|
swap_retract_recover_feedrate_mm_s, // M208 R - G11 Swap Recover feedrate
|
||||||
hop_amount;
|
current_hop;
|
||||||
|
|
||||||
FWRetract() { reset(); }
|
FWRetract() { reset(); }
|
||||||
|
|
||||||
|
@ -1462,7 +1462,7 @@ void homeaxis(const AxisEnum axis) {
|
|||||||
|
|
||||||
// Clear retracted status if homing the Z axis
|
// Clear retracted status if homing the Z axis
|
||||||
#if ENABLED(FWRETRACT)
|
#if ENABLED(FWRETRACT)
|
||||||
if (axis == Z_AXIS) fwretract.hop_amount = 0.0;
|
if (axis == Z_AXIS) fwretract.current_hop = 0.0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||||
|
Loading…
Reference in New Issue
Block a user