Add a feedRate_t data type (#15349)

This commit is contained in:
Scott Lahteine
2019-09-26 01:28:09 -05:00
committed by GitHub
parent ee7558a622
commit 455dabb183
42 changed files with 384 additions and 377 deletions

View File

@ -329,8 +329,8 @@ bool I2CPositionEncoder::test_axis() {
float startCoord[NUM_AXIS] = { 0 }, endCoord[NUM_AXIS] = { 0 };
const float startPosition = soft_endstop[encoderAxis].min + 10,
endPosition = soft_endstop[encoderAxis].max - 10,
feedrate = FLOOR(MMM_TO_MMS((encoderAxis == Z_AXIS) ? HOMING_FEEDRATE_Z : HOMING_FEEDRATE_XY));
endPosition = soft_endstop[encoderAxis].max - 10;
const feedRate_t fr_mm_s = FLOOR(MMM_TO_MMS((encoderAxis == Z_AXIS) ? HOMING_FEEDRATE_Z : HOMING_FEEDRATE_XY));
ec = false;
@ -344,7 +344,7 @@ bool I2CPositionEncoder::test_axis() {
planner.synchronize();
planner.buffer_line(startCoord[X_AXIS], startCoord[Y_AXIS], startCoord[Z_AXIS],
planner.get_axis_position_mm(E_AXIS), feedrate, 0);
planner.get_axis_position_mm(E_AXIS), fr_mm_s, 0);
planner.synchronize();
// if the module isn't currently trusted, wait until it is (or until it should be if things are working)
@ -356,7 +356,7 @@ bool I2CPositionEncoder::test_axis() {
if (trusted) { // if trusted, commence test
planner.buffer_line(endCoord[X_AXIS], endCoord[Y_AXIS], endCoord[Z_AXIS],
planner.get_axis_position_mm(E_AXIS), feedrate, 0);
planner.get_axis_position_mm(E_AXIS), fr_mm_s, 0);
planner.synchronize();
}
@ -379,11 +379,9 @@ void I2CPositionEncoder::calibrate_steps_mm(const uint8_t iter) {
travelDistance, travelledDistance, total = 0,
startCoord[NUM_AXIS] = { 0 }, endCoord[NUM_AXIS] = { 0 };
float feedrate;
int32_t startCount, stopCount;
feedrate = MMM_TO_MMS((encoderAxis == Z_AXIS) ? HOMING_FEEDRATE_Z : HOMING_FEEDRATE_XY);
const feedRate_t fr_mm_s = MMM_TO_MMS((encoderAxis == Z_AXIS) ? HOMING_FEEDRATE_Z : HOMING_FEEDRATE_XY);
bool oldec = ec;
ec = false;
@ -404,7 +402,7 @@ void I2CPositionEncoder::calibrate_steps_mm(const uint8_t iter) {
LOOP_L_N(i, iter) {
planner.buffer_line(startCoord[X_AXIS], startCoord[Y_AXIS], startCoord[Z_AXIS],
planner.get_axis_position_mm(E_AXIS), feedrate, 0);
planner.get_axis_position_mm(E_AXIS), fr_mm_s, 0);
planner.synchronize();
delay(250);
@ -413,7 +411,7 @@ void I2CPositionEncoder::calibrate_steps_mm(const uint8_t iter) {
//do_blocking_move_to(endCoord[X_AXIS],endCoord[Y_AXIS],endCoord[Z_AXIS]);
planner.buffer_line(endCoord[X_AXIS], endCoord[Y_AXIS], endCoord[Z_AXIS],
planner.get_axis_position_mm(E_AXIS), feedrate, 0);
planner.get_axis_position_mm(E_AXIS), fr_mm_s, 0);
planner.synchronize();
//Read encoder distance

View File

@ -360,7 +360,7 @@ float bilinear_z_offset(const float raw[XYZ]) {
* Prepare a bilinear-leveled linear move on Cartesian,
* splitting the move where it crosses grid borders.
*/
void bilinear_line_to_destination(const float fr_mm_s, uint16_t x_splits, uint16_t y_splits) {
void bilinear_line_to_destination(const feedRate_t scaled_fr_mm_s, uint16_t x_splits, uint16_t y_splits) {
// Get current and destination cells for this line
int cx1 = CELL_INDEX(X, current_position[X_AXIS]),
cy1 = CELL_INDEX(Y, current_position[Y_AXIS]),
@ -373,8 +373,8 @@ float bilinear_z_offset(const float raw[XYZ]) {
// Start and end in the same cell? No split needed.
if (cx1 == cx2 && cy1 == cy2) {
buffer_line_to_destination(fr_mm_s);
set_current_from_destination();
line_to_current_position(scaled_fr_mm_s);
return;
}
@ -405,8 +405,8 @@ float bilinear_z_offset(const float raw[XYZ]) {
else {
// Must already have been split on these border(s)
// This should be a rare case.
buffer_line_to_destination(fr_mm_s);
set_current_from_destination();
line_to_current_position(scaled_fr_mm_s);
return;
}
@ -414,11 +414,11 @@ float bilinear_z_offset(const float raw[XYZ]) {
destination[E_AXIS] = LINE_SEGMENT_END(E);
// Do the split and look for more borders
bilinear_line_to_destination(fr_mm_s, x_splits, y_splits);
bilinear_line_to_destination(scaled_fr_mm_s, x_splits, y_splits);
// Restore destination from stack
COPY(destination, end);
bilinear_line_to_destination(fr_mm_s, x_splits, y_splits);
bilinear_line_to_destination(scaled_fr_mm_s, x_splits, y_splits);
}
#endif // IS_CARTESIAN && !SEGMENT_LEVELED_MOVES

View File

@ -37,7 +37,7 @@ void refresh_bed_level();
#endif
#if IS_CARTESIAN && DISABLED(SEGMENT_LEVELED_MOVES)
void bilinear_line_to_destination(const float fr_mm_s, uint16_t x_splits=0xFFFF, uint16_t y_splits=0xFFFF);
void bilinear_line_to_destination(const feedRate_t &scaled_fr_mm_s, uint16_t x_splits=0xFFFF, uint16_t y_splits=0xFFFF);
#endif
#define _GET_MESH_X(I) (bilinear_start[X_AXIS] + (I) * bilinear_grid_spacing[X_AXIS])

View File

@ -64,7 +64,7 @@
* Prepare a mesh-leveled linear move in a Cartesian setup,
* splitting the move where it crosses mesh borders.
*/
void mesh_bed_leveling::line_to_destination(const float fr_mm_s, uint8_t x_splits, uint8_t y_splits) {
void mesh_bed_leveling::line_to_destination(const feedRate_t &scaled_fr_mm_s, uint8_t x_splits, uint8_t y_splits) {
// Get current and destination cells for this line
int cx1 = cell_index_x(current_position[X_AXIS]),
cy1 = cell_index_y(current_position[Y_AXIS]),
@ -77,7 +77,7 @@
// Start and end in the same cell? No split needed.
if (cx1 == cx2 && cy1 == cy2) {
line_to_destination(fr_mm_s);
line_to_destination(scaled_fr_mm_s);
set_current_from_destination();
return;
}
@ -109,7 +109,7 @@
else {
// Must already have been split on these border(s)
// This should be a rare case.
line_to_destination(fr_mm_s);
line_to_destination(scaled_fr_mm_s);
set_current_from_destination();
return;
}
@ -118,11 +118,11 @@
destination[E_AXIS] = MBL_SEGMENT_END(E);
// Do the split and look for more borders
line_to_destination(fr_mm_s, x_splits, y_splits);
line_to_destination(scaled_fr_mm_s, x_splits, y_splits);
// Restore destination from stack
COPY(destination, end);
line_to_destination(fr_mm_s, x_splits, y_splits);
line_to_destination(scaled_fr_mm_s, x_splits, y_splits);
}
#endif // IS_CARTESIAN && !SEGMENT_LEVELED_MOVES

View File

@ -116,7 +116,7 @@ public:
}
#if IS_CARTESIAN && DISABLED(SEGMENT_LEVELED_MOVES)
static void line_to_destination(const float fr_mm_s, uint8_t x_splits=0xFF, uint8_t y_splits=0xFF);
static void line_to_destination(const feedRate_t &scaled_fr_mm_s, uint8_t x_splits=0xFF, uint8_t y_splits=0xFF);
#endif
};

View File

@ -285,9 +285,9 @@ class unified_bed_leveling {
}
#if UBL_SEGMENTED
static bool prepare_segmented_line_to(const float (&rtarget)[XYZE], const float &feedrate);
static bool line_to_destination_segmented(const feedRate_t &scaled_fr_mm_s);
#else
static void line_to_destination_cartesian(const float &fr, const uint8_t e);
static void line_to_destination_cartesian(const feedRate_t &scaled_fr_mm_s, const uint8_t e);
#endif
static inline bool mesh_is_valid() {

View File

@ -43,7 +43,7 @@
#if !UBL_SEGMENTED
void unified_bed_leveling::line_to_destination_cartesian(const float &feed_rate, const uint8_t extruder) {
void unified_bed_leveling::line_to_destination_cartesian(const feedRate_t &scaled_fr_mm_s, const uint8_t extruder) {
/**
* Much of the nozzle movement will be within the same cell. So we will do as little computation
* as possible to determine if this is the case. If this move is within the same cell, we will
@ -79,9 +79,8 @@
+ UBL_Z_RAISE_WHEN_OFF_MESH
#endif
;
planner.buffer_segment(end[X_AXIS], end[Y_AXIS], end[Z_AXIS] + z_raise, end[E_AXIS], feed_rate, extruder);
planner.buffer_segment(end[X_AXIS], end[Y_AXIS], end[Z_AXIS] + z_raise, end[E_AXIS], scaled_fr_mm_s, extruder);
set_current_from_destination();
return;
}
@ -103,8 +102,7 @@
// Undefined parts of the Mesh in z_values[][] are NAN.
// Replace NAN corrections with 0.0 to prevent NAN propagation.
planner.buffer_segment(end[X_AXIS], end[Y_AXIS], end[Z_AXIS] + (isnan(z0) ? 0.0 : z0), end[E_AXIS], feed_rate, extruder);
planner.buffer_segment(end[X_AXIS], end[Y_AXIS], end[Z_AXIS] + (isnan(z0) ? 0.0 : z0), end[E_AXIS], scaled_fr_mm_s, extruder);
set_current_from_destination();
return;
}
@ -194,7 +192,7 @@
z_position = end[Z_AXIS];
}
planner.buffer_segment(rx, ry, z_position + z0, e_position, feed_rate, extruder);
planner.buffer_segment(rx, ry, z_position + z0, e_position, scaled_fr_mm_s, extruder);
} //else printf("FIRST MOVE PRUNED ");
}
@ -242,7 +240,7 @@
z_position = end[Z_AXIS];
}
if (!planner.buffer_segment(rx, ry, z_position + z0, e_position, feed_rate, extruder))
if (!planner.buffer_segment(rx, ry, z_position + z0, e_position, scaled_fr_mm_s, extruder))
break;
} //else printf("FIRST MOVE PRUNED ");
}
@ -297,7 +295,7 @@
e_position = end[E_AXIS];
z_position = end[Z_AXIS];
}
if (!planner.buffer_segment(rx, next_mesh_line_y, z_position + z0, e_position, feed_rate, extruder))
if (!planner.buffer_segment(rx, next_mesh_line_y, z_position + z0, e_position, scaled_fr_mm_s, extruder))
break;
current_yi += dyi;
yi_cnt--;
@ -321,7 +319,7 @@
z_position = end[Z_AXIS];
}
if (!planner.buffer_segment(next_mesh_line_x, ry, z_position + z0, e_position, feed_rate, extruder))
if (!planner.buffer_segment(next_mesh_line_x, ry, z_position + z0, e_position, scaled_fr_mm_s, extruder))
break;
current_xi += dxi;
xi_cnt--;
@ -356,25 +354,25 @@
* Returns true if did NOT move, false if moved (requires current_position update).
*/
bool _O2 unified_bed_leveling::prepare_segmented_line_to(const float (&rtarget)[XYZE], const float &feedrate) {
bool _O2 unified_bed_leveling::line_to_destination_segmented(const feedRate_t &scaled_fr_mm_s) {
if (!position_is_reachable(rtarget[X_AXIS], rtarget[Y_AXIS])) // fail if moving outside reachable boundary
if (!position_is_reachable(destination[X_AXIS], destination[Y_AXIS])) // fail if moving outside reachable boundary
return true; // did not move, so current_position still accurate
const float total[XYZE] = {
rtarget[X_AXIS] - current_position[X_AXIS],
rtarget[Y_AXIS] - current_position[Y_AXIS],
rtarget[Z_AXIS] - current_position[Z_AXIS],
rtarget[E_AXIS] - current_position[E_AXIS]
destination[X_AXIS] - current_position[X_AXIS],
destination[Y_AXIS] - current_position[Y_AXIS],
destination[Z_AXIS] - current_position[Z_AXIS],
destination[E_AXIS] - current_position[E_AXIS]
};
const float cartesian_xy_mm = HYPOT(total[X_AXIS], total[Y_AXIS]); // total horizontal xy distance
#if IS_KINEMATIC
const float seconds = cartesian_xy_mm / feedrate; // seconds to move xy distance at requested rate
uint16_t segments = LROUND(delta_segments_per_second * seconds), // preferred number of segments for distance @ feedrate
seglimit = LROUND(cartesian_xy_mm * RECIPROCAL(DELTA_SEGMENT_MIN_LENGTH)); // number of segments at minimum segment length
NOMORE(segments, seglimit); // limit to minimum segment length (fewer segments)
const float seconds = cartesian_xy_mm / scaled_fr_mm_s; // Duration of XY move at requested rate
uint16_t segments = LROUND(delta_segments_per_second * seconds), // Preferred number of segments for distance @ feedrate
seglimit = LROUND(cartesian_xy_mm * RECIPROCAL(DELTA_SEGMENT_MIN_LENGTH)); // Number of segments at minimum segment length
NOMORE(segments, seglimit); // Limit to minimum segment length (fewer segments)
#else
uint16_t segments = LROUND(cartesian_xy_mm * RECIPROCAL(DELTA_SEGMENT_MIN_LENGTH)); // cartesian fixed segment length
#endif
@ -384,7 +382,7 @@
const float segment_xyz_mm = HYPOT(cartesian_xy_mm, total[Z_AXIS]) * inv_segments; // length of each segment
#if ENABLED(SCARA_FEEDRATE_SCALING)
const float inv_duration = feedrate / segment_xyz_mm;
const float inv_duration = scaled_fr_mm_s / segment_xyz_mm;
#endif
const float diff[XYZE] = {
@ -404,17 +402,17 @@
current_position[E_AXIS]
};
// Only compute leveling per segment if ubl active and target below z_fade_height.
if (!planner.leveling_active || !planner.leveling_active_at_z(rtarget[Z_AXIS])) { // no mesh leveling
// Just do plain segmentation if UBL is inactive or the target is above the fade height
if (!planner.leveling_active || !planner.leveling_active_at_z(destination[Z_AXIS])) {
while (--segments) {
LOOP_XYZE(i) raw[i] += diff[i];
planner.buffer_line(raw, feedrate, active_extruder, segment_xyz_mm
planner.buffer_line(raw, scaled_fr_mm_s, active_extruder, segment_xyz_mm
#if ENABLED(SCARA_FEEDRATE_SCALING)
, inv_duration
#endif
);
}
planner.buffer_line(rtarget, feedrate, active_extruder, segment_xyz_mm
planner.buffer_line(destination, scaled_fr_mm_s, active_extruder, segment_xyz_mm
#if ENABLED(SCARA_FEEDRATE_SCALING)
, inv_duration
#endif
@ -425,7 +423,7 @@
// Otherwise perform per-segment leveling
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
const float fade_scaling_factor = planner.fade_scaling_factor_for_z(rtarget[Z_AXIS]);
const float fade_scaling_factor = planner.fade_scaling_factor_for_z(destination[Z_AXIS]);
#endif
// increment to first segment destination
@ -483,8 +481,7 @@
for (;;) { // for all segments within this mesh cell
if (--segments == 0) // if this is last segment, use rtarget for exact
COPY(raw, rtarget);
if (--segments == 0) COPY(raw, destination); // if this is last segment, use destination for exact
const float z_cxcy = (z_cxy0 + z_cxym * cy) // interpolated mesh z height along cx at cy
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
@ -494,7 +491,7 @@
const float z = raw[Z_AXIS];
raw[Z_AXIS] += z_cxcy;
planner.buffer_line(raw, feedrate, active_extruder, segment_xyz_mm
planner.buffer_line(raw, scaled_fr_mm_s, active_extruder, segment_xyz_mm
#if ENABLED(SCARA_FEEDRATE_SCALING)
, inv_duration
#endif

View File

@ -128,10 +128,7 @@ void FWRetract::retract(const bool retracting
SERIAL_ECHOLNPAIR("current_hop ", current_hop);
//*/
const float old_feedrate_mm_s = feedrate_mm_s,
unscale_e = RECIPROCAL(planner.e_factor[active_extruder]),
unscale_fr = 100.0 / feedrate_percentage, // Disable feedrate scaling for retract moves
base_retract = (
const float base_retract = (
(swapping ? settings.swap_retract_length : settings.retract_length)
#if ENABLED(RETRACT_SYNC_MIXING)
* (MIXING_STEPPERS)
@ -146,53 +143,53 @@ void FWRetract::retract(const bool retracting
mixer.T(MIXER_AUTORETRACT_TOOL);
#endif
const feedRate_t fr_max_z = planner.settings.max_feedrate_mm_s[Z_AXIS];
if (retracting) {
// Retract by moving from a faux E position back to the current E position
feedrate_mm_s = (
settings.retract_feedrate_mm_s * unscale_fr
current_retract[active_extruder] = base_retract;
prepare_internal_move_to_destination( // set_current_to_destination
settings.retract_feedrate_mm_s
#if ENABLED(RETRACT_SYNC_MIXING)
* (MIXING_STEPPERS)
#endif
);
current_retract[active_extruder] = base_retract * unscale_e;
prepare_move_to_destination(); // set_current_to_destination
// Is a Z hop set, and has the hop not yet been done?
if (settings.retract_zraise > 0.01 && !current_hop) { // Apply hop only once
current_hop += settings.retract_zraise; // Add to the hop total (again, only once)
feedrate_mm_s = planner.settings.max_feedrate_mm_s[Z_AXIS] * unscale_fr; // Maximum Z feedrate
prepare_move_to_destination(); // Raise up, set_current_to_destination
if (!current_hop && settings.retract_zraise > 0.01f) { // Apply hop only once
current_hop += settings.retract_zraise; // Add to the hop total (again, only once)
// Raise up, set_current_to_destination. Maximum Z feedrate
prepare_internal_move_to_destination(fr_max_z);
}
}
else {
// If a hop was done and Z hasn't changed, undo the Z hop
if (current_hop) {
current_hop = 0.0;
feedrate_mm_s = planner.settings.max_feedrate_mm_s[Z_AXIS] * unscale_fr; // Z feedrate to max
prepare_move_to_destination(); // Lower Z, set_current_to_destination
current_hop = 0;
// Lower Z, set_current_to_destination. Maximum Z feedrate
prepare_internal_move_to_destination(fr_max_z);
}
const float extra_recover = swapping ? settings.swap_retract_recover_extra : settings.retract_recover_extra;
if (extra_recover != 0.0) {
if (extra_recover) {
current_position[E_AXIS] -= extra_recover; // Adjust the current E position by the extra amount to recover
sync_plan_position_e(); // Sync the planner position so the extra amount is recovered
}
current_retract[active_extruder] = 0.0;
feedrate_mm_s = (
(swapping ? settings.swap_retract_recover_feedrate_mm_s : settings.retract_recover_feedrate_mm_s) * unscale_fr
current_retract[active_extruder] = 0;
const feedRate_t fr_mm_s = (
(swapping ? settings.swap_retract_recover_feedrate_mm_s : settings.retract_recover_feedrate_mm_s)
#if ENABLED(RETRACT_SYNC_MIXING)
* (MIXING_STEPPERS)
#endif
);
prepare_move_to_destination(); // Recover E, set_current_to_destination
prepare_internal_move_to_destination(fr_mm_s); // Recover E, set_current_to_destination
}
#if ENABLED(RETRACT_SYNC_MIXING)
mixer.T(old_mixing_tool); // Restore original mixing tool
#endif
feedrate_mm_s = old_feedrate_mm_s; // Restore original feedrate
retracted[active_extruder] = retracting; // Active extruder now retracted / recovered
// If swap retract/recover update the retracted_swap flag too

View File

@ -28,14 +28,14 @@
#include "../inc/MarlinConfigPre.h"
typedef struct {
float retract_length, // M207 S - G10 Retract length
retract_feedrate_mm_s, // M207 F - G10 Retract feedrate
retract_zraise, // M207 Z - G10 Retract hop size
retract_recover_extra, // M208 S - G11 Recover length
retract_recover_feedrate_mm_s, // M208 F - G11 Recover feedrate
swap_retract_length, // M207 W - G10 Swap Retract length
swap_retract_recover_extra, // M208 W - G11 Swap Recover length
swap_retract_recover_feedrate_mm_s; // M208 R - G11 Swap Recover feedrate
float retract_length; // M207 S - G10 Retract length
feedRate_t retract_feedrate_mm_s; // M207 F - G10 Retract feedrate
float retract_zraise, // M207 Z - G10 Retract hop size
retract_recover_extra; // M208 S - G11 Recover length
feedRate_t retract_recover_feedrate_mm_s; // M208 F - G11 Recover feedrate
float swap_retract_length, // M207 W - G10 Swap Retract length
swap_retract_recover_extra; // M208 W - G11 Swap Recover length
feedRate_t swap_retract_recover_feedrate_mm_s; // M208 R - G11 Swap Recover feedrate
} fwretract_settings_t;
#if ENABLED(FWRETRACT)

View File

@ -122,7 +122,7 @@ static bool ensure_safe_temperature(const PauseMode mode=PAUSE_MODE_SAME) {
return thermalManager.wait_for_hotend(active_extruder);
}
void do_pause_e_move(const float &length, const float &fr_mm_s) {
void do_pause_e_move(const float &length, const feedRate_t &fr_mm_s) {
#if HAS_FILAMENT_SENSOR
runout.reset();
#endif
@ -648,16 +648,16 @@ void resume_print(const float &slow_load_length/*=0*/, const float &fast_load_le
#endif
// If resume_position is negative
if (resume_position[E_AXIS] < 0) do_pause_e_move(resume_position[E_AXIS], PAUSE_PARK_RETRACT_FEEDRATE);
if (resume_position[E_AXIS] < 0) do_pause_e_move(resume_position[E_AXIS], feedRate_t(PAUSE_PARK_RETRACT_FEEDRATE));
// Move XY to starting position, then Z
do_blocking_move_to_xy(resume_position[X_AXIS], resume_position[Y_AXIS], NOZZLE_PARK_XY_FEEDRATE);
do_blocking_move_to_xy(resume_position[X_AXIS], resume_position[Y_AXIS], feedRate_t(NOZZLE_PARK_XY_FEEDRATE));
// Move Z_AXIS to saved position
do_blocking_move_to_z(resume_position[Z_AXIS], NOZZLE_PARK_Z_FEEDRATE);
do_blocking_move_to_z(resume_position[Z_AXIS], feedRate_t(NOZZLE_PARK_Z_FEEDRATE));
#if ADVANCED_PAUSE_RESUME_PRIME != 0
do_pause_e_move(ADVANCED_PAUSE_RESUME_PRIME, ADVANCED_PAUSE_PURGE_FEEDRATE);
do_pause_e_move(ADVANCED_PAUSE_RESUME_PRIME, feedRate_t(ADVANCED_PAUSE_PURGE_FEEDRATE));
#endif
// Now all extrusion positions are resumed and ready to be confirmed

View File

@ -81,7 +81,7 @@ extern uint8_t did_pause_print;
#define DXC_PASS
#endif
void do_pause_e_move(const float &length, const float &fr_mm_s);
void do_pause_e_move(const float &length, const feedRate_t &fr_mm_s);
bool pause_print(const float &retract, const point_t &park_point, const float &unload_length=0, const bool show_lcd=false DXC_PARAMS);

View File

@ -102,8 +102,8 @@ char MMU2::rx_buffer[16], MMU2::tx_buffer[16];
#if HAS_LCD_MENU && ENABLED(MMU2_MENUS)
struct E_Step {
float extrude; //!< extrude distance in mm
float feedRate; //!< feed rate in mm/s
float extrude; //!< extrude distance in mm
feedRate_t feedRate; //!< feed rate in mm/s
};
static constexpr E_Step ramming_sequence[] PROGMEM = { MMU2_RAMMING_SEQUENCE };
@ -606,10 +606,10 @@ void MMU2::manage_response(const bool move_axes, const bool turn_off_nozzle) {
BUZZ(200, 404);
// Move XY to starting position, then Z
do_blocking_move_to_xy(resume_position[X_AXIS], resume_position[Y_AXIS], NOZZLE_PARK_XY_FEEDRATE);
do_blocking_move_to_xy(resume_position[X_AXIS], resume_position[Y_AXIS], feedRate_t(NOZZLE_PARK_XY_FEEDRATE));
// Move Z_AXIS to saved position
do_blocking_move_to_z(resume_position[Z_AXIS], NOZZLE_PARK_Z_FEEDRATE);
do_blocking_move_to_z(resume_position[Z_AXIS], feedRate_t(NOZZLE_PARK_Z_FEEDRATE));
}
else {
BUZZ(200, 404);
@ -783,15 +783,14 @@ void MMU2::filament_runout() {
const E_Step* step = sequence;
for (uint8_t i = 0; i < steps; i++) {
const float es = pgm_read_float(&(step->extrude)),
fr = pgm_read_float(&(step->feedRate));
const float es = pgm_read_float(&(step->extrude));
const feedRate_t fr_mm_m = pgm_read_float(&(step->feedRate));
DEBUG_ECHO_START();
DEBUG_ECHOLNPAIR("E step ", es, "/", fr);
DEBUG_ECHOLNPAIR("E step ", es, "/", fr_mm_m);
current_position[E_AXIS] += es;
planner.buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS],
current_position[E_AXIS], MMM_TO_MMS(fr), active_extruder);
line_to_current_position(MMM_TO_MMS(fr_mm_m));
planner.synchronize();
step++;