소스 검색

⚡️ Home Z (and maybe XY) at the start of G35 (#22060)

qwewer0 4 년 전
부모
커밋
6bdd0fcda1

+ 2
- 2
Marlin/src/gcode/bedlevel/G35.cpp 파일 보기

@@ -91,8 +91,8 @@ void GcodeSuite::G35() {
91 91
   // Disable duplication mode on homing
92 92
   TERN_(HAS_DUPLICATION_MODE, set_duplication_enabled(false));
93 93
 
94
-  // Home all before this procedure
95
-  home_all_axes();
94
+  // Home only Z axis when X and Y is trusted, otherwise all axes, if needed before this procedure
95
+  if (!all_axes_trusted()) process_subcommands_now_P(PSTR("G28Z"));
96 96
 
97 97
   bool err_break = false;
98 98
 

+ 1
- 1
Marlin/src/gcode/calibrate/G34.cpp 파일 보기

@@ -39,7 +39,7 @@
39 39
 void GcodeSuite::G34() {
40 40
 
41 41
   // Home before the alignment procedure
42
-  if (!all_axes_trusted()) home_all_axes();
42
+  home_if_needed();
43 43
 
44 44
   TERN_(HAS_LEVELING, TEMPORARY_BED_LEVELING_STATE(false));
45 45
 

+ 1
- 1
Marlin/src/gcode/calibrate/G34_M422.cpp 파일 보기

@@ -167,7 +167,7 @@ void GcodeSuite::G34() {
167 167
       ));
168 168
 
169 169
       // Home before the alignment procedure
170
-      if (!all_axes_trusted()) home_all_axes();
170
+      home_if_needed();
171 171
 
172 172
       // Move the Z coordinate realm towards the positive - dirty trick
173 173
       current_position.z += z_probe * 0.5f;

+ 1
- 1
Marlin/src/gcode/feature/pause/M600.cpp 파일 보기

@@ -99,7 +99,7 @@ void GcodeSuite::M600() {
99 99
 
100 100
   #if ENABLED(HOME_BEFORE_FILAMENT_CHANGE)
101 101
     // If needed, home before parking for filament change
102
-    if (!all_axes_trusted()) home_all_axes(true);
102
+    home_if_needed(true);
103 103
   #endif
104 104
 
105 105
   #if HAS_MULTI_EXTRUDER

+ 4
- 0
Marlin/src/module/motion.cpp 파일 보기

@@ -294,6 +294,10 @@ void report_current_position_projected() {
294 294
 
295 295
 #endif
296 296
 
297
+void home_if_needed(const bool keeplev/*=false*/) {
298
+  if (!all_axes_trusted()) gcode.home_all_axes(keeplev);
299
+}
300
+
297 301
 /**
298 302
  * Run out the planner buffer and re-sync the current
299 303
  * position from the last-updated stepper positions.

+ 27
- 25
Marlin/src/module/motion.h 파일 보기

@@ -392,33 +392,35 @@ void set_axis_is_at_home(const AxisEnum axis);
392 392
   void set_axis_never_homed(const AxisEnum axis);
393 393
   linear_axis_bits_t axes_should_home(linear_axis_bits_t axis_bits=linear_bits);
394 394
   bool homing_needed_error(linear_axis_bits_t axis_bits=linear_bits);
395
-  FORCE_INLINE void set_axis_unhomed(const AxisEnum axis)   { CBI(axis_homed, axis); }
396
-  FORCE_INLINE void set_axis_untrusted(const AxisEnum axis) { CBI(axis_trusted, axis); }
397
-  FORCE_INLINE void set_all_unhomed()                       { axis_homed = axis_trusted = 0; }
398
-  FORCE_INLINE void set_axis_homed(const AxisEnum axis)     { SBI(axis_homed, axis); }
399
-  FORCE_INLINE void set_axis_trusted(const AxisEnum axis)   { SBI(axis_trusted, axis); }
400
-  FORCE_INLINE void set_all_homed()                         { axis_homed = axis_trusted = linear_bits; }
395
+  inline void set_axis_unhomed(const AxisEnum axis)   { CBI(axis_homed, axis); }
396
+  inline void set_axis_untrusted(const AxisEnum axis) { CBI(axis_trusted, axis); }
397
+  inline void set_all_unhomed()                       { axis_homed = axis_trusted = 0; }
398
+  inline void set_axis_homed(const AxisEnum axis)     { SBI(axis_homed, axis); }
399
+  inline void set_axis_trusted(const AxisEnum axis)   { SBI(axis_trusted, axis); }
400
+  inline void set_all_homed()                         { axis_homed = axis_trusted = linear_bits; }
401 401
 #else
402 402
   constexpr linear_axis_bits_t axis_homed = linear_bits, axis_trusted = linear_bits; // Zero-endstop machines are always homed and trusted
403
-  FORCE_INLINE void homeaxis(const AxisEnum axis)           {}
404
-  FORCE_INLINE void set_axis_never_homed(const AxisEnum)    {}
405
-  FORCE_INLINE linear_axis_bits_t axes_should_home(linear_axis_bits_t=linear_bits) { return false; }
406
-  FORCE_INLINE bool homing_needed_error(linear_axis_bits_t=linear_bits) { return false; }
407
-  FORCE_INLINE void set_axis_unhomed(const AxisEnum axis)   {}
408
-  FORCE_INLINE void set_axis_untrusted(const AxisEnum axis) {}
409
-  FORCE_INLINE void set_all_unhomed()                       {}
410
-  FORCE_INLINE void set_axis_homed(const AxisEnum axis)     {}
411
-  FORCE_INLINE void set_axis_trusted(const AxisEnum axis)   {}
412
-  FORCE_INLINE void set_all_homed()                         {}
413
-#endif
414
-
415
-FORCE_INLINE bool axis_was_homed(const AxisEnum axis)       { return TEST(axis_homed, axis); }
416
-FORCE_INLINE bool axis_is_trusted(const AxisEnum axis)      { return TEST(axis_trusted, axis); }
417
-FORCE_INLINE bool axis_should_home(const AxisEnum axis)     { return (axes_should_home() & _BV(axis)) != 0; }
418
-FORCE_INLINE bool no_axes_homed()                           { return !axis_homed; }
419
-FORCE_INLINE bool all_axes_homed()                          { return linear_bits == (axis_homed & linear_bits); }
420
-FORCE_INLINE bool homing_needed()                           { return !all_axes_homed(); }
421
-FORCE_INLINE bool all_axes_trusted()                        { return linear_bits == (axis_trusted & linear_bits); }
403
+  inline void homeaxis(const AxisEnum axis)           {}
404
+  inline void set_axis_never_homed(const AxisEnum)    {}
405
+  inline linear_axis_bits_t axes_should_home(linear_axis_bits_t=linear_bits) { return false; }
406
+  inline bool homing_needed_error(linear_axis_bits_t=linear_bits) { return false; }
407
+  inline void set_axis_unhomed(const AxisEnum axis)   {}
408
+  inline void set_axis_untrusted(const AxisEnum axis) {}
409
+  inline void set_all_unhomed()                       {}
410
+  inline void set_axis_homed(const AxisEnum axis)     {}
411
+  inline void set_axis_trusted(const AxisEnum axis)   {}
412
+  inline void set_all_homed()                         {}
413
+#endif
414
+
415
+inline bool axis_was_homed(const AxisEnum axis)       { return TEST(axis_homed, axis); }
416
+inline bool axis_is_trusted(const AxisEnum axis)      { return TEST(axis_trusted, axis); }
417
+inline bool axis_should_home(const AxisEnum axis)     { return (axes_should_home() & _BV(axis)) != 0; }
418
+inline bool no_axes_homed()                           { return !axis_homed; }
419
+inline bool all_axes_homed()                          { return linear_bits == (axis_homed & linear_bits); }
420
+inline bool homing_needed()                           { return !all_axes_homed(); }
421
+inline bool all_axes_trusted()                        { return linear_bits == (axis_trusted & linear_bits); }
422
+
423
+void home_if_needed(const bool keeplev=false);
422 424
 
423 425
 #if ENABLED(NO_MOTION_BEFORE_HOMING)
424 426
   #define MOTION_CONDITIONS (IsRunning() && !homing_needed_error())

Loading…
취소
저장