Skip to content

Commit f2f23e8

Browse files
committed
🎨 Cosmetic changes for G28
1 parent cce585f commit f2f23e8

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

Marlin/src/feature/tmc_util.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,10 +361,10 @@ void test_tmc_connection(LOGICAL_AXIS_DECL(const bool, true));
361361
extern millis_t sg_guard_period;
362362
constexpr uint16_t default_sg_guard_duration = 400;
363363

364-
struct slow_homing_t {
364+
struct motion_state_t {
365365
xy_ulong_t acceleration;
366366
#if ENABLED(HAS_CLASSIC_JERK)
367-
xy_float_t jerk_xy;
367+
xy_float_t jerk_state;
368368
#endif
369369
};
370370
#endif

Marlin/src/gcode/calibrate/G28.cpp

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -164,24 +164,24 @@
164164

165165
#if ENABLED(IMPROVE_HOMING_RELIABILITY)
166166

167-
slow_homing_t begin_slow_homing() {
168-
slow_homing_t slow_homing{0};
169-
slow_homing.acceleration.set(planner.settings.max_acceleration_mm_per_s2[X_AXIS],
167+
motion_state_t begin_slow_homing() {
168+
motion_state_t motion_state{0};
169+
motion_state.acceleration.set(planner.settings.max_acceleration_mm_per_s2[X_AXIS],
170170
planner.settings.max_acceleration_mm_per_s2[Y_AXIS]);
171171
planner.settings.max_acceleration_mm_per_s2[X_AXIS] = 100;
172172
planner.settings.max_acceleration_mm_per_s2[Y_AXIS] = 100;
173173
#if HAS_CLASSIC_JERK
174-
slow_homing.jerk_xy = planner.max_jerk;
174+
motion_state.jerk_state = planner.max_jerk;
175175
planner.max_jerk.set(0, 0);
176176
#endif
177177
planner.reset_acceleration_rates();
178-
return slow_homing;
178+
return motion_state;
179179
}
180180

181-
void end_slow_homing(const slow_homing_t &slow_homing) {
182-
planner.settings.max_acceleration_mm_per_s2[X_AXIS] = slow_homing.acceleration.x;
183-
planner.settings.max_acceleration_mm_per_s2[Y_AXIS] = slow_homing.acceleration.y;
184-
TERN_(HAS_CLASSIC_JERK, planner.max_jerk = slow_homing.jerk_xy);
181+
void end_slow_homing(const motion_state_t &motion_state) {
182+
planner.settings.max_acceleration_mm_per_s2[X_AXIS] = motion_state.acceleration.x;
183+
planner.settings.max_acceleration_mm_per_s2[Y_AXIS] = motion_state.acceleration.y;
184+
TERN_(HAS_CLASSIC_JERK, planner.max_jerk = motion_state.jerk_state);
185185
planner.reset_acceleration_rates();
186186
}
187187

@@ -289,7 +289,9 @@ void GcodeSuite::G28() {
289289
#endif
290290
#endif
291291

292-
TERN_(IMPROVE_HOMING_RELIABILITY, slow_homing_t slow_homing = begin_slow_homing());
292+
#if ENABLED(IMPROVE_HOMING_RELIABILITY)
293+
motion_state_t saved_motion_state = begin_slow_homing();
294+
#endif
293295

294296
// Always home with tool 0 active
295297
#if HAS_MULTI_HOTEND
@@ -315,7 +317,7 @@ void GcodeSuite::G28() {
315317

316318
home_delta();
317319

318-
TERN_(IMPROVE_HOMING_RELIABILITY, end_slow_homing(slow_homing));
320+
TERN_(IMPROVE_HOMING_RELIABILITY, end_slow_homing(saved_motion_state));
319321

320322
#elif ENABLED(AXEL_TPARA)
321323

@@ -401,7 +403,7 @@ void GcodeSuite::G28() {
401403
if (DISABLED(HOME_Y_BEFORE_X) && doY)
402404
homeaxis(Y_AXIS);
403405

404-
TERN_(IMPROVE_HOMING_RELIABILITY, end_slow_homing(slow_homing));
406+
TERN_(IMPROVE_HOMING_RELIABILITY, end_slow_homing(saved_motion_state));
405407

406408
// Home Z last if homing towards the bed
407409
#if HAS_Z_AXIS && DISABLED(HOME_Z_FIRST)
@@ -440,7 +442,7 @@ void GcodeSuite::G28() {
440442

441443
if (idex_is_duplicating()) {
442444

443-
TERN_(IMPROVE_HOMING_RELIABILITY, slow_homing = begin_slow_homing());
445+
TERN_(IMPROVE_HOMING_RELIABILITY, saved_motion_state = begin_slow_homing());
444446

445447
// Always home the 2nd (right) extruder first
446448
active_extruder = 1;
@@ -459,7 +461,7 @@ void GcodeSuite::G28() {
459461
dual_x_carriage_mode = IDEX_saved_mode;
460462
set_duplication_enabled(IDEX_saved_duplication_state);
461463

462-
TERN_(IMPROVE_HOMING_RELIABILITY, end_slow_homing(slow_homing));
464+
TERN_(IMPROVE_HOMING_RELIABILITY, end_slow_homing(saved_motion_state));
463465
}
464466

465467
#endif // DUAL_X_CARRIAGE

0 commit comments

Comments
 (0)