Browse Source

🎨 Cosmetic changes for G28

vanilla_fb_2.0.x
Scott Lahteine 3 years ago
committed by Scott Lahteine
parent
commit
f2f23e8097
  1. 4
      Marlin/src/feature/tmc_util.h
  2. 30
      Marlin/src/gcode/calibrate/G28.cpp

4
Marlin/src/feature/tmc_util.h

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

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

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

Loading…
Cancel
Save