Browse Source

♻️ reset_acceleration_rates => refresh_…

FB4S_WIFI
Scott Lahteine 3 years ago
parent
commit
57c137a60f
  1. 4
      Marlin/src/gcode/calibrate/G28.cpp
  2. 8
      Marlin/src/lcd/menu/menu_advanced.cpp
  3. 10
      Marlin/src/module/planner.cpp
  4. 2
      Marlin/src/module/planner.h
  5. 2
      Marlin/src/module/settings.cpp

4
Marlin/src/gcode/calibrate/G28.cpp

@ -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

8
Marlin/src/lcd/menu/menu_advanced.cpp

@ -483,7 +483,7 @@ 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(); })
NUM_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),
@ -491,14 +491,14 @@ void menu_backlash();
);
#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

10
Marlin/src/module/planner.cpp

@ -1557,7 +1557,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
@ -3267,7 +3267,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];
@ -3285,7 +3285,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
@ -3304,7 +3304,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.
*/
@ -3322,7 +3322,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();
}
/**

2
Marlin/src/module/planner.h

@ -514,7 +514,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'.

2
Marlin/src/module/settings.cpp

@ -592,7 +592,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.

Loading…
Cancel
Save