Browse Source

Implementing [FR] #7548

Added new configuration to inhibit XYZ movements when home is not done
GMagician 7 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
 
759
 
760
 // @section homing
760
 // @section homing
761
 
761
 
762
+//#define NO_MOTION_BEFORE_HOMING  // Inhibit movement until all axes have been homed
763
+
762
 //#define Z_HOMING_HEIGHT 4  // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ...
764
 //#define Z_HOMING_HEIGHT 4  // (in mm) Minimal z height before homing (G28) for Z clearance above the bed, clamps, ...
763
                              // Be sure you have this distance over your Z_MAX_POS in case.
765
                              // Be sure you have this distance over your Z_MAX_POS in case.
764
 
766
 

+ 9
- 1
Marlin/Marlin.h View File

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

+ 10
- 10
Marlin/ultralcd.cpp View File

2929
    *
2929
    *
2930
    */
2930
    */
2931
 
2931
 
2932
-  #if IS_KINEMATIC
2932
+  #if IS_KINEMATIC || ENABLED(NO_MOTION_BEFORE_HOMING)
2933
     #define _MOVE_XYZ_ALLOWED (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS])
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
   #else
2934
   #else
2944
     #define _MOVE_XYZ_ALLOWED true
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
     #define _MOVE_XY_ALLOWED true
2945
     #define _MOVE_XY_ALLOWED true
2946
   #endif
2946
   #endif
2947
 
2947
 

Loading…
Cancel
Save