Minor cleanup of homeaxis, etc.

This commit is contained in:
Scott Lahteine 2016-08-30 01:40:29 -05:00
parent 6eaf4f4909
commit 0e4107da34

View File

@ -2049,8 +2049,8 @@ static void clean_up_after_endstop_or_probe_move() {
#endif #endif
#endif #endif
#define DEPLOY_PROBE() set_probe_deployed( true ) #define DEPLOY_PROBE() set_probe_deployed(true)
#define STOW_PROBE() set_probe_deployed( false ) #define STOW_PROBE() set_probe_deployed(false)
// returns false for ok and true for failure // returns false for ok and true for failure
static bool set_probe_deployed(bool deploy) { static bool set_probe_deployed(bool deploy) {
@ -2073,8 +2073,8 @@ static void clean_up_after_endstop_or_probe_move() {
if (axis_unhomed_error(true, true, true )) { stop(); return true; } if (axis_unhomed_error(true, true, true )) { stop(); return true; }
#endif #endif
float oldXpos = current_position[X_AXIS]; // save x position float oldXpos = current_position[X_AXIS],
float oldYpos = current_position[Y_AXIS]; // save y position oldYpos = current_position[Y_AXIS];
#ifdef _TRIGGERED_WHEN_STOWED_TEST #ifdef _TRIGGERED_WHEN_STOWED_TEST
@ -2430,10 +2430,10 @@ static void do_homing_move(AxisEnum axis, float where, float fr_mm_s = 0.0) {
#define HOMEAXIS(LETTER) homeaxis(LETTER##_AXIS) #define HOMEAXIS(LETTER) homeaxis(LETTER##_AXIS)
static void homeaxis(AxisEnum axis) { static void homeaxis(AxisEnum axis) {
#define HOMEAXIS_DO(LETTER) \ #define CAN_HOME(A) \
((LETTER##_MIN_PIN > -1 && LETTER##_HOME_DIR==-1) || (LETTER##_MAX_PIN > -1 && LETTER##_HOME_DIR==1)) (axis == A##_AXIS && ((A##_MIN_PIN > -1 && A##_HOME_DIR < 0) || (A##_MAX_PIN > -1 && A##_HOME_DIR > 0)))
if (!(axis == X_AXIS ? HOMEAXIS_DO(X) : axis == Y_AXIS ? HOMEAXIS_DO(Y) : axis == Z_AXIS ? HOMEAXIS_DO(Z) : false)) return; if (!CAN_HOME(X) && !CAN_HOME(Y) && !CAN_HOME(Z)) return;
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) { if (DEBUGGING(LEVELING)) {
@ -2532,7 +2532,7 @@ static void homeaxis(AxisEnum axis) {
#endif #endif
// Put away the Z probe // Put away the Z probe
#if HAS_BED_PROBE && Z_HOME_DIR < 0 && DISABLED(Z_MIN_PROBE_ENDSTOP) #if HOMING_Z_WITH_PROBE
if (axis == Z_AXIS) { if (axis == Z_AXIS) {
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) SERIAL_ECHOPGM("> "); if (DEBUGGING(LEVELING)) SERIAL_ECHOPGM("> ");
@ -3104,9 +3104,7 @@ inline void gcode_G28() {
#if ENABLED(Z_SAFE_HOMING) #if ENABLED(Z_SAFE_HOMING)
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) { if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> Z_SAFE_HOMING >>>");
SERIAL_ECHOLNPGM("> Z_SAFE_HOMING >>>");
}
#endif #endif
if (home_all_axis) { if (home_all_axis) {
@ -3127,10 +3125,7 @@ inline void gcode_G28() {
destination[Z_AXIS] = current_position[Z_AXIS]; // Z is already at the right height destination[Z_AXIS] = current_position[Z_AXIS]; // Z is already at the right height
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) { if (DEBUGGING(LEVELING)) DEBUG_POS("> Z_SAFE_HOMING > home_all_axis", destination);
DEBUG_POS("> Z_SAFE_HOMING > home_all_axis", current_position);
DEBUG_POS("> Z_SAFE_HOMING > home_all_axis", destination);
}
#endif #endif
// Move in the XY plane // Move in the XY plane