mirror of
https://github.com/BroncBotz3481/YAGSL
synced 2026-06-26 07:01:39 +00:00
Fixed NetworkAlerts
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
package swervelib.encoders;
|
||||
|
||||
import edu.wpi.first.wpilibj.DriverStation;
|
||||
import edu.wpi.first.wpilibj.DutyCycleEncoder;
|
||||
import swervelib.telemetry.Alert;
|
||||
|
||||
/**
|
||||
* DutyCycle encoders such as "US Digital MA3 with PWM Output, the CTRE Mag Encoder, the Rev Hex Encoder, and the AM Mag
|
||||
@@ -22,6 +22,10 @@ public class PWMDutyCycleEncoderSwerve extends SwerveAbsoluteEncoder
|
||||
* Inversion state.
|
||||
*/
|
||||
private boolean isInverted;
|
||||
/**
|
||||
* An {@link Alert} for if the encoder cannot report accurate velocities.
|
||||
*/
|
||||
private Alert inaccurateVelocities;
|
||||
|
||||
/**
|
||||
* Constructor for the PWM duty cycle encoder.
|
||||
@@ -31,6 +35,11 @@ public class PWMDutyCycleEncoderSwerve extends SwerveAbsoluteEncoder
|
||||
public PWMDutyCycleEncoderSwerve(int pin)
|
||||
{
|
||||
encoder = new DutyCycleEncoder(pin);
|
||||
inaccurateVelocities = new Alert(
|
||||
"Encoders",
|
||||
"The PWM Duty Cycle encoder may not report accurate velocities!",
|
||||
Alert.AlertType.WARNING_TRACE);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,7 +83,7 @@ public class PWMDutyCycleEncoderSwerve extends SwerveAbsoluteEncoder
|
||||
@Override
|
||||
public double getVelocity()
|
||||
{
|
||||
DriverStation.reportWarning("The PWM Duty Cycle encoder may not report accurate velocities!", true);
|
||||
inaccurateVelocities.set(true);
|
||||
return encoder.get();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user