From 8e5f83d9a921e04739ad20e468ec6b4c1ef345f7 Mon Sep 17 00:00:00 2001 From: EvanYap Date: Wed, 20 Jan 2016 20:46:48 -0800 Subject: [PATCH] Make style edits --- .../team3501/robot/commands/ShooterTest.java | 5 ++-- .../team3501/robot/subsystems/Shooter.java | 25 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/org/usfirst/frc/team3501/robot/commands/ShooterTest.java b/src/org/usfirst/frc/team3501/robot/commands/ShooterTest.java index b4b24234..a256bad4 100644 --- a/src/org/usfirst/frc/team3501/robot/commands/ShooterTest.java +++ b/src/org/usfirst/frc/team3501/robot/commands/ShooterTest.java @@ -16,6 +16,7 @@ public class ShooterTest extends Command { @Override protected void initialize() { + Robot.shooter.setSpeed(0.5); } @Override @@ -34,11 +35,11 @@ public class ShooterTest extends Command { } if (leftSidePressed == true) { - Robot.shooter.setDecrementSpeed(0.1); + Robot.shooter.decrementSpeed(0.1); } if (rightSidePressed == true) { - Robot.shooter.setIncrementSpeed(0.1); + Robot.shooter.incrementSpeed(0.1); } if (thumbPressed == true) { diff --git a/src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java b/src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java index 614fe059..c562b20a 100755 --- a/src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java +++ b/src/org/usfirst/frc/team3501/robot/subsystems/Shooter.java @@ -20,30 +20,29 @@ public class Shooter extends Subsystem { wheel.set(speed); } - public void setIncrementSpeed(double increment) { - double newSpeed = getCurrentSpeed() + increment; - - if (getCurrentSpeed() >= 1.0) { + public void incrementSpeed(double increment) { + if (getCurrentSpeed() >= 1.0) wheel.set(1.0); - } else if (getCurrentSpeed() <= -1.0) { + else if (getCurrentSpeed() <= -1.0) wheel.set(-1.0); + else { + double newSpeed = getCurrentSpeed() + increment; + wheel.set(newSpeed); } - - wheel.set(newSpeed); } // THIS DECREMENT METHOD TAKES ONLY POSITIVE VALUES SINCE IT ACCOUNTS FOR // SUBTRACTING THE CURRENT MOTOR SPEED! - public void setDecrementSpeed(double decrement) { - double newSpeed = getCurrentSpeed() - decrement; + public void decrementSpeed(double decrement) { - if (getCurrentSpeed() >= 1.0) { + if (getCurrentSpeed() >= 1.0) wheel.set(1.0); - } else if (getCurrentSpeed() <= -1.0) { + else if (getCurrentSpeed() <= -1.0) wheel.set(-1.0); + else { + double newSpeed = getCurrentSpeed() - decrement; + wheel.set(newSpeed); } - - wheel.set(newSpeed); } @Override -- 2.30.2