Browse Source

Use logic in Z_SAFE_HOMING

Use logic in Z_SAFE_HOMING

From
```
if (home_all_axis || homeZ) {
  if (home_all_axis) {
  ...
  home z
  }
  else if (homeZ) { // Don't need to Home Z twice
  home z
  }
}

```
to
```
if (home_all_axis || homeZ) {
  if (home_all_axis) {
  ...
  }
  home z
}
```
AnHardt 9 years ago
parent
commit
0ea6247fc2
1 changed files with 20 additions and 26 deletions
  1. 20
    26
      Marlin/Marlin_main.cpp

+ 20
- 26
Marlin/Marlin_main.cpp View File

@@ -3015,36 +3015,30 @@ inline void gcode_G28() {
3015 3015
              */
3016 3016
             current_position[X_AXIS] = destination[X_AXIS];
3017 3017
             current_position[Y_AXIS] = destination[Y_AXIS];
3018
-
3019
-            // Home the Z axis
3020
-            HOMEAXIS(Z);
3021 3018
           }
3022 3019
 
3023
-          else if (homeZ) { // Don't need to Home Z twice
3020
+          // Let's see if X and Y are homed
3021
+          if (axis_unhomed_error(true, true, false)) return;
3024 3022
 
3025
-            // Let's see if X and Y are homed
3026
-            if (axis_unhomed_error(true, true, false)) return;
3023
+          /**
3024
+           * Make sure the Z probe is within the physical limits
3025
+           * NOTE: This doesn't necessarily ensure the Z probe is also
3026
+           * within the bed!
3027
+           */
3028
+          float cpx = current_position[X_AXIS], cpy = current_position[Y_AXIS];
3029
+          if (   cpx >= X_MIN_POS - (X_PROBE_OFFSET_FROM_EXTRUDER)
3030
+              && cpx <= X_MAX_POS - (X_PROBE_OFFSET_FROM_EXTRUDER)
3031
+              && cpy >= Y_MIN_POS - (Y_PROBE_OFFSET_FROM_EXTRUDER)
3032
+              && cpy <= Y_MAX_POS - (Y_PROBE_OFFSET_FROM_EXTRUDER)) {
3027 3033
 
3028
-            /**
3029
-             * Make sure the Z probe is within the physical limits
3030
-             * NOTE: This doesn't necessarily ensure the Z probe is also
3031
-             * within the bed!
3032
-             */
3033
-            float cpx = current_position[X_AXIS], cpy = current_position[Y_AXIS];
3034
-            if (   cpx >= X_MIN_POS - (X_PROBE_OFFSET_FROM_EXTRUDER)
3035
-                && cpx <= X_MAX_POS - (X_PROBE_OFFSET_FROM_EXTRUDER)
3036
-                && cpy >= Y_MIN_POS - (Y_PROBE_OFFSET_FROM_EXTRUDER)
3037
-                && cpy <= Y_MAX_POS - (Y_PROBE_OFFSET_FROM_EXTRUDER)) {
3038
-
3039
-              // Home the Z axis
3040
-              HOMEAXIS(Z);
3041
-            }
3042
-            else {
3043
-              LCD_MESSAGEPGM(MSG_ZPROBE_OUT);
3044
-              SERIAL_ECHO_START;
3045
-              SERIAL_ECHOLNPGM(MSG_ZPROBE_OUT);
3046
-            }
3047
-          } // !home_all_axes && homeZ
3034
+            // Home the Z axis
3035
+            HOMEAXIS(Z);
3036
+          }
3037
+          else {
3038
+            LCD_MESSAGEPGM(MSG_ZPROBE_OUT);
3039
+            SERIAL_ECHO_START;
3040
+            SERIAL_ECHOLNPGM(MSG_ZPROBE_OUT);
3041
+          }
3048 3042
 
3049 3043
           #if ENABLED(DEBUG_LEVELING_FEATURE)
3050 3044
             if (DEBUGGING(LEVELING)) {

Loading…
Cancel
Save