Explorar el Código

Shorthand for home-after-deactivate

Scott Lahteine hace 6 años
padre
commit
49627069a5
Se han modificado 2 ficheros con 13 adiciones y 11 borrados
  1. 3
    11
      Marlin/src/gcode/calibrate/G28.cpp
  2. 10
    0
      Marlin/src/module/motion.h

+ 3
- 11
Marlin/src/gcode/calibrate/G28.cpp Ver fichero

200
     }
200
     }
201
   #endif
201
   #endif
202
 
202
 
203
-  if (parser.boolval('O')) {
204
-    if (
205
-      #if ENABLED(HOME_AFTER_DEACTIVATE)
206
-        all_axes_known()  // homing needed anytime steppers deactivate
207
-      #else
208
-        all_axes_homed()  // homing needed only if never homed
209
-      #endif
210
-    ) {
211
-      if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("> homing not needed, skip\n<<< G28");
212
-      return;
213
-    }
203
+  if (!homing_needed() && parser.boolval('O')) {
204
+    if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("> homing not needed, skip\n<<< G28");
205
+    return;
214
   }
206
   }
215
 
207
 
216
   // Wait for planner moves to finish!
208
   // Wait for planner moves to finish!

+ 10
- 0
Marlin/src/module/motion.h Ver fichero

42
 FORCE_INLINE void set_all_unhomed() { axis_homed = 0; }
42
 FORCE_INLINE void set_all_unhomed() { axis_homed = 0; }
43
 FORCE_INLINE void set_all_unknown() { axis_known_position = 0; }
43
 FORCE_INLINE void set_all_unknown() { axis_known_position = 0; }
44
 
44
 
45
+FORCE_INLINE bool homing_needed() {
46
+  return !(
47
+    #if ENABLED(HOME_AFTER_DEACTIVATE)
48
+      all_axes_known()
49
+    #else
50
+      all_axes_homed()
51
+    #endif
52
+  );
53
+}
54
+
45
 // Error margin to work around float imprecision
55
 // Error margin to work around float imprecision
46
 constexpr float slop = 0.0001;
56
 constexpr float slop = 0.0001;
47
 
57
 

Loading…
Cancelar
Guardar