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
}
```
This commit is contained in:
AnHardt 2016-07-08 14:43:01 +02:00
parent de3a169336
commit 0ea6247fc2

View File

@ -3015,36 +3015,30 @@ inline void gcode_G28() {
*/ */
current_position[X_AXIS] = destination[X_AXIS]; current_position[X_AXIS] = destination[X_AXIS];
current_position[Y_AXIS] = destination[Y_AXIS]; current_position[Y_AXIS] = destination[Y_AXIS];
}
// Let's see if X and Y are homed
if (axis_unhomed_error(true, true, false)) return;
/**
* Make sure the Z probe is within the physical limits
* NOTE: This doesn't necessarily ensure the Z probe is also
* within the bed!
*/
float cpx = current_position[X_AXIS], cpy = current_position[Y_AXIS];
if ( cpx >= X_MIN_POS - (X_PROBE_OFFSET_FROM_EXTRUDER)
&& cpx <= X_MAX_POS - (X_PROBE_OFFSET_FROM_EXTRUDER)
&& cpy >= Y_MIN_POS - (Y_PROBE_OFFSET_FROM_EXTRUDER)
&& cpy <= Y_MAX_POS - (Y_PROBE_OFFSET_FROM_EXTRUDER)) {
// Home the Z axis // Home the Z axis
HOMEAXIS(Z); HOMEAXIS(Z);
} }
else {
else if (homeZ) { // Don't need to Home Z twice LCD_MESSAGEPGM(MSG_ZPROBE_OUT);
SERIAL_ECHO_START;
// Let's see if X and Y are homed SERIAL_ECHOLNPGM(MSG_ZPROBE_OUT);
if (axis_unhomed_error(true, true, false)) return; }
/**
* Make sure the Z probe is within the physical limits
* NOTE: This doesn't necessarily ensure the Z probe is also
* within the bed!
*/
float cpx = current_position[X_AXIS], cpy = current_position[Y_AXIS];
if ( cpx >= X_MIN_POS - (X_PROBE_OFFSET_FROM_EXTRUDER)
&& cpx <= X_MAX_POS - (X_PROBE_OFFSET_FROM_EXTRUDER)
&& cpy >= Y_MIN_POS - (Y_PROBE_OFFSET_FROM_EXTRUDER)
&& cpy <= Y_MAX_POS - (Y_PROBE_OFFSET_FROM_EXTRUDER)) {
// Home the Z axis
HOMEAXIS(Z);
}
else {
LCD_MESSAGEPGM(MSG_ZPROBE_OUT);
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM(MSG_ZPROBE_OUT);
}
} // !home_all_axes && homeZ
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) { if (DEBUGGING(LEVELING)) {