Browse Source

Minor cleanup of homeaxis, etc.

Scott Lahteine 8 years ago
parent
commit
0e4107da34
1 changed files with 10 additions and 15 deletions
  1. 10
    15
      Marlin/Marlin_main.cpp

+ 10
- 15
Marlin/Marlin_main.cpp View File

@@ -2049,8 +2049,8 @@ static void clean_up_after_endstop_or_probe_move() {
2049 2049
     #endif
2050 2050
   #endif
2051 2051
 
2052
-  #define DEPLOY_PROBE() set_probe_deployed( true )
2053
-  #define STOW_PROBE() set_probe_deployed( false )
2052
+  #define DEPLOY_PROBE() set_probe_deployed(true)
2053
+  #define STOW_PROBE() set_probe_deployed(false)
2054 2054
 
2055 2055
   // returns false for ok and true for failure
2056 2056
   static bool set_probe_deployed(bool deploy) {
@@ -2073,8 +2073,8 @@ static void clean_up_after_endstop_or_probe_move() {
2073 2073
       if (axis_unhomed_error(true, true,  true )) { stop(); return true; }
2074 2074
     #endif
2075 2075
 
2076
-    float oldXpos = current_position[X_AXIS]; // save x position
2077
-    float oldYpos = current_position[Y_AXIS]; // save y position
2076
+    float oldXpos = current_position[X_AXIS],
2077
+          oldYpos = current_position[Y_AXIS];
2078 2078
 
2079 2079
     #ifdef _TRIGGERED_WHEN_STOWED_TEST
2080 2080
 
@@ -2430,10 +2430,10 @@ static void do_homing_move(AxisEnum axis, float where, float fr_mm_s = 0.0) {
2430 2430
 #define HOMEAXIS(LETTER) homeaxis(LETTER##_AXIS)
2431 2431
 
2432 2432
 static void homeaxis(AxisEnum axis) {
2433
-  #define HOMEAXIS_DO(LETTER) \
2434
-    ((LETTER##_MIN_PIN > -1 && LETTER##_HOME_DIR==-1) || (LETTER##_MAX_PIN > -1 && LETTER##_HOME_DIR==1))
2433
+  #define CAN_HOME(A) \
2434
+    (axis == A##_AXIS && ((A##_MIN_PIN > -1 && A##_HOME_DIR < 0) || (A##_MAX_PIN > -1 && A##_HOME_DIR > 0)))
2435 2435
 
2436
-  if (!(axis == X_AXIS ? HOMEAXIS_DO(X) : axis == Y_AXIS ? HOMEAXIS_DO(Y) : axis == Z_AXIS ? HOMEAXIS_DO(Z) : false)) return;
2436
+  if (!CAN_HOME(X) && !CAN_HOME(Y) && !CAN_HOME(Z)) return;
2437 2437
 
2438 2438
   #if ENABLED(DEBUG_LEVELING_FEATURE)
2439 2439
     if (DEBUGGING(LEVELING)) {
@@ -2532,7 +2532,7 @@ static void homeaxis(AxisEnum axis) {
2532 2532
   #endif
2533 2533
 
2534 2534
   // Put away the Z probe
2535
-  #if HAS_BED_PROBE && Z_HOME_DIR < 0 && DISABLED(Z_MIN_PROBE_ENDSTOP)
2535
+  #if HOMING_Z_WITH_PROBE
2536 2536
     if (axis == Z_AXIS) {
2537 2537
       #if ENABLED(DEBUG_LEVELING_FEATURE)
2538 2538
         if (DEBUGGING(LEVELING)) SERIAL_ECHOPGM("> ");
@@ -3104,9 +3104,7 @@ inline void gcode_G28() {
3104 3104
         #if ENABLED(Z_SAFE_HOMING)
3105 3105
 
3106 3106
           #if ENABLED(DEBUG_LEVELING_FEATURE)
3107
-            if (DEBUGGING(LEVELING)) {
3108
-              SERIAL_ECHOLNPGM("> Z_SAFE_HOMING >>>");
3109
-            }
3107
+            if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> Z_SAFE_HOMING >>>");
3110 3108
           #endif
3111 3109
 
3112 3110
           if (home_all_axis) {
@@ -3127,10 +3125,7 @@ inline void gcode_G28() {
3127 3125
             destination[Z_AXIS] = current_position[Z_AXIS]; // Z is already at the right height
3128 3126
 
3129 3127
             #if ENABLED(DEBUG_LEVELING_FEATURE)
3130
-              if (DEBUGGING(LEVELING)) {
3131
-                DEBUG_POS("> Z_SAFE_HOMING > home_all_axis", current_position);
3132
-                DEBUG_POS("> Z_SAFE_HOMING > home_all_axis", destination);
3133
-              }
3128
+              if (DEBUGGING(LEVELING)) DEBUG_POS("> Z_SAFE_HOMING > home_all_axis", destination);
3134 3129
             #endif
3135 3130
 
3136 3131
             // Move in the XY plane

Loading…
Cancel
Save