Skip to content

Commit cb053d7

Browse files
alexander-mcdowellbrettle
authored andcommitted
Solves issue-88 (#89)
1 parent fe6e04a commit cb053d7

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

Robot2019/src/main/java/frc/robot/RobotMap.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,10 @@ private static UsbCamera configureCamera(int port) {
153153
*
154154
* @param ec The error code to check
155155
*/
156-
private static void catchError(ErrorCode ec) {
157-
if (ec != ErrorCode.OK)
158-
System.out
159-
.println("Error configuring in RobotMap.java at line: " + new Throwable().getStackTrace()[1].getLineNumber());
156+
public static void catchError(ErrorCode ec) {
157+
if(ec != ErrorCode.OK) {
158+
System.out.println("Error configuring in RobotMap.java at line: " + new Throwable().getStackTrace()[1].getLineNumber());
159+
System.out.println(ec.toString());
160+
}
160161
}
161162
}

Robot2019/src/main/java/frc/robot/subsystems/Drivetrain.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import edu.wpi.first.wpilibj.Encoder;
2020
import edu.wpi.first.wpilibj.command.Subsystem;
2121
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
22+
import frc.robot.RobotMap;
2223

2324
public class Drivetrain extends Subsystem {
2425
public enum Side {
@@ -150,16 +151,10 @@ public double getMaxVoltage() {
150151

151152
public void setVoltageCompensation(double volts) {
152153
ErrorCode ecVoltSat = leftMaster.configVoltageCompSaturation(volts, 10);
153-
154-
if (!ecVoltSat.equals(ErrorCode.OK)) {
155-
throw new RuntimeException("Voltage Saturation Configuration could not be set");
156-
}
154+
RobotMap.catchError(ecVoltSat);
157155

158156
ecVoltSat = rightMaster.configVoltageCompSaturation(volts, 10);
159-
160-
if (!ecVoltSat.equals(ErrorCode.OK)) {
161-
throw new RuntimeException("Voltage Saturation Configuration could not be set");
162-
}
157+
RobotMap.catchError(ecVoltSat);
163158

164159
leftMaster.enableVoltageCompensation(true);
165160
rightMaster.enableVoltageCompensation(true);

0 commit comments

Comments
 (0)