From fde17d572026fd82708c56d8ce8dd902c4eefc84 Mon Sep 17 00:00:00 2001 From: Gord Christmas Date: Fri, 28 Jun 2013 08:02:04 -0700 Subject: [PATCH] Fix for ugly code compilation errors in SERVO_ENDSTOP checks --- Marlin/Marlin_main.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index b552d20ae..0677c0b43 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -687,10 +687,12 @@ static void homeaxis(int axis) { 0) { // Engage Servo endstop if enabled - #ifdef SERVO_ENDSTOPS[axis] > -1 - servos[servo_endstops[axis]].write(servo_endstop_angles[axis * 2]); + #ifdef SERVO_ENDSTOPS + if (SERVO_ENDSTOPS[axis] > -1) { + servos[servo_endstops[axis]].write(servo_endstop_angles[axis * 2]); + } #endif - + 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); @@ -715,8 +717,10 @@ static void homeaxis(int axis) { endstops_hit_on_purpose(); // Retract Servo endstop if enabled - #ifdef SERVO_ENDSTOPS[axis] > -1 - servos[servo_endstops[axis]].write(servo_endstop_angles[axis * 2 + 1]); + #ifdef SERVO_ENDSTOPS + if (SERVO_ENDSTOPS[axis] > -1) { + servos[servo_endstops[axis]].write(servo_endstop_angles[axis * 2 + 1]); + } #endif } }