Skip to content

Commit 354d6b2

Browse files
committed
simplify logic
1 parent 325297b commit 354d6b2

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/main/java/org/carlmontrobotics/lib199/MotorErrors.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,12 +120,12 @@ public static void doReportSparkMaxTemp() {
120120
int numTrips = overheatedSparks.get(port);
121121
SmartDashboard.putNumber("Port " + port + " Spark Max Temp", temp);
122122

123-
if(temp > limit) {
124-
if(numTrips < kOverheatTripCount) {
123+
if(numTrips < kOverheatTripCount) {
124+
if(temp > limit) {
125125
overheatedSparks.put(port, ++numTrips);
126+
} else {
127+
overheatedSparks.put(port, 0);
126128
}
127-
} else if(numTrips < kOverheatTripCount) {
128-
overheatedSparks.put(port, 0);
129129
}
130130

131131
// Check if temperature exceeds the setpoint or if the contoller has already overheated to prevent other code from resetting the current limit after the controller has cooled

0 commit comments

Comments
 (0)