chiark / gitweb /
Refresh of homeaxis-function
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 10 Aug 2012 16:52:55 +0000 (17:52 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Fri, 10 Aug 2012 16:52:55 +0000 (17:52 +0100)
Marlin/Marlin.pde

index 36118f89925afb1fb6837ae0f881bfd4fdb7155c..fdb1b9831c01f4c3efa3d78a05e8beb31353fb17 100644 (file)
@@ -579,15 +579,13 @@ static void axis_is_at_home(int axis) {
 }
 
 static void homeaxis(int axis) {
-#define HOMEAXIS_DO_BIT(LETTER) \
-  ((LETTER##_MIN_PIN > -1 && LETTER##_HOME_DIR==-1) || (LETTER##_MAX_PIN > -1 && LETTER##_HOME_DIR==1) ? 1 << LETTER##_AXIS : 0)
+#define HOMEAXIS_DO(LETTER) \
+  ((LETTER##_MIN_PIN > -1 && LETTER##_HOME_DIR==-1) || (LETTER##_MAX_PIN > -1 && LETTER##_HOME_DIR==1))
 
-  const unsigned char doaxis =
-    HOMEAXIS_DO_BIT(X) | 
-    HOMEAXIS_DO_BIT(Y) |
-    HOMEAXIS_DO_BIT(Z);
-
-  if (doaxis & (1<<axis)) {
+  if (axis==X_AXIS ? HOMEAXIS_DO(X) :
+      axis==Y_AXIS ? HOMEAXIS_DO(Y) :
+      axis==Z_AXIS ? HOMEAXIS_DO(Z) :
+      0) {
     current_position[axis] = 0;
     plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
     destination[axis] = 1.5 * max_length(axis) * home_dir(axis);