🎨 Cosmetic changes for G28

This commit is contained in:
Scott Lahteine 2021-06-19 14:09:09 -05:00 committed by Scott Lahteine
parent cce585f6ca
commit f2f23e8097
2 changed files with 18 additions and 16 deletions

View File

@ -361,10 +361,10 @@ void test_tmc_connection(LOGICAL_AXIS_DECL(const bool, true));
extern millis_t sg_guard_period;
constexpr uint16_t default_sg_guard_duration = 400;
struct slow_homing_t {
struct motion_state_t {
xy_ulong_t acceleration;
#if ENABLED(HAS_CLASSIC_JERK)
xy_float_t jerk_xy;
xy_float_t jerk_state;
#endif
};
#endif

View File

@ -164,24 +164,24 @@
#if ENABLED(IMPROVE_HOMING_RELIABILITY)
slow_homing_t begin_slow_homing() {
slow_homing_t slow_homing{0};
slow_homing.acceleration.set(planner.settings.max_acceleration_mm_per_s2[X_AXIS],
motion_state_t begin_slow_homing() {
motion_state_t motion_state{0};
motion_state.acceleration.set(planner.settings.max_acceleration_mm_per_s2[X_AXIS],
planner.settings.max_acceleration_mm_per_s2[Y_AXIS]);
planner.settings.max_acceleration_mm_per_s2[X_AXIS] = 100;
planner.settings.max_acceleration_mm_per_s2[Y_AXIS] = 100;
#if HAS_CLASSIC_JERK
slow_homing.jerk_xy = planner.max_jerk;
motion_state.jerk_state = planner.max_jerk;
planner.max_jerk.set(0, 0);
#endif
planner.reset_acceleration_rates();
return slow_homing;
return motion_state;
}
void end_slow_homing(const slow_homing_t &slow_homing) {
planner.settings.max_acceleration_mm_per_s2[X_AXIS] = slow_homing.acceleration.x;
planner.settings.max_acceleration_mm_per_s2[Y_AXIS] = slow_homing.acceleration.y;
TERN_(HAS_CLASSIC_JERK, planner.max_jerk = slow_homing.jerk_xy);
void end_slow_homing(const motion_state_t &motion_state) {
planner.settings.max_acceleration_mm_per_s2[X_AXIS] = motion_state.acceleration.x;
planner.settings.max_acceleration_mm_per_s2[Y_AXIS] = motion_state.acceleration.y;
TERN_(HAS_CLASSIC_JERK, planner.max_jerk = motion_state.jerk_state);
planner.reset_acceleration_rates();
}
@ -289,7 +289,9 @@ void GcodeSuite::G28() {
#endif
#endif
TERN_(IMPROVE_HOMING_RELIABILITY, slow_homing_t slow_homing = begin_slow_homing());
#if ENABLED(IMPROVE_HOMING_RELIABILITY)
motion_state_t saved_motion_state = begin_slow_homing();
#endif
// Always home with tool 0 active
#if HAS_MULTI_HOTEND
@ -315,7 +317,7 @@ void GcodeSuite::G28() {
home_delta();
TERN_(IMPROVE_HOMING_RELIABILITY, end_slow_homing(slow_homing));
TERN_(IMPROVE_HOMING_RELIABILITY, end_slow_homing(saved_motion_state));
#elif ENABLED(AXEL_TPARA)
@ -401,7 +403,7 @@ void GcodeSuite::G28() {
if (DISABLED(HOME_Y_BEFORE_X) && doY)
homeaxis(Y_AXIS);
TERN_(IMPROVE_HOMING_RELIABILITY, end_slow_homing(slow_homing));
TERN_(IMPROVE_HOMING_RELIABILITY, end_slow_homing(saved_motion_state));
// Home Z last if homing towards the bed
#if HAS_Z_AXIS && DISABLED(HOME_Z_FIRST)
@ -440,7 +442,7 @@ void GcodeSuite::G28() {
if (idex_is_duplicating()) {
TERN_(IMPROVE_HOMING_RELIABILITY, slow_homing = begin_slow_homing());
TERN_(IMPROVE_HOMING_RELIABILITY, saved_motion_state = begin_slow_homing());
// Always home the 2nd (right) extruder first
active_extruder = 1;
@ -459,7 +461,7 @@ void GcodeSuite::G28() {
dual_x_carriage_mode = IDEX_saved_mode;
set_duplication_enabled(IDEX_saved_duplication_state);
TERN_(IMPROVE_HOMING_RELIABILITY, end_slow_homing(slow_homing));
TERN_(IMPROVE_HOMING_RELIABILITY, end_slow_homing(saved_motion_state));
}
#endif // DUAL_X_CARRIAGE