diff options
author | Peter Wu <peter@lekensteyn.nl> | 2015-06-10 17:14:44 +0200 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2015-06-10 17:14:44 +0200 |
commit | baa758df26075e61eaeb71d7e7c65cecef10133d (patch) | |
tree | f0ce714cd0e32afd9b2d3bb34c55d72319297e18 | |
parent | 1dc3417e28a5be46b84968b201c88711001c2076 (diff) | |
download | code-baa758df26075e61eaeb71d7e7c65cecef10133d.tar.gz |
Fix most of the compilation errors
-rw-r--r-- | Venus_Skeleton/Venus_Skeleton.ino | 19 | ||||
-rw-r--r-- | Venus_Skeleton/calibration_wall-e.h | 4 |
2 files changed, 6 insertions, 17 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; } diff --git a/Venus_Skeleton/calibration_wall-e.h b/Venus_Skeleton/calibration_wall-e.h index 524656c..7b404dc 100644 --- a/Venus_Skeleton/calibration_wall-e.h +++ b/Venus_Skeleton/calibration_wall-e.h @@ -23,6 +23,6 @@ // Turn calibration (ms per degree) #define CAL_MOVE_TURN 6.05 // Straight calibration ((1/ms) per cm) -#define CAL_MOVE_TURN 0.0154 +#define CAL_MOVE_STRAIGHT 0.0154 -#define CAL_TURRET_TO_CENTER_DIST 6
\ No newline at end of file +#define CAL_TURRET_TO_CENTER_DIST 6 |