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 9 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
       #define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2
842
       #define LCD_FEEDBACK_FREQUENCY_DURATION_MS 2
843
     #endif
843
     #endif
844
   #endif
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
 #endif //CONFIGURATION_LCD
860
 #endif //CONFIGURATION_LCD
846
 #endif //CONDITIONALS_H
861
 #endif //CONDITIONALS_H

+ 2
- 2
Marlin/Marlin_main.cpp View File

2892
         #endif
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
       if (home_all_axis || homeX || homeY) {
2897
       if (home_all_axis || homeX || homeY) {
2898
         // Raise Z before homing any other axes and z is not already high enough (never lower z)
2898
         // Raise Z before homing any other axes and z is not already high enough (never lower z)
2913
         }
2913
         }
2914
       }
2914
       }
2915
 
2915
 
2916
-    #endif // MIN_Z_HEIGHT_FOR_HOMING
2916
+    #endif
2917
 
2917
 
2918
     #if ENABLED(QUICK_HOME)
2918
     #if ENABLED(QUICK_HOME)
2919
 
2919
 

+ 3
- 11
Marlin/ultralcd.cpp View File

978
     // Note: During Manual Bed Leveling the homed Z position is MESH_HOME_SEARCH_Z
978
     // Note: During Manual Bed Leveling the homed Z position is MESH_HOME_SEARCH_Z
979
     // Z position will be restored with the final action, a G28
979
     // Z position will be restored with the final action, a G28
980
     inline void _mbl_goto_xy(float x, float y) {
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
       line_to_current(Z_AXIS);
982
       line_to_current(Z_AXIS);
987
       current_position[X_AXIS] = x + home_offset[X_AXIS];
983
       current_position[X_AXIS] = x + home_offset[X_AXIS];
988
       current_position[Y_AXIS] = y + home_offset[Y_AXIS];
984
       current_position[Y_AXIS] = y + home_offset[Y_AXIS];
989
       line_to_current(manual_feedrate[X_AXIS] <= manual_feedrate[Y_AXIS] ? X_AXIS : Y_AXIS);
985
       line_to_current(manual_feedrate[X_AXIS] <= manual_feedrate[Y_AXIS] ? X_AXIS : Y_AXIS);
990
       #if MIN_Z_HEIGHT_FOR_HOMING > 0
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
         line_to_current(Z_AXIS);
988
         line_to_current(Z_AXIS);
993
       #endif
989
       #endif
994
       stepper.synchronize();
990
       stepper.synchronize();
1038
           if (_lcd_level_bed_position == (MESH_NUM_X_POINTS) * (MESH_NUM_Y_POINTS)) {
1034
           if (_lcd_level_bed_position == (MESH_NUM_X_POINTS) * (MESH_NUM_Y_POINTS)) {
1039
             lcd_goto_screen(_lcd_level_bed_done, true);
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
             line_to_current(Z_AXIS);
1038
             line_to_current(Z_AXIS);
1047
             stepper.synchronize();
1039
             stepper.synchronize();
1048
 
1040
 

Loading…
Cancel
Save