mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
[wpilibj] Fix warnings that are not unused variables or deprecation (#3161)
Fix all warnings given by intellisense that are not unused variables or deprecation.
This commit is contained in:
@@ -9,7 +9,6 @@ import edu.wpi.first.hal.HAL;
|
||||
import edu.wpi.first.hal.SimBoolean;
|
||||
import edu.wpi.first.hal.SimDevice;
|
||||
import edu.wpi.first.hal.SimDouble;
|
||||
import edu.wpi.first.wpilibj.interfaces.Gyro;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SendableRegistry;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
@@ -25,7 +24,7 @@ import java.nio.ByteOrder;
|
||||
* an ADXRS Gyro is supported.
|
||||
*/
|
||||
@SuppressWarnings({"TypeName", "AbbreviationAsWordInName", "PMD.UnusedPrivateField"})
|
||||
public class ADXRS450_Gyro extends GyroBase implements Gyro, PIDSource, Sendable, AutoCloseable {
|
||||
public class ADXRS450_Gyro extends GyroBase {
|
||||
private static final double kSamplePeriod = 0.0005;
|
||||
private static final double kCalibrationSampleTime = 5.0;
|
||||
private static final double kDegreePerSecondPerLSB = 0.0125;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
package edu.wpi.first.wpilibj;
|
||||
|
||||
import edu.wpi.first.hal.SimDevice;
|
||||
import edu.wpi.first.hal.SimDevice.Direction;
|
||||
import edu.wpi.first.hal.SimDouble;
|
||||
import edu.wpi.first.wpilibj.AnalogTriggerOutput.AnalogTriggerType;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
|
||||
@@ -39,7 +40,7 @@ public class AnalogEncoder implements Sendable, AutoCloseable {
|
||||
m_simDevice = SimDevice.create("AnalogEncoder", m_analogInput.getChannel());
|
||||
|
||||
if (m_simDevice != null) {
|
||||
m_simPosition = m_simDevice.createDouble("Position", false, 0.0);
|
||||
m_simPosition = m_simDevice.createDouble("Position", Direction.kInput, 0.0);
|
||||
}
|
||||
|
||||
// Limits need to be 25% from each end
|
||||
|
||||
@@ -9,7 +9,6 @@ import static edu.wpi.first.wpilibj.util.ErrorMessages.requireNonNullParam;
|
||||
import edu.wpi.first.hal.AnalogGyroJNI;
|
||||
import edu.wpi.first.hal.FRCNetComm.tResourceType;
|
||||
import edu.wpi.first.hal.HAL;
|
||||
import edu.wpi.first.wpilibj.interfaces.Gyro;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SendableRegistry;
|
||||
|
||||
/**
|
||||
@@ -21,7 +20,7 @@ import edu.wpi.first.wpilibj.smartdashboard.SendableRegistry;
|
||||
*
|
||||
* <p>This class is for gyro sensors that connect to an analog input.
|
||||
*/
|
||||
public class AnalogGyro extends GyroBase implements Gyro, PIDSource, Sendable, AutoCloseable {
|
||||
public class AnalogGyro extends GyroBase {
|
||||
private static final double kDefaultVoltsPerDegreePerSecond = 0.007;
|
||||
protected AnalogInput m_analog;
|
||||
private boolean m_channelAllocated;
|
||||
|
||||
@@ -17,7 +17,7 @@ import edu.wpi.first.wpilibj.smartdashboard.SendableRegistry;
|
||||
* elsewhere will automatically allocate digital inputs and outputs as required. This class is only
|
||||
* for devices like switches etc. that aren't implemented anywhere else.
|
||||
*/
|
||||
public class DigitalInput extends DigitalSource implements Sendable, AutoCloseable {
|
||||
public class DigitalInput extends DigitalSource implements Sendable {
|
||||
private final int m_channel;
|
||||
private int m_handle;
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ import edu.wpi.first.wpilibj.smartdashboard.SendableRegistry;
|
||||
* Class to write digital outputs. This class will write digital outputs. Other devices that are
|
||||
* implemented elsewhere will automatically allocate digital inputs and outputs as required.
|
||||
*/
|
||||
public class DigitalOutput extends DigitalSource implements Sendable, AutoCloseable {
|
||||
public class DigitalOutput extends DigitalSource implements Sendable {
|
||||
private static final int invalidPwmGenerator = 0;
|
||||
private int m_pwmGenerator = invalidPwmGenerator;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
|
||||
* @deprecated Use {@link edu.wpi.first.wpilibj.controller.PIDController} instead.
|
||||
*/
|
||||
@Deprecated(since = "2020", forRemoval = true)
|
||||
public class PIDController extends PIDBase implements Controller, AutoCloseable {
|
||||
public class PIDController extends PIDBase implements Controller {
|
||||
Notifier m_controlLoop = new Notifier(this::calculate);
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
package edu.wpi.first.wpilibj;
|
||||
|
||||
/** Interface for speed controlling devices. */
|
||||
@SuppressWarnings("removal")
|
||||
public interface SpeedController extends PIDOutput {
|
||||
/**
|
||||
* Common interface for setting the speed of a speed controller.
|
||||
|
||||
@@ -10,6 +10,7 @@ import edu.wpi.first.hal.FRCNetComm.tResourceType;
|
||||
import edu.wpi.first.hal.HAL;
|
||||
import edu.wpi.first.hal.SimBoolean;
|
||||
import edu.wpi.first.hal.SimDevice;
|
||||
import edu.wpi.first.hal.SimDevice.Direction;
|
||||
import edu.wpi.first.hal.SimDouble;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SendableBuilder;
|
||||
import edu.wpi.first.wpilibj.smartdashboard.SendableRegistry;
|
||||
@@ -93,8 +94,8 @@ public class Ultrasonic implements PIDSource, Sendable, AutoCloseable {
|
||||
private synchronized void initialize() {
|
||||
m_simDevice = SimDevice.create("Ultrasonic", m_echoChannel.getChannel());
|
||||
if (m_simDevice != null) {
|
||||
m_simRangeValid = m_simDevice.createBoolean("Range Valid", false, true);
|
||||
m_simRange = m_simDevice.createDouble("Range (in)", false, 0.0);
|
||||
m_simRangeValid = m_simDevice.createBoolean("Range Valid", Direction.kInput, true);
|
||||
m_simRange = m_simDevice.createDouble("Range (in)", Direction.kInput, 0.0);
|
||||
m_pingChannel.setSimDevice(m_simDevice);
|
||||
m_echoChannel.setSimDevice(m_simDevice);
|
||||
}
|
||||
|
||||
@@ -197,6 +197,7 @@ public class Watchdog implements Closeable, Comparable<Watchdog> {
|
||||
m_suppressTimeoutMessage = suppress;
|
||||
}
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
private static void updateAlarm() {
|
||||
if (m_watchdogs.size() == 0) {
|
||||
NotifierJNI.cancelNotifierAlarm(m_notifier);
|
||||
|
||||
@@ -82,7 +82,7 @@ public class CallbackStore implements AutoCloseable {
|
||||
m_cancelType = -1;
|
||||
}
|
||||
|
||||
@SuppressWarnings("NoFinalizer")
|
||||
@SuppressWarnings({"NoFinalizer", "deprecation"})
|
||||
@Override
|
||||
protected void finalize() throws Throwable {
|
||||
try {
|
||||
|
||||
@@ -11,7 +11,11 @@ import edu.wpi.first.wpilibj.DriverStation;
|
||||
|
||||
/** Class to control a simulated driver station. */
|
||||
@SuppressWarnings({"PMD.UseUtilityClass", "PMD.GodClass", "PMD.ExcessivePublicCount"})
|
||||
public class DriverStationSim {
|
||||
public final class DriverStationSim {
|
||||
private DriverStationSim() {
|
||||
throw new UnsupportedOperationException("This is a utility class!");
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a callback on whether the DS is enabled.
|
||||
*
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
package edu.wpi.first.wpilibj.simulation;
|
||||
|
||||
import edu.wpi.first.hal.SimDevice;
|
||||
import edu.wpi.first.hal.SimDevice.Direction;
|
||||
import edu.wpi.first.hal.SimDouble;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@@ -23,7 +24,8 @@ public class Mechanism2D {
|
||||
ligamentPath = ligamentPath + "/angle";
|
||||
if (m_device != null) {
|
||||
if (!m_createdItems.containsKey(ligamentPath)) {
|
||||
m_createdItems.put(ligamentPath, m_device.createDouble(ligamentPath, false, angle));
|
||||
m_createdItems.put(
|
||||
ligamentPath, m_device.createDouble(ligamentPath, Direction.kInput, angle));
|
||||
}
|
||||
m_createdItems.get(ligamentPath).set(angle);
|
||||
}
|
||||
@@ -39,7 +41,8 @@ public class Mechanism2D {
|
||||
ligamentPath = ligamentPath + "/length";
|
||||
if (m_device != null) {
|
||||
if (!m_createdItems.containsKey(ligamentPath)) {
|
||||
m_createdItems.put(ligamentPath, m_device.createDouble(ligamentPath, false, length));
|
||||
m_createdItems.put(
|
||||
ligamentPath, m_device.createDouble(ligamentPath, Direction.kInput, length));
|
||||
}
|
||||
m_createdItems.get(ligamentPath).set(length);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user