@@ -68,6 +68,17 @@ public class SparkMaxBrushedMotorSwerve extends SwerveMotor
68
68
public SparkMaxBrushedMotorSwerve (CANSparkMax motor , boolean isDriveMotor , Type encoderType , int countsPerRevolution ,
69
69
boolean useDataPortQuadEncoder )
70
70
{
71
+
72
+ noEncoderAlert = new Alert ("Motors" ,
73
+ "Cannot use motor without encoder." ,
74
+ Alert .AlertType .ERROR_TRACE );
75
+ failureConfiguringAlert = new Alert ("Motors" ,
76
+ "Failure configuring motor " + motor .getDeviceId (),
77
+ Alert .AlertType .WARNING_TRACE );
78
+ noEncoderDefinedAlert = new Alert ("Motors" ,
79
+ "An encoder MUST be defined to work with a SparkMAX" ,
80
+ Alert .AlertType .ERROR_TRACE );
81
+
71
82
// Drive motors **MUST** have an encoder attached.
72
83
if (isDriveMotor && encoderType == Type .kNoSensor )
73
84
{
@@ -103,15 +114,6 @@ public SparkMaxBrushedMotorSwerve(CANSparkMax motor, boolean isDriveMotor, Type
103
114
// Spin off configurations in a different thread.
104
115
// configureSparkMax(() -> motor.setCANTimeout(0)); // Commented it out because it prevents feedback.
105
116
106
- noEncoderAlert = new Alert ("Motors" ,
107
- "Cannot use motor without encoder." ,
108
- Alert .AlertType .ERROR_TRACE );
109
- failureConfiguringAlert = new Alert ("Motors" ,
110
- "Failure configuring motor " + motor .getDeviceId (),
111
- Alert .AlertType .WARNING_TRACE );
112
- noEncoderDefinedAlert = new Alert ("Motors" ,
113
- "An encoder MUST be defined to work with a SparkMAX" ,
114
- Alert .AlertType .ERROR_TRACE );
115
117
}
116
118
117
119
/**
0 commit comments