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
}
```
pull/1/head
AnHardt 9 years ago
parent
commit
0ea6247fc2
  1. 46
      Marlin/Marlin_main.cpp

46
Marlin/Marlin_main.cpp

@ -3015,36 +3015,30 @@ inline void gcode_G28() {
*/
current_position[X_AXIS] = destination[X_AXIS];
current_position[Y_AXIS] = destination[Y_AXIS];
// Home the Z axis
HOMEAXIS(Z);
}
else if (homeZ) { // Don't need to Home Z twice
// Let's see if X and Y are homed
if (axis_unhomed_error(true, true, false)) return;
// 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)) {
/**
* 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
// Home the Z axis
HOMEAXIS(Z);
}
else {
LCD_MESSAGEPGM(MSG_ZPROBE_OUT);
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM(MSG_ZPROBE_OUT);
}
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) {

Loading…
Cancel
Save