mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-22 01:11:42 +00:00
[build] Upgrade to PMD 7.2.0 (#6718)
This commit is contained in:
@@ -840,7 +840,7 @@ public class ADIS16448_IMU implements AutoCloseable, Sendable {
|
||||
|
||||
if (calc_crc == imu_crc) {
|
||||
// Timestamp is at buffer[i]
|
||||
m_dt = ((double) buffer[i] - previous_timestamp) / 1000000.0;
|
||||
m_dt = (buffer[i] - previous_timestamp) / 1000000.0;
|
||||
|
||||
// Scale sensor data
|
||||
gyro_rate_x = (toShort(buffer[i + 5], buffer[i + 6]) * 0.04);
|
||||
|
||||
@@ -825,7 +825,7 @@ public class ADIS16470_IMU implements AutoCloseable, Sendable {
|
||||
// Could be multiple data sets in the buffer. Handle each one.
|
||||
for (int i = 0; i < data_to_read; i += dataset_len) {
|
||||
// Timestamp is at buffer[i]
|
||||
m_dt = ((double) buffer[i] - previous_timestamp) / 1000000.0;
|
||||
m_dt = (buffer[i] - previous_timestamp) / 1000000.0;
|
||||
|
||||
/*
|
||||
* System.out.println(((toInt(buffer[i + 3], buffer[i + 4], buffer[i + 5],
|
||||
|
||||
@@ -168,7 +168,7 @@ public class DigitalGlitchFilter implements Sendable, AutoCloseable {
|
||||
public long getPeriodNanoSeconds() {
|
||||
int fpgaCycles = getPeriodCycles();
|
||||
|
||||
return (long) fpgaCycles * 1000L / (long) (SensorUtil.kSystemClockTicksPerMicrosecond / 4);
|
||||
return fpgaCycles * 1000L / (SensorUtil.kSystemClockTicksPerMicrosecond / 4);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,7 +11,6 @@ import edu.wpi.first.hal.HAL;
|
||||
import edu.wpi.first.hal.MatchInfoData;
|
||||
import edu.wpi.first.networktables.BooleanPublisher;
|
||||
import edu.wpi.first.networktables.IntegerPublisher;
|
||||
import edu.wpi.first.networktables.NetworkTable;
|
||||
import edu.wpi.first.networktables.NetworkTableInstance;
|
||||
import edu.wpi.first.networktables.StringPublisher;
|
||||
import edu.wpi.first.util.EventVector;
|
||||
@@ -32,13 +31,13 @@ public final class DriverStation {
|
||||
/** Number of Joystick ports. */
|
||||
public static final int kJoystickPorts = 6;
|
||||
|
||||
private static class HALJoystickButtons {
|
||||
private static final class HALJoystickButtons {
|
||||
public int m_buttons;
|
||||
public byte m_count;
|
||||
}
|
||||
|
||||
private static class HALJoystickAxes {
|
||||
public float[] m_axes;
|
||||
public final float[] m_axes;
|
||||
public int m_count;
|
||||
|
||||
HALJoystickAxes(int count) {
|
||||
@@ -47,7 +46,7 @@ public final class DriverStation {
|
||||
}
|
||||
|
||||
private static class HALJoystickAxesRaw {
|
||||
public int[] m_axes;
|
||||
public final int[] m_axes;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
public int m_count;
|
||||
@@ -58,7 +57,7 @@ public final class DriverStation {
|
||||
}
|
||||
|
||||
private static class HALJoystickPOVs {
|
||||
public short[] m_povs;
|
||||
public final short[] m_povs;
|
||||
public int m_count;
|
||||
|
||||
HALJoystickPOVs(int count) {
|
||||
@@ -94,16 +93,14 @@ public final class DriverStation {
|
||||
|
||||
@SuppressWarnings("MemberName")
|
||||
private static class MatchDataSender {
|
||||
NetworkTable table;
|
||||
StringPublisher typeMetadata;
|
||||
StringPublisher gameSpecificMessage;
|
||||
StringPublisher eventName;
|
||||
IntegerPublisher matchNumber;
|
||||
IntegerPublisher replayNumber;
|
||||
IntegerPublisher matchType;
|
||||
BooleanPublisher alliance;
|
||||
IntegerPublisher station;
|
||||
IntegerPublisher controlWord;
|
||||
final StringPublisher gameSpecificMessage;
|
||||
final StringPublisher eventName;
|
||||
final IntegerPublisher matchNumber;
|
||||
final IntegerPublisher replayNumber;
|
||||
final IntegerPublisher matchType;
|
||||
final BooleanPublisher alliance;
|
||||
final IntegerPublisher station;
|
||||
final IntegerPublisher controlWord;
|
||||
boolean oldIsRedAlliance = true;
|
||||
int oldStationNumber = 1;
|
||||
String oldEventName = "";
|
||||
@@ -114,9 +111,8 @@ public final class DriverStation {
|
||||
int oldControlWord;
|
||||
|
||||
MatchDataSender() {
|
||||
table = NetworkTableInstance.getDefault().getTable("FMSInfo");
|
||||
typeMetadata = table.getStringTopic(".type").publish();
|
||||
typeMetadata.set("FMSInfo");
|
||||
var table = NetworkTableInstance.getDefault().getTable("FMSInfo");
|
||||
table.getStringTopic(".type").publish().set("FMSInfo");
|
||||
gameSpecificMessage = table.getStringTopic("GameSpecificMessage").publish();
|
||||
gameSpecificMessage.set("");
|
||||
eventName = table.getStringTopic("EventName").publish();
|
||||
|
||||
@@ -25,7 +25,7 @@ public class PneumaticHub implements PneumaticsBase {
|
||||
private int m_refCount;
|
||||
private int m_reservedMask;
|
||||
private boolean m_compressorReserved;
|
||||
public int[] m_oneShotDurMs = new int[PortsJNI.getNumREVPHChannels()];
|
||||
public final int[] m_oneShotDurMs = new int[PortsJNI.getNumREVPHChannels()];
|
||||
private final Object m_reserveLock = new Object();
|
||||
|
||||
DataStore(int module) {
|
||||
|
||||
@@ -54,8 +54,7 @@ public class SPI implements AutoCloseable {
|
||||
}
|
||||
}
|
||||
|
||||
private int m_port;
|
||||
private int m_mode;
|
||||
private final int m_port;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
@@ -67,8 +66,7 @@ public class SPI implements AutoCloseable {
|
||||
|
||||
SPIJNI.spiInitialize(m_port);
|
||||
|
||||
m_mode = 0;
|
||||
SPIJNI.spiSetMode(m_port, m_mode);
|
||||
SPIJNI.spiSetMode(m_port, 0);
|
||||
|
||||
HAL.report(tResourceType.kResourceType_SPI, port.value + 1);
|
||||
}
|
||||
@@ -115,8 +113,7 @@ public class SPI implements AutoCloseable {
|
||||
* @param mode The mode to set.
|
||||
*/
|
||||
public final void setMode(Mode mode) {
|
||||
m_mode = mode.value & 0x3;
|
||||
SPIJNI.spiSetMode(m_port, m_mode);
|
||||
SPIJNI.spiSetMode(m_port, mode.value & 0x3);
|
||||
}
|
||||
|
||||
/** Configure the chip select line to be active high. */
|
||||
|
||||
@@ -44,7 +44,9 @@ public class Ultrasonic implements Sendable, AutoCloseable {
|
||||
private static Thread m_task;
|
||||
private static int m_instances;
|
||||
|
||||
@SuppressWarnings("PMD.SingularField")
|
||||
private SimDevice m_simDevice;
|
||||
|
||||
private SimBoolean m_simRangeValid;
|
||||
private SimDouble m_simRange;
|
||||
|
||||
@@ -57,7 +59,7 @@ public class Ultrasonic implements Sendable, AutoCloseable {
|
||||
* certainly break. Make sure to disable automatic mode before changing anything with the
|
||||
* sensors!!
|
||||
*/
|
||||
private static class UltrasonicChecker extends Thread {
|
||||
private static final class UltrasonicChecker extends Thread {
|
||||
@Override
|
||||
public synchronized void run() {
|
||||
while (m_automaticEnabled) {
|
||||
|
||||
@@ -31,6 +31,7 @@ public final class EventLoop {
|
||||
}
|
||||
|
||||
/** Poll all bindings. */
|
||||
@SuppressWarnings("PMD.UnusedAssignment")
|
||||
public void poll() {
|
||||
try {
|
||||
m_running = true;
|
||||
|
||||
@@ -17,7 +17,7 @@ import edu.wpi.first.wpilibj.smartdashboard.SendableBuilderImpl;
|
||||
* The LiveWindow class is the public interface for putting sensors and actuators on the LiveWindow.
|
||||
*/
|
||||
public final class LiveWindow {
|
||||
private static class Component implements AutoCloseable {
|
||||
private static final class Component implements AutoCloseable {
|
||||
@Override
|
||||
public void close() {
|
||||
if (m_namePub != null) {
|
||||
|
||||
@@ -65,7 +65,7 @@ public class SendableBuilderImpl implements NTSendableBuilder {
|
||||
void accept(T value, long time);
|
||||
}
|
||||
|
||||
private static class Property<P extends Publisher, S extends Subscriber>
|
||||
private static final class Property<P extends Publisher, S extends Subscriber>
|
||||
implements AutoCloseable {
|
||||
@Override
|
||||
@SuppressWarnings("PMD.AvoidCatchingGenericException")
|
||||
|
||||
@@ -72,7 +72,7 @@ public class SysIdRoutineLog {
|
||||
}
|
||||
|
||||
/** Logs data from a single motor during a SysIdRoutine. */
|
||||
public class MotorLog {
|
||||
public final class MotorLog {
|
||||
private final String m_motorName;
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user