diff options
Diffstat (limited to 'Venus_Skeleton/Venus_Skeleton.ino')
-rw-r--r-- | Venus_Skeleton/Venus_Skeleton.ino | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/Venus_Skeleton/Venus_Skeleton.ino b/Venus_Skeleton/Venus_Skeleton.ino index 16e9f53..2ea94d7 100644 --- a/Venus_Skeleton/Venus_Skeleton.ino +++ b/Venus_Skeleton/Venus_Skeleton.ino @@ -106,6 +106,7 @@ int counterSampleConfirm = 0; // prototypes void opMode(opmode_t opmode); void stopAllServos(); +int eliminateDirections(int directionArray[]); #if 0 // error helper @@ -455,22 +456,15 @@ bool moveTurnTo(int direction) { if(direction < NUM_DIRECTIONS){ DEBUG_PRINT(" left\n"); // turn left - int sign = -1; maneuver(-100,100); } if(direction >= NUM_DIRECTIONS){ DEBUG_PRINT(" right\n"); // Turn right - int sign = 1; maneuver(100,-100); } } else { - if(direction < NUM_DIRECTIONS){ - int sign = -1; - } - if(direction >= NUM_DIRECTIONS){ - int sign = 1; - } + int sign = direction < NUM_DIRECTIONS ? -1 : 1; int deg = ((int)((millis() - timerMovementStart) * CAL_MOVE_TURN * sign)) % 360; data.robot_curr_deg = (data.robot_curr_deg + deg + 360*3) % 360; } @@ -486,7 +480,7 @@ bool moveTurnTo(int direction) { void moveTurnToDeg(int degree) { if (degree == 0 || degree == NUM_DIRECTIONS) { - return true; + return; } // Make sure turret doesn't move @@ -519,12 +513,7 @@ void moveTurnToDeg(int degree) { maneuver(100,-100); } } else { - if(degree < 0){ - int sign = -1; - } - if(degree > 0){ - int sign = 1; - } + int sign = degree < 0 ? -1 : 1; int deg = ((int)((millis() - timerMovementStart) * CAL_MOVE_TURN * sign)) % 360; data.robot_curr_deg = (data.robot_curr_deg + deg + 360*3) % 360; } |