浏览代码

Cosmetic changes for G28

Scott Lahteine 4 年前
父节点
当前提交
5ce6d8aa1f
共有 2 个文件被更改,包括 18 次插入16 次删除
  1. 2
    2
      Marlin/src/feature/tmc_util.h
  2. 16
    14
      Marlin/src/gcode/calibrate/G28.cpp

+ 2
- 2
Marlin/src/feature/tmc_util.h 查看文件

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

+ 16
- 14
Marlin/src/gcode/calibrate/G28.cpp 查看文件

@@ -164,24 +164,24 @@
164 164
 
165 165
 #if ENABLED(IMPROVE_HOMING_RELIABILITY)
166 166
 
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],
170 170
                                  planner.settings.max_acceleration_mm_per_s2[Y_AXIS]);
171 171
     planner.settings.max_acceleration_mm_per_s2[X_AXIS] = 100;
172 172
     planner.settings.max_acceleration_mm_per_s2[Y_AXIS] = 100;
173 173
     #if HAS_CLASSIC_JERK
174
-      slow_homing.jerk_xy = planner.max_jerk;
174
+      motion_state.jerk_state = planner.max_jerk;
175 175
       planner.max_jerk.set(0, 0);
176 176
     #endif
177 177
     planner.reset_acceleration_rates();
178
-    return slow_homing;
178
+    return motion_state;
179 179
   }
180 180
 
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);
185 185
     planner.reset_acceleration_rates();
186 186
   }
187 187
 
@@ -289,7 +289,9 @@ void GcodeSuite::G28() {
289 289
     #endif
290 290
   #endif
291 291
 
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
293 295
 
294 296
   // Always home with tool 0 active
295 297
   #if HAS_MULTI_HOTEND
@@ -315,7 +317,7 @@ void GcodeSuite::G28() {
315 317
 
316 318
     home_delta();
317 319
 
318
-    TERN_(IMPROVE_HOMING_RELIABILITY, end_slow_homing(slow_homing));
320
+    TERN_(IMPROVE_HOMING_RELIABILITY, end_slow_homing(saved_motion_state));
319 321
 
320 322
   #elif ENABLED(AXEL_TPARA)
321 323
 
@@ -401,7 +403,7 @@ void GcodeSuite::G28() {
401 403
     if (DISABLED(HOME_Y_BEFORE_X) && doY)
402 404
       homeaxis(Y_AXIS);
403 405
 
404
-    TERN_(IMPROVE_HOMING_RELIABILITY, end_slow_homing(slow_homing));
406
+    TERN_(IMPROVE_HOMING_RELIABILITY, end_slow_homing(saved_motion_state));
405 407
 
406 408
     // Home Z last if homing towards the bed
407 409
     #if HAS_Z_AXIS && DISABLED(HOME_Z_FIRST)
@@ -440,7 +442,7 @@ void GcodeSuite::G28() {
440 442
 
441 443
     if (idex_is_duplicating()) {
442 444
 
443
-      TERN_(IMPROVE_HOMING_RELIABILITY, slow_homing = begin_slow_homing());
445
+      TERN_(IMPROVE_HOMING_RELIABILITY, saved_motion_state = begin_slow_homing());
444 446
 
445 447
       // Always home the 2nd (right) extruder first
446 448
       active_extruder = 1;
@@ -459,7 +461,7 @@ void GcodeSuite::G28() {
459 461
       dual_x_carriage_mode = IDEX_saved_mode;
460 462
       set_duplication_enabled(IDEX_saved_duplication_state);
461 463
 
462
-      TERN_(IMPROVE_HOMING_RELIABILITY, end_slow_homing(slow_homing));
464
+      TERN_(IMPROVE_HOMING_RELIABILITY, end_slow_homing(saved_motion_state));
463 465
     }
464 466
 
465 467
   #endif // DUAL_X_CARRIAGE

正在加载...
取消
保存