Browse Source

Implement NO_MOTION_BEFORE_HOMING option

Scott Lahteine 7 years ago
parent
commit
90af1fe5ee

+ 2
- 0
Marlin/Configuration.h View File

@@ -760,6 +760,8 @@
760 760
 
761 761
 // @section homing
762 762
 
763
+//#define NO_MOTION_BEFORE_HOMING  // Inhibit movement until all axes have been homed
764
+
763 765
 //#define Z_HOMING_HEIGHT 4  // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ...
764 766
                              // Be sure you have this distance over your Z_MAX_POS in case.
765 767
 

+ 1
- 1
Marlin/src/gcode/bedlevel/G42.cpp View File

@@ -33,7 +33,7 @@
33 33
  * G42: Move X & Y axes to mesh coordinates (I & J)
34 34
  */
35 35
 void GcodeSuite::G42() {
36
-  if (IsRunning()) {
36
+  if (MOTION_CONDITIONS) {
37 37
     const bool hasI = parser.seenval('I');
38 38
     const int8_t ix = hasI ? parser.value_int() : 0;
39 39
     const bool hasJ = parser.seenval('J');

+ 1
- 1
Marlin/src/gcode/motion/G0_G1.cpp View File

@@ -41,7 +41,7 @@ void GcodeSuite::G0_G1(
41 41
     bool fast_move/*=false*/
42 42
   #endif
43 43
 ) {
44
-  if (IsRunning()) {
44
+  if (MOTION_CONDITIONS) {
45 45
     get_destination_from_command(); // For X Y Z E F
46 46
 
47 47
     #if ENABLED(FWRETRACT)

+ 1
- 1
Marlin/src/gcode/motion/G2_G3.cpp View File

@@ -211,7 +211,7 @@ void plan_arc(
211 211
  *    G3 X20 Y12 R14   ; CCW circle with r=14 ending at X20 Y12
212 212
  */
213 213
 void GcodeSuite::G2_G3(const bool clockwise) {
214
-  if (IsRunning()) {
214
+  if (MOTION_CONDITIONS) {
215 215
 
216 216
     #if ENABLED(SF_ARC_FIX)
217 217
       const bool relative_mode_backup = relative_mode;

+ 1
- 1
Marlin/src/gcode/motion/G5.cpp View File

@@ -50,7 +50,7 @@ void plan_cubic_move(const float offset[4]) {
50 50
  * G5: Cubic B-spline
51 51
  */
52 52
 void GcodeSuite::G5() {
53
-  if (IsRunning()) {
53
+  if (MOTION_CONDITIONS) {
54 54
 
55 55
     #if ENABLED(CNC_WORKSPACE_PLANES)
56 56
       if (workspace_plane != PLANE_XY) {

+ 10
- 10
Marlin/src/lcd/ultralcd.cpp View File

@@ -2928,19 +2928,19 @@ void kill_screen(const char* lcd_msg) {
2928 2928
    *
2929 2929
    */
2930 2930
 
2931
-  #if IS_KINEMATIC
2931
+  #if IS_KINEMATIC || ENABLED(NO_MOTION_BEFORE_HOMING)
2932 2932
     #define _MOVE_XYZ_ALLOWED (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS])
2933
-    #if ENABLED(DELTA)
2934
-      #define _MOVE_XY_ALLOWED (current_position[Z_AXIS] <= delta_clip_start_height)
2935
-      void lcd_lower_z_to_clip_height() {
2936
-        line_to_z(delta_clip_start_height);
2937
-        lcd_synchronize();
2938
-      }
2939
-    #else
2940
-      #define _MOVE_XY_ALLOWED true
2941
-    #endif
2942 2933
   #else
2943 2934
     #define _MOVE_XYZ_ALLOWED true
2935
+  #endif
2936
+
2937
+  #if ENABLED(DELTA)
2938
+    #define _MOVE_XY_ALLOWED (current_position[Z_AXIS] <= delta_clip_start_height)
2939
+    void lcd_lower_z_to_clip_height() {
2940
+      line_to_z(delta_clip_start_height);
2941
+      lcd_synchronize();
2942
+    }
2943
+  #else
2944 2944
     #define _MOVE_XY_ALLOWED true
2945 2945
   #endif
2946 2946
 

+ 3
- 3
Marlin/src/module/motion.cpp View File

@@ -51,7 +51,7 @@
51 51
   #include "../feature/bedlevel/bedlevel.h"
52 52
 #endif
53 53
 
54
-#if NEED_UNHOMED_ERR && ENABLED(ULTRA_LCD)
54
+#if HAS_AXIS_UNHOMED_ERR && ENABLED(ULTRA_LCD)
55 55
   #include "../lcd/ultralcd.h"
56 56
 #endif
57 57
 
@@ -820,7 +820,7 @@ void prepare_move_to_destination() {
820 820
   set_current_to_destination();
821 821
 }
822 822
 
823
-#if NEED_UNHOMED_ERR
823
+#if HAS_AXIS_UNHOMED_ERR
824 824
 
825 825
   bool axis_unhomed_error(const bool x/*=true*/, const bool y/*=true*/, const bool z/*=true*/) {
826 826
     #if ENABLED(HOME_AFTER_DEACTIVATE)
@@ -848,7 +848,7 @@ void prepare_move_to_destination() {
848 848
     return false;
849 849
   }
850 850
 
851
-#endif
851
+#endif // HAS_AXIS_UNHOMED_ERR
852 852
 
853 853
 /**
854 854
  * The homing feedrate may vary

+ 17
- 3
Marlin/src/module/motion.h View File

@@ -167,12 +167,26 @@ void clean_up_after_endstop_or_probe_move();
167 167
 // Homing
168 168
 //
169 169
 
170
-#define NEED_UNHOMED_ERR (HAS_PROBING_PROCEDURE || HOTENDS > 1 || ENABLED(Z_PROBE_ALLEN_KEY) || ENABLED(Z_PROBE_SLED) || ENABLED(NOZZLE_CLEAN_FEATURE) || ENABLED(NOZZLE_PARK_FEATURE) || ENABLED(DELTA_AUTO_CALIBRATION))
171
-
172
-#if NEED_UNHOMED_ERR
170
+#define HAS_AXIS_UNHOMED_ERR (                                                     \
171
+         ENABLED(Z_PROBE_ALLEN_KEY)                                                \
172
+      || ENABLED(Z_PROBE_SLED)                                                     \
173
+      || HAS_PROBING_PROCEDURE                                                     \
174
+      || HOTENDS > 1                                                               \
175
+      || ENABLED(NOZZLE_CLEAN_FEATURE)                                             \
176
+      || ENABLED(NOZZLE_PARK_FEATURE)                                              \
177
+      || (ENABLED(ADVANCED_PAUSE_FEATURE) && ENABLED(HOME_BEFORE_FILAMENT_CHANGE)) \
178
+    ) || ENABLED(NO_MOTION_BEFORE_HOMING)
179
+
180
+#if HAS_AXIS_UNHOMED_ERR
173 181
   bool axis_unhomed_error(const bool x=true, const bool y=true, const bool z=true);
174 182
 #endif
175 183
 
184
+#if ENABLED(NO_MOTION_BEFORE_HOMING)
185
+  #define MOTION_CONDITIONS (IsRunning() && !axis_unhomed_error())
186
+#else
187
+  #define MOTION_CONDITIONS IsRunning()
188
+#endif
189
+
176 190
 void set_axis_is_at_home(const AxisEnum axis);
177 191
 
178 192
 void homeaxis(const AxisEnum axis);

Loading…
Cancel
Save