diff --git a/Robot2019/src/main/java/frc/robot/RobotMap.java b/Robot2019/src/main/java/frc/robot/RobotMap.java index f514ad1..6dae3e4 100644 --- a/Robot2019/src/main/java/frc/robot/RobotMap.java +++ b/Robot2019/src/main/java/frc/robot/RobotMap.java @@ -153,9 +153,10 @@ private static UsbCamera configureCamera(int port) { * * @param ec The error code to check */ - private static void catchError(ErrorCode ec) { - if (ec != ErrorCode.OK) - System.out - .println("Error configuring in RobotMap.java at line: " + new Throwable().getStackTrace()[1].getLineNumber()); + public static void catchError(ErrorCode ec) { + if(ec != ErrorCode.OK) { + System.out.println("Error configuring in RobotMap.java at line: " + new Throwable().getStackTrace()[1].getLineNumber()); + System.out.println(ec.toString()); + } } } diff --git a/Robot2019/src/main/java/frc/robot/subsystems/Drivetrain.java b/Robot2019/src/main/java/frc/robot/subsystems/Drivetrain.java index 9c2090f..bde135d 100644 --- a/Robot2019/src/main/java/frc/robot/subsystems/Drivetrain.java +++ b/Robot2019/src/main/java/frc/robot/subsystems/Drivetrain.java @@ -19,6 +19,7 @@ import edu.wpi.first.wpilibj.Encoder; import edu.wpi.first.wpilibj.command.Subsystem; import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard; +import frc.robot.RobotMap; public class Drivetrain extends Subsystem { public enum Side { @@ -150,16 +151,10 @@ public double getMaxVoltage() { public void setVoltageCompensation(double volts) { ErrorCode ecVoltSat = leftMaster.configVoltageCompSaturation(volts, 10); - - if (!ecVoltSat.equals(ErrorCode.OK)) { - throw new RuntimeException("Voltage Saturation Configuration could not be set"); - } + RobotMap.catchError(ecVoltSat); ecVoltSat = rightMaster.configVoltageCompSaturation(volts, 10); - - if (!ecVoltSat.equals(ErrorCode.OK)) { - throw new RuntimeException("Voltage Saturation Configuration could not be set"); - } + RobotMap.catchError(ecVoltSat); leftMaster.enableVoltageCompensation(true); rightMaster.enableVoltageCompensation(true);