Browse Source

Always define MIN_Z_HEIGHT_FOR_HOMING even if 0

Always define MIN_Z_HEIGHT_FOR_HOMING even if 0
Always make a potential rise to `home_offset[Z_AXIS]` possible in G28.
Get rid of some very ugly constructs in MBL (ultralcd.cpp).
AnHardt 8 years ago
parent
commit
de3a169336
3 changed files with 20 additions and 13 deletions
  1. 15
    0
      Marlin/Conditionals.h
  2. 2
    2
      Marlin/Marlin_main.cpp
  3. 3
    11
      Marlin/ultralcd.cpp

+ 15
- 0
Marlin/Conditionals.h View File

@@ -842,5 +842,20 @@
842 842
       #define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2
843 843
     #endif
844 844
   #endif
845
+
846
+  /**
847
+   * MIN_Z_HEIGHT_FOR_HOMING / Z_RAISE_BETWEEN_PROBINGS
848
+   */
849
+   #ifndef MIN_Z_HEIGHT_FOR_HOMING
850
+     #ifndef Z_RAISE_BETWEEN_PROBINGS
851
+       #define MIN_Z_HEIGHT_FOR_HOMING 0
852
+     #else
853
+       #define MIN_Z_HEIGHT_FOR_HOMING Z_RAISE_BETWEEN_PROBINGS
854
+     #endif
855
+   #endif
856
+   #ifndef Z_RAISE_BETWEEN_PROBINGS
857
+     #define Z_RAISE_BETWEEN_PROBING MIN_Z_HEIGHT_FOR_HOMING
858
+   #endif
859
+
845 860
 #endif //CONFIGURATION_LCD
846 861
 #endif //CONDITIONALS_H

+ 2
- 2
Marlin/Marlin_main.cpp View File

@@ -2892,7 +2892,7 @@ inline void gcode_G28() {
2892 2892
         #endif
2893 2893
       }
2894 2894
 
2895
-    #elif defined(MIN_Z_HEIGHT_FOR_HOMING) && MIN_Z_HEIGHT_FOR_HOMING > 0
2895
+    #else
2896 2896
 
2897 2897
       if (home_all_axis || homeX || homeY) {
2898 2898
         // Raise Z before homing any other axes and z is not already high enough (never lower z)
@@ -2913,7 +2913,7 @@ inline void gcode_G28() {
2913 2913
         }
2914 2914
       }
2915 2915
 
2916
-    #endif // MIN_Z_HEIGHT_FOR_HOMING
2916
+    #endif
2917 2917
 
2918 2918
     #if ENABLED(QUICK_HOME)
2919 2919
 

+ 3
- 11
Marlin/ultralcd.cpp View File

@@ -978,17 +978,13 @@ static void lcd_status_screen() {
978 978
     // Note: During Manual Bed Leveling the homed Z position is MESH_HOME_SEARCH_Z
979 979
     // Z position will be restored with the final action, a G28
980 980
     inline void _mbl_goto_xy(float x, float y) {
981
-      current_position[Z_AXIS] = MESH_HOME_SEARCH_Z
982
-        #if MIN_Z_HEIGHT_FOR_HOMING > 0
983
-          + MIN_Z_HEIGHT_FOR_HOMING
984
-        #endif
985
-      ;
981
+      current_position[Z_AXIS] = MESH_HOME_SEARCH_Z + MIN_Z_HEIGHT_FOR_HOMING;
986 982
       line_to_current(Z_AXIS);
987 983
       current_position[X_AXIS] = x + home_offset[X_AXIS];
988 984
       current_position[Y_AXIS] = y + home_offset[Y_AXIS];
989 985
       line_to_current(manual_feedrate[X_AXIS] <= manual_feedrate[Y_AXIS] ? X_AXIS : Y_AXIS);
990 986
       #if MIN_Z_HEIGHT_FOR_HOMING > 0
991
-        current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
987
+        current_position[Z_AXIS] = MESH_HOME_SEARCH_Z; // How do condition and action match?
992 988
         line_to_current(Z_AXIS);
993 989
       #endif
994 990
       stepper.synchronize();
@@ -1038,11 +1034,7 @@ static void lcd_status_screen() {
1038 1034
           if (_lcd_level_bed_position == (MESH_NUM_X_POINTS) * (MESH_NUM_Y_POINTS)) {
1039 1035
             lcd_goto_screen(_lcd_level_bed_done, true);
1040 1036
 
1041
-            current_position[Z_AXIS] = MESH_HOME_SEARCH_Z
1042
-              #if MIN_Z_HEIGHT_FOR_HOMING > 0
1043
-                + MIN_Z_HEIGHT_FOR_HOMING
1044
-              #endif
1045
-            ;
1037
+            current_position[Z_AXIS] = MESH_HOME_SEARCH_Z + MIN_Z_HEIGHT_FOR_HOMING;
1046 1038
             line_to_current(Z_AXIS);
1047 1039
             stepper.synchronize();
1048 1040
 

Loading…
Cancel
Save