mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-26 21:36:21 +00:00
♻️ reset_acceleration_rates => refresh_…
This commit is contained in:
parent
e170460855
commit
b548e21b65
@ -169,7 +169,7 @@
|
|||||||
motion_state.jerk_state = planner.max_jerk;
|
motion_state.jerk_state = planner.max_jerk;
|
||||||
planner.max_jerk.set(0, 0 OPTARG(DELTA, 0));
|
planner.max_jerk.set(0, 0 OPTARG(DELTA, 0));
|
||||||
#endif
|
#endif
|
||||||
planner.reset_acceleration_rates();
|
planner.refresh_acceleration_rates();
|
||||||
return motion_state;
|
return motion_state;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,7 +178,7 @@
|
|||||||
planner.settings.max_acceleration_mm_per_s2[Y_AXIS] = motion_state.acceleration.y;
|
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_(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);
|
TERN_(HAS_CLASSIC_JERK, planner.max_jerk = motion_state.jerk_state);
|
||||||
planner.reset_acceleration_rates();
|
planner.refresh_acceleration_rates();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // IMPROVE_HOMING_RELIABILITY
|
#endif // IMPROVE_HOMING_RELIABILITY
|
||||||
|
@ -483,21 +483,21 @@ void menu_backlash();
|
|||||||
// M204 T Travel Acceleration
|
// M204 T Travel Acceleration
|
||||||
EDIT_ITEM_FAST(float5_25, MSG_A_TRAVEL, &planner.settings.travel_acceleration, 25, max_accel);
|
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(
|
LINEAR_AXIS_CODE(
|
||||||
EDIT_AMAX(A, 100), EDIT_AMAX(B, 100), EDIT_AMAX(C, 10),
|
EDIT_AMAX(A, 100), EDIT_AMAX(B, 100), EDIT_AMAX(C, 10),
|
||||||
EDIT_AMAX(I, 10), EDIT_AMAX(J, 10), EDIT_AMAX(K, 10)
|
EDIT_AMAX(I, 10), EDIT_AMAX(J, 10), EDIT_AMAX(K, 10)
|
||||||
);
|
);
|
||||||
|
|
||||||
#if ENABLED(DISTINCT_E_FACTORS)
|
#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)
|
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, []{
|
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)
|
if (MenuItemBase::itemIndex == active_extruder)
|
||||||
planner.reset_acceleration_rates();
|
planner.refresh_acceleration_rates();
|
||||||
});
|
});
|
||||||
#elif E_STEPPERS
|
#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
|
#endif
|
||||||
|
|
||||||
#ifdef XY_FREQUENCY_LIMIT
|
#ifdef XY_FREQUENCY_LIMIT
|
||||||
|
@ -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_(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);
|
TERN_(HAS_CLASSIC_JERK, max_jerk = saved_motion_state.jerk_state);
|
||||||
}
|
}
|
||||||
reset_acceleration_rates();
|
refresh_acceleration_rates();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#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)
|
* - 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)
|
* - 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;
|
uint32_t highest_rate = 1;
|
||||||
LOOP_DISTINCT_AXES(i) {
|
LOOP_DISTINCT_AXES(i) {
|
||||||
max_acceleration_steps_per_s2[i] = settings.max_acceleration_mm_per_s2[i] * settings.axis_steps_per_mm[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() {
|
void Planner::refresh_positioning() {
|
||||||
LOOP_DISTINCT_AXES(i) mm_per_step[i] = 1.0f / settings.axis_steps_per_mm[i];
|
LOOP_DISTINCT_AXES(i) mm_per_step[i] = 1.0f / settings.axis_steps_per_mm[i];
|
||||||
set_position_mm(current_position);
|
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
|
// 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)
|
* 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.
|
* 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.
|
* 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;
|
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)
|
// Update steps per s2 to agree with the units per s2 (since they are used in the planner)
|
||||||
reset_acceleration_rates();
|
refresh_acceleration_rates();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -515,7 +515,7 @@ class Planner {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// Recalculate steps/s^2 accelerations based on mm/s^2 settings
|
// 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'.
|
* Recalculate 'position' and 'mm_per_step'.
|
||||||
|
@ -584,7 +584,7 @@ void MarlinSettings::postprocess() {
|
|||||||
xyze_pos_t oldpos = current_position;
|
xyze_pos_t oldpos = current_position;
|
||||||
|
|
||||||
// steps per s2 needs to be updated to agree with units per s2
|
// 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
|
// Make sure delta kinematics are updated before refreshing the
|
||||||
// planner position so the stepper counts will be set correctly.
|
// planner position so the stepper counts will be set correctly.
|
||||||
|
Loading…
Reference in New Issue
Block a user