♻️ reset_acceleration_rates => refresh_…

This commit is contained in:
Scott Lahteine 2022-06-26 22:30:05 -05:00
parent e170460855
commit b548e21b65
5 changed files with 13 additions and 13 deletions

View file

@ -169,7 +169,7 @@
motion_state.jerk_state = planner.max_jerk;
planner.max_jerk.set(0, 0 OPTARG(DELTA, 0));
#endif
planner.reset_acceleration_rates();
planner.refresh_acceleration_rates();
return motion_state;
}
@ -178,7 +178,7 @@
planner.settings.max_acceleration_mm_per_s2[Y_AXIS] = motion_state.acceleration.y;
TERN_(DELTA, planner.settings.max_acceleration_mm_per_s2[Z_AXIS] = motion_state.acceleration.z);
TERN_(HAS_CLASSIC_JERK, planner.max_jerk = motion_state.jerk_state);
planner.reset_acceleration_rates();
planner.refresh_acceleration_rates();
}
#endif // IMPROVE_HOMING_RELIABILITY

View file

@ -483,21 +483,21 @@ void menu_backlash();
// M204 T Travel Acceleration
EDIT_ITEM_FAST(float5_25, MSG_A_TRAVEL, &planner.settings.travel_acceleration, 25, max_accel);
#define EDIT_AMAX(Q,L) EDIT_ITEM_FAST_N(long5_25, _AXIS(Q), MSG_AMAX_N, &planner.settings.max_acceleration_mm_per_s2[_AXIS(Q)], L, max_accel_edit_scaled[_AXIS(Q)], []{ planner.reset_acceleration_rates(); })
#define EDIT_AMAX(Q,L) EDIT_ITEM_FAST_N(long5_25, _AXIS(Q), MSG_AMAX_N, &planner.settings.max_acceleration_mm_per_s2[_AXIS(Q)], L, max_accel_edit_scaled[_AXIS(Q)], []{ planner.refresh_acceleration_rates(); })
LINEAR_AXIS_CODE(
EDIT_AMAX(A, 100), EDIT_AMAX(B, 100), EDIT_AMAX(C, 10),
EDIT_AMAX(I, 10), EDIT_AMAX(J, 10), EDIT_AMAX(K, 10)
);
#if ENABLED(DISTINCT_E_FACTORS)
EDIT_ITEM_FAST(long5_25, MSG_AMAX_E, &planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(active_extruder)], 100, max_accel_edit_scaled.e, []{ planner.reset_acceleration_rates(); });
EDIT_ITEM_FAST(long5_25, MSG_AMAX_E, &planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(active_extruder)], 100, max_accel_edit_scaled.e, []{ planner.refresh_acceleration_rates(); });
LOOP_L_N(n, E_STEPPERS)
EDIT_ITEM_FAST_N(long5_25, n, MSG_AMAX_EN, &planner.settings.max_acceleration_mm_per_s2[E_AXIS_N(n)], 100, max_accel_edit_scaled.e, []{
if (MenuItemBase::itemIndex == active_extruder)
planner.reset_acceleration_rates();
planner.refresh_acceleration_rates();
});
#elif E_STEPPERS
EDIT_ITEM_FAST(long5_25, MSG_AMAX_E, &planner.settings.max_acceleration_mm_per_s2[E_AXIS], 100, max_accel_edit_scaled.e, []{ planner.reset_acceleration_rates(); });
EDIT_ITEM_FAST(long5_25, MSG_AMAX_E, &planner.settings.max_acceleration_mm_per_s2[E_AXIS], 100, max_accel_edit_scaled.e, []{ planner.refresh_acceleration_rates(); });
#endif
#ifdef XY_FREQUENCY_LIMIT

View file

@ -1551,7 +1551,7 @@ void Planner::check_axes_activity() {
TERN_(DELTA, settings.max_acceleration_mm_per_s2[Z_AXIS] = saved_motion_state.acceleration.z);
TERN_(HAS_CLASSIC_JERK, max_jerk = saved_motion_state.jerk_state);
}
reset_acceleration_rates();
refresh_acceleration_rates();
}
#endif
@ -3161,7 +3161,7 @@ void Planner::set_position_mm(const xyze_pos_t &xyze) {
* - acceleration_long_cutoff based on the largest max_acceleration_steps_per_s2 (M201)
* - max_e_jerk for all extruders based on junction_deviation_mm (M205 J)
*/
void Planner::reset_acceleration_rates() {
void Planner::refresh_acceleration_rates() {
uint32_t highest_rate = 1;
LOOP_DISTINCT_AXES(i) {
max_acceleration_steps_per_s2[i] = settings.max_acceleration_mm_per_s2[i] * settings.axis_steps_per_mm[i];
@ -3179,7 +3179,7 @@ void Planner::reset_acceleration_rates() {
void Planner::refresh_positioning() {
LOOP_DISTINCT_AXES(i) mm_per_step[i] = 1.0f / settings.axis_steps_per_mm[i];
set_position_mm(current_position);
reset_acceleration_rates();
refresh_acceleration_rates();
}
// Apply limits to a variable and give a warning if the value was out of range
@ -3198,7 +3198,7 @@ inline void limit_and_warn(float &val, const AxisEnum axis, PGM_P const setting_
/**
* For the specified 'axis' set the Maximum Acceleration to the given value (mm/s^2)
* The value may be limited with warning feedback, if configured.
* Calls reset_acceleration_rates to precalculate planner terms in steps.
* Calls refresh_acceleration_rates to precalculate planner terms in steps.
*
* This hard limit is applied as a block is being added to the planner queue.
*/
@ -3216,7 +3216,7 @@ void Planner::set_max_acceleration(const AxisEnum axis, float inMaxAccelMMS2) {
settings.max_acceleration_mm_per_s2[axis] = inMaxAccelMMS2;
// Update steps per s2 to agree with the units per s2 (since they are used in the planner)
reset_acceleration_rates();
refresh_acceleration_rates();
}
/**

View file

@ -515,7 +515,7 @@ class Planner {
*/
// Recalculate steps/s^2 accelerations based on mm/s^2 settings
static void reset_acceleration_rates();
static void refresh_acceleration_rates();
/**
* Recalculate 'position' and 'mm_per_step'.

View file

@ -584,7 +584,7 @@ void MarlinSettings::postprocess() {
xyze_pos_t oldpos = current_position;
// steps per s2 needs to be updated to agree with units per s2
planner.reset_acceleration_rates();
planner.refresh_acceleration_rates();
// Make sure delta kinematics are updated before refreshing the
// planner position so the stepper counts will be set correctly.