Add a feedRate_t data type (#15349)
This commit is contained in:
@@ -216,41 +216,32 @@ mesh_index_pair find_closest_circle_to_print(const float &X, const float &Y) {
|
||||
return return_val;
|
||||
}
|
||||
|
||||
void G26_line_to_destination(const float &feed_rate) {
|
||||
const float save_feedrate = feedrate_mm_s;
|
||||
feedrate_mm_s = feed_rate;
|
||||
prepare_move_to_destination(); // will ultimately call ubl.line_to_destination_cartesian or ubl.prepare_linear_move_to for UBL_SEGMENTED
|
||||
feedrate_mm_s = save_feedrate;
|
||||
}
|
||||
|
||||
void move_to(const float &rx, const float &ry, const float &z, const float &e_delta) {
|
||||
float feed_value;
|
||||
static float last_z = -999.99;
|
||||
|
||||
bool has_xy_component = (rx != current_position[X_AXIS] || ry != current_position[Y_AXIS]); // Check if X or Y is involved in the movement.
|
||||
|
||||
if (z != last_z) {
|
||||
last_z = z;
|
||||
feed_value = planner.settings.max_feedrate_mm_s[Z_AXIS]/(2.0); // Base the feed rate off of the configured Z_AXIS feed rate
|
||||
const feedRate_t feed_value = planner.settings.max_feedrate_mm_s[Z_AXIS] * 0.5f; // Use half of the Z_AXIS max feed rate
|
||||
|
||||
destination[X_AXIS] = current_position[X_AXIS];
|
||||
destination[Y_AXIS] = current_position[Y_AXIS];
|
||||
destination[Z_AXIS] = z; // We know the last_z!=z or we wouldn't be in this block of code.
|
||||
destination[E_AXIS] = current_position[E_AXIS];
|
||||
|
||||
G26_line_to_destination(feed_value);
|
||||
prepare_internal_move_to_destination(feed_value);
|
||||
set_destination_from_current();
|
||||
}
|
||||
|
||||
// Check if X or Y is involved in the movement.
|
||||
// Yes: a 'normal' movement. No: a retract() or recover()
|
||||
feed_value = has_xy_component ? G26_XY_FEEDRATE : planner.settings.max_feedrate_mm_s[E_AXIS] / 1.5;
|
||||
// If X or Y is involved do a 'normal' move. Otherwise retract/recover/hop.
|
||||
const feedRate_t feed_value = has_xy_component ? feedRate_t(G26_XY_FEEDRATE) : planner.settings.max_feedrate_mm_s[E_AXIS] * 0.666f;
|
||||
|
||||
destination[X_AXIS] = rx;
|
||||
destination[Y_AXIS] = ry;
|
||||
destination[E_AXIS] += e_delta;
|
||||
|
||||
G26_line_to_destination(feed_value);
|
||||
prepare_internal_move_to_destination(feed_value);
|
||||
set_destination_from_current();
|
||||
}
|
||||
|
||||
@@ -433,6 +424,7 @@ inline bool turn_on_heaters() {
|
||||
*/
|
||||
inline bool prime_nozzle() {
|
||||
|
||||
const feedRate_t fr_slow_e = planner.settings.max_feedrate_mm_s[E_AXIS] / 15.0f;
|
||||
#if HAS_LCD_MENU
|
||||
#if ENABLED(PREVENT_LENGTHY_EXTRUDE)
|
||||
float Total_Prime = 0.0;
|
||||
@@ -455,7 +447,7 @@ inline bool prime_nozzle() {
|
||||
Total_Prime += 0.25;
|
||||
if (Total_Prime >= EXTRUDE_MAXLENGTH) return G26_ERR;
|
||||
#endif
|
||||
G26_line_to_destination(planner.settings.max_feedrate_mm_s[E_AXIS] / 15.0);
|
||||
prepare_internal_move_to_destination(fr_slow_e);
|
||||
set_destination_from_current();
|
||||
planner.synchronize(); // Without this synchronize, the purge is more consistent,
|
||||
// but because the planner has a buffer, we won't be able
|
||||
@@ -478,7 +470,7 @@ inline bool prime_nozzle() {
|
||||
#endif
|
||||
set_destination_from_current();
|
||||
destination[E_AXIS] += g26_prime_length;
|
||||
G26_line_to_destination(planner.settings.max_feedrate_mm_s[E_AXIS] / 15.0);
|
||||
prepare_internal_move_to_destination(fr_slow_e);
|
||||
set_destination_from_current();
|
||||
retract_filament(destination);
|
||||
}
|
||||
@@ -781,12 +773,13 @@ void GcodeSuite::G26() {
|
||||
move_to(sx, sy, g26_layer_height, 0.0); // Get to the starting point with no extrusion / un-Z bump
|
||||
|
||||
recover_filament(destination);
|
||||
const float save_feedrate = feedrate_mm_s;
|
||||
feedrate_mm_s = PLANNER_XY_FEEDRATE() / 10.0;
|
||||
|
||||
const feedRate_t old_feedrate = feedrate_mm_s;
|
||||
feedrate_mm_s = PLANNER_XY_FEEDRATE() * 0.1f;
|
||||
plan_arc(endpoint, arc_offset, false); // Draw a counter-clockwise arc
|
||||
feedrate_mm_s = save_feedrate;
|
||||
feedrate_mm_s = old_feedrate;
|
||||
set_destination_from_current();
|
||||
|
||||
#if HAS_LCD_MENU
|
||||
if (user_canceled()) goto LEAVE; // Check if the user wants to stop the Mesh Validation
|
||||
#endif
|
||||
|
@@ -45,8 +45,10 @@ void GcodeSuite::G42() {
|
||||
}
|
||||
|
||||
set_destination_from_current();
|
||||
|
||||
if (hasI) destination[X_AXIS] = _GET_MESH_X(ix);
|
||||
if (hasJ) destination[Y_AXIS] = _GET_MESH_Y(iy);
|
||||
|
||||
#if HAS_BED_PROBE
|
||||
if (parser.boolval('P')) {
|
||||
if (hasI) destination[X_AXIS] -= probe_offset[X_AXIS];
|
||||
@@ -54,14 +56,14 @@ void GcodeSuite::G42() {
|
||||
}
|
||||
#endif
|
||||
|
||||
const float fval = parser.linearval('F');
|
||||
if (fval > 0.0) feedrate_mm_s = MMM_TO_MMS(fval);
|
||||
const feedRate_t fval = parser.linearval('F'),
|
||||
fr_mm_s = fval > 0 ? MMM_TO_MMS(fval) : 0.0f;
|
||||
|
||||
// SCARA kinematic has "safe" XY raw moves
|
||||
#if IS_SCARA
|
||||
prepare_uninterpolated_move_to_destination();
|
||||
prepare_internal_fast_move_to_destination(fr_mm_s);
|
||||
#else
|
||||
prepare_move_to_destination();
|
||||
prepare_internal_move_to_destination(fr_mm_s);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@@ -143,8 +143,7 @@ void GcodeSuite::G29() {
|
||||
|
||||
#if ENABLED(MESH_G28_REST_ORIGIN)
|
||||
current_position[Z_AXIS] = 0;
|
||||
set_destination_from_current();
|
||||
buffer_line_to_destination(homing_feedrate(Z_AXIS));
|
||||
line_to_current_position(homing_feedrate(Z_AXIS));
|
||||
planner.synchronize();
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user