Browse Source

Implementing [FR] #7548

Added new configuration to inhibit XYZ movements when home is not done
GMagician 6 years ago
parent
commit
33d28c24bf
4 changed files with 39 additions and 13 deletions
  1. 2
    0
      Marlin/Configuration.h
  2. 9
    1
      Marlin/Marlin.h
  3. 18
    2
      Marlin/Marlin_main.cpp
  4. 10
    10
      Marlin/ultralcd.cpp

+ 2
- 0
Marlin/Configuration.h View File

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

+ 9
- 1
Marlin/Marlin.h View File

@@ -422,7 +422,15 @@ void do_blocking_move_to_x(const float &x, const float &fr_mm_s=0.0);
422 422
 void do_blocking_move_to_z(const float &z, const float &fr_mm_s=0.0);
423 423
 void do_blocking_move_to_xy(const float &x, const float &y, const float &fr_mm_s=0.0);
424 424
 
425
-#define HAS_AXIS_UNHOMED_ERR (ENABLED(Z_PROBE_ALLEN_KEY) || ENABLED(Z_PROBE_SLED) || HAS_PROBING_PROCEDURE || HOTENDS > 1 || ENABLED(NOZZLE_CLEAN_FEATURE) || ENABLED(NOZZLE_PARK_FEATURE) || (ENABLED(ADVANCED_PAUSE_FEATURE) && ENABLED(HOME_BEFORE_FILAMENT_CHANGE)))
425
+#define HAS_AXIS_UNHOMED_ERR (                                                     \
426
+         ENABLED(Z_PROBE_ALLEN_KEY)                                                \
427
+      || ENABLED(Z_PROBE_SLED)                                                     \
428
+      || HAS_PROBING_PROCEDURE                                                     \
429
+      || HOTENDS > 1                                                               \
430
+      || ENABLED(NOZZLE_CLEAN_FEATURE)                                             \
431
+      || ENABLED(NOZZLE_PARK_FEATURE)                                              \
432
+      || (ENABLED(ADVANCED_PAUSE_FEATURE) && ENABLED(HOME_BEFORE_FILAMENT_CHANGE)) \
433
+    ) || ENABLED(NO_MOTION_BEFORE_HOMING)
426 434
 
427 435
 #if HAS_AXIS_UNHOMED_ERR
428 436
   bool axis_unhomed_error(const bool x=true, const bool y=true, const bool z=true);

+ 18
- 2
Marlin/Marlin_main.cpp View File

@@ -1850,7 +1850,7 @@ static void clean_up_after_endstop_or_probe_move() {
1850 1850
     return false;
1851 1851
   }
1852 1852
 
1853
-#endif
1853
+#endif // HAS_AXIS_UNHOMED_ERR
1854 1854
 
1855 1855
 #if ENABLED(Z_PROBE_SLED)
1856 1856
 
@@ -2053,7 +2053,7 @@ static void clean_up_after_endstop_or_probe_move() {
2053 2053
     #endif
2054 2054
   }
2055 2055
 
2056
-#endif
2056
+#endif // Z_PROBE_ALLEN_KEY
2057 2057
 
2058 2058
 #if ENABLED(PROBING_FANS_OFF)
2059 2059
 
@@ -3383,6 +3383,10 @@ inline void gcode_G0_G1(
3383 3383
     bool fast_move=false
3384 3384
   #endif
3385 3385
 ) {
3386
+  #if ENABLED(NO_MOTION_BEFORE_HOMING)
3387
+    if (axis_unhomed_error()) return;
3388
+  #endif
3389
+
3386 3390
   if (IsRunning()) {
3387 3391
     gcode_get_destination(); // For X Y Z E F
3388 3392
 
@@ -3438,6 +3442,10 @@ inline void gcode_G0_G1(
3438 3442
 #if ENABLED(ARC_SUPPORT)
3439 3443
 
3440 3444
   inline void gcode_G2_G3(bool clockwise) {
3445
+    #if ENABLED(NO_MOTION_BEFORE_HOMING)
3446
+      if (axis_unhomed_error()) return;
3447
+    #endif
3448
+
3441 3449
     if (IsRunning()) {
3442 3450
 
3443 3451
       #if ENABLED(SF_ARC_FIX)
@@ -3535,6 +3543,10 @@ inline void gcode_G4() {
3535 3543
    * G5: Cubic B-spline
3536 3544
    */
3537 3545
   inline void gcode_G5() {
3546
+    #if ENABLED(NO_MOTION_BEFORE_HOMING)
3547
+      if (axis_unhomed_error()) return;
3548
+    #endif
3549
+
3538 3550
     if (IsRunning()) {
3539 3551
 
3540 3552
       #if ENABLED(CNC_WORKSPACE_PLANES)
@@ -5862,6 +5874,10 @@ void home_all_axes() { gcode_G28(true); }
5862 5874
    * G42: Move X & Y axes to mesh coordinates (I & J)
5863 5875
    */
5864 5876
   inline void gcode_G42() {
5877
+    #if ENABLED(NO_MOTION_BEFORE_HOMING)
5878
+      if (axis_unhomed_error()) return;
5879
+    #endif
5880
+
5865 5881
     if (IsRunning()) {
5866 5882
       const bool hasI = parser.seenval('I');
5867 5883
       const int8_t ix = hasI ? parser.value_int() : 0;

+ 10
- 10
Marlin/ultralcd.cpp View File

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

Loading…
Cancel
Save