Browse Source

G28 O respects HOME_AFTER_DEACTIVATE

Addressing #11271
Scott Lahteine 5 years ago
parent
commit
427bc64ba1
2 changed files with 17 additions and 9 deletions
  1. 16
    8
      Marlin/src/gcode/calibrate/G28.cpp
  2. 1
    1
      Marlin/src/inc/SanityCheck.h

+ 16
- 8
Marlin/src/gcode/calibrate/G28.cpp View File

@@ -192,14 +192,22 @@ void GcodeSuite::G28(const bool always_home_all) {
192 192
     }
193 193
   #endif
194 194
 
195
-  if (all_axes_known() && parser.boolval('O')) { // home only if needed
196
-    #if ENABLED(DEBUG_LEVELING_FEATURE)
197
-      if (DEBUGGING(LEVELING)) {
198
-        SERIAL_ECHOLNPGM("> homing not needed, skip");
199
-        SERIAL_ECHOLNPGM("<<< G28");
200
-      }
201
-    #endif
202
-    return;
195
+  if (parser.boolval('O')) {
196
+    if (
197
+      #if ENABLED(HOME_AFTER_DEACTIVATE)
198
+        all_axes_known()  // homing needed anytime steppers deactivate
199
+      #else
200
+        all_axes_homed()  // homing needed only if never homed
201
+      #endif
202
+    ) {
203
+      #if ENABLED(DEBUG_LEVELING_FEATURE)
204
+        if (DEBUGGING(LEVELING)) {
205
+          SERIAL_ECHOLNPGM("> homing not needed, skip");
206
+          SERIAL_ECHOLNPGM("<<< G28");
207
+        }
208
+      #endif
209
+      return;
210
+    }
203 211
   }
204 212
 
205 213
   // Wait for planner moves to finish!

+ 1
- 1
Marlin/src/inc/SanityCheck.h View File

@@ -1157,7 +1157,7 @@ static_assert(X_MAX_LENGTH >= X_BED_SIZE && Y_MAX_LENGTH >= Y_BED_SIZE,
1157 1157
   #if ENABLED(HOME_AFTER_DEACTIVATE) || ENABLED(Z_SAFE_HOMING)
1158 1158
     #error "DISABLE_[XYZ] is not compatible with HOME_AFTER_DEACTIVATE or Z_SAFE_HOMING."
1159 1159
   #endif
1160
-#endif // DISABLE_[XYZ]
1160
+#endif
1161 1161
 
1162 1162
 /**
1163 1163
  * Filament Width Sensor

Loading…
Cancel
Save