Browse Source

Merge pull request #1958 from thinkyhead/redo_1937

Fix homing of YZ with DUAL_X_CARRIAGE
Scott Lahteine 9 years ago
parent
commit
c2e11daf66
1 changed files with 11 additions and 16 deletions
  1. 11
    16
      Marlin/Marlin_main.cpp

+ 11
- 16
Marlin/Marlin_main.cpp View File

@@ -990,10 +990,10 @@ static void axis_is_at_home(int axis) {
990 990
   #endif
991 991
 
992 992
   #ifdef SCARA
993
-    float homeposition[3];
994 993
    
995
-    if (axis < 2) {
994
+    if (axis == X_AXIS || axis == Y_AXIS) {
996 995
 
996
+      float homeposition[3];
997 997
       for (int i = 0; i < 3; i++) homeposition[i] = base_home_pos(i);
998 998
 
999 999
       // SERIAL_ECHOPGM("homeposition[x]= "); SERIAL_ECHO(homeposition[0]);
@@ -1023,17 +1023,14 @@ static void axis_is_at_home(int axis) {
1023 1023
       // inverse kinematic transform.
1024 1024
       min_pos[axis] = base_min_pos(axis); // + (delta[axis] - base_home_pos(axis));
1025 1025
       max_pos[axis] = base_max_pos(axis); // + (delta[axis] - base_home_pos(axis));
1026
-    } 
1027
-    else {
1028
-      current_position[axis] = base_home_pos(axis) + home_offset[axis];
1029
-      min_pos[axis] = base_min_pos(axis) + home_offset[axis];
1030
-      max_pos[axis] = base_max_pos(axis) + home_offset[axis];
1031 1026
     }
1032
-  #else
1027
+    else
1028
+  #endif
1029
+  {
1033 1030
     current_position[axis] = base_home_pos(axis) + home_offset[axis];
1034 1031
     min_pos[axis] = base_min_pos(axis) + home_offset[axis];
1035 1032
     max_pos[axis] = base_max_pos(axis) + home_offset[axis];
1036
-  #endif
1033
+  }
1037 1034
 }
1038 1035
 
1039 1036
 /**
@@ -1501,13 +1498,11 @@ static void homeaxis(AxisEnum axis) {
1501 1498
 
1502 1499
   if (axis == X_AXIS ? HOMEAXIS_DO(X) : axis == Y_AXIS ? HOMEAXIS_DO(Y) : axis == Z_AXIS ? HOMEAXIS_DO(Z) : 0) {
1503 1500
 
1504
-    int axis_home_dir;
1505
-
1506
-    #ifdef DUAL_X_CARRIAGE
1507
-      if (axis == X_AXIS) axis_home_dir = x_home_dir(active_extruder);
1508
-    #else
1509
-      axis_home_dir = home_dir(axis);
1510
-    #endif
1501
+    int axis_home_dir =
1502
+      #ifdef DUAL_X_CARRIAGE
1503
+        (axis == X_AXIS) ? x_home_dir(active_extruder) :
1504
+      #endif
1505
+      home_dir(axis);
1511 1506
 
1512 1507
     // Set the axis position as setup for the move
1513 1508
     current_position[axis] = 0;

Loading…
Cancel
Save