Skip to content

Commit cc1795d

Browse files
committed
removed a spark null check and replaced a switch with createConfig()
1 parent 413cbba commit cc1795d

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

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

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -145,12 +145,6 @@ public static SparkFlex createSparkFlex(int id, MotorConfig motorConfig, SparkBa
145145
} else {
146146
spark = MockSparkFlex.createMockSparkFlex(id, SparkLowLevel.MotorType.kBrushless);
147147
}
148-
if (spark!=null)
149-
spark.configure(
150-
config,
151-
SparkBase.ResetMode.kResetSafeParameters,
152-
SparkBase.PersistMode.kPersistParameters
153-
);
154148

155149
MotorErrors.reportSparkTemp(spark, motorConfig.temperatureLimitCelsius);
156150
MotorErrors.checkSparkErrors(spark);
@@ -159,15 +153,7 @@ public static SparkFlex createSparkFlex(int id, MotorConfig motorConfig, SparkBa
159153
}
160154

161155
public static SparkBaseConfig createConfig(MotorControllerType type) {
162-
SparkBaseConfig config = null;
163-
switch(type){
164-
case SPARK_MAX:
165-
config = new SparkMaxConfig();
166-
break;
167-
case SPARK_FLEX:
168-
config = new SparkFlexConfig();
169-
break;
170-
}
156+
SparkBaseConfig config = type.createConfig();
171157
return config;
172158
}
173159

0 commit comments

Comments
 (0)