Remove deprecated code (#8656)

This commit is contained in:
Gold856
2026-03-15 00:28:31 -04:00
committed by GitHub
parent f1adce4cf7
commit d1fba06851
52 changed files with 10 additions and 1135 deletions

View File

@@ -186,123 +186,7 @@ public class {{ ConsoleName }}Controller extends GenericHID implements Sendable
public BooleanEvent {{ button.name }}(EventLoop loop) {
return button(Button.k{{ capitalize_first(button.name) }}.value, loop);
}
{% endfor -%}
{% if ConsoleName == "Xbox" or ConsoleName == "Stadia" %}
/**
* Read the value of the left bumper (LB) button on the controller.
*
* @return The state of the button.
* @deprecated Use {@link getLeftBumperButton} instead. This function is deprecated for removal
* to make function names consistent to allow the HID classes to be automatically generated.
*/
@Deprecated(since = "2025", forRemoval = true)
public boolean getLeftBumper() {
return getRawButton(Button.kLeftBumper.value);
}
/**
* Read the value of the right bumper (RB) button on the controller.
*
* @return The state of the button.
* @deprecated Use {@link getRightBumperButton} instead. This function is deprecated for removal
* to make function names consistent to allow the HID classes to be automatically generated.
*/
@Deprecated(since = "2025", forRemoval = true)
public boolean getRightBumper() {
return getRawButton(Button.kRightBumper.value);
}
/**
* Whether the left bumper (LB) was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
* @deprecated Use {@link getLeftBumperButtonPressed} instead. This function is deprecated for
* removal to make function names consistent to allow the HID classes to be automatically
* generated.
*/
@Deprecated(since = "2025", forRemoval = true)
public boolean getLeftBumperPressed() {
return getRawButtonPressed(Button.kLeftBumper.value);
}
/**
* Whether the right bumper (RB) was pressed since the last check.
*
* @return Whether the button was pressed since the last check.
* @deprecated Use {@link getRightBumperButtonPressed} instead. This function is deprecated for
* removal to make function names consistent to allow the HID classes to be automatically
* generated.
*/
@Deprecated(since = "2025", forRemoval = true)
public boolean getRightBumperPressed() {
return getRawButtonPressed(Button.kRightBumper.value);
}
/**
* Whether the left bumper (LB) was released since the last check.
*
* @return Whether the button was released since the last check.
* @deprecated Use {@link getLeftBumperButtonReleased} instead. This function is deprecated for
* removal to make function names consistent to allow the HID classes to be automatically
* generated.
*/
@Deprecated(since = "2025", forRemoval = true)
public boolean getLeftBumperReleased() {
return getRawButtonReleased(Button.kLeftBumper.value);
}
/**
* Whether the right bumper (RB) was released since the last check.
*
* @return Whether the button was released since the last check.
* @deprecated Use {@link getRightBumperButtonReleased} instead. This function is deprecated for
* removal to make function names consistent to allow the HID classes to be automatically
* generated.
*/
@Deprecated(since = "2025", forRemoval = true)
public boolean getRightBumperReleased() {
return getRawButtonReleased(Button.kRightBumper.value);
}
{%- elif ConsoleName == "PS4" or ConsoleName == "PS5" %}
/**
* Read the value of the touchpad on the controller.
*
* @return The state of the touchpad.
* @deprecated Use {@link getTouchpadButton} instead. This function is deprecated for removal to
* make function names consistent to allow the HID classes to be automatically generated.
*/
@Deprecated(since = "2025", forRemoval = true)
public boolean getTouchpad() {
return getRawButton(Button.kTouchpad.value);
}
/**
* Whether the touchpad was pressed since the last check.
*
* @return Whether the touchpad was pressed since the last check.
* @deprecated Use {@link getTouchpadButtonPressed} instead. This function is deprecated for
* removal to make function names consistent to allow the HID classes to be automatically
* generated.
*/
@Deprecated(since = "2025", forRemoval = true)
public boolean getTouchpadPressed() {
return getRawButtonPressed(Button.kTouchpad.value);
}
/**
* Whether the touchpad was released since the last check.
*
* @return Whether the touchpad was released since the last check.
* @deprecated Use {@link getTouchpadButtonReleased} instead. This function is deprecated for
* removal to make function names consistent to allow the HID classes to be automatically
* generated.
*/
@Deprecated(since = "2025", forRemoval = true)
public boolean getTouchpadReleased() {
return getRawButtonReleased(Button.kTouchpad.value);
}
{%- endif %}
{% endfor %}
@Override
public void initSendable(SendableBuilder builder) {
builder.setSmartDashboardType("HID");

View File

@@ -715,7 +715,6 @@ public class NiDsPS4Controller extends GenericHID implements Sendable {
return button(Button.kTouchpad.value, loop);
}
@Override
public void initSendable(SendableBuilder builder) {
builder.setSmartDashboardType("HID");

View File

@@ -715,7 +715,6 @@ public class NiDsPS5Controller extends GenericHID implements Sendable {
return button(Button.kTouchpad.value, loop);
}
@Override
public void initSendable(SendableBuilder builder) {
builder.setSmartDashboardType("HID");

View File

@@ -731,7 +731,6 @@ public class NiDsStadiaController extends GenericHID implements Sendable {
return button(Button.kFrame.value, loop);
}
@Override
public void initSendable(SendableBuilder builder) {
builder.setSmartDashboardType("HID");

View File

@@ -607,7 +607,6 @@ public class NiDsXboxController extends GenericHID implements Sendable {
return button(Button.kRightStick.value, loop);
}
@Override
public void initSendable(SendableBuilder builder) {
builder.setSmartDashboardType("HID");

View File

@@ -60,7 +60,6 @@ public abstract class IterativeRobotBase extends RobotBase {
private RobotMode m_lastMode;
private final double m_period;
private final Watchdog m_watchdog;
private boolean m_ntFlushEnabled = true;
private boolean m_calledDsConnected;
/**
@@ -226,17 +225,6 @@ public abstract class IterativeRobotBase extends RobotBase {
*/
public void testExit() {}
/**
* Enables or disables flushing NetworkTables every loop iteration. By default, this is enabled.
*
* @param enabled True to enable, false to disable
* @deprecated Deprecated without replacement.
*/
@Deprecated(forRemoval = true, since = "2025")
public void setNetworkTablesFlushEnabled(boolean enabled) {
m_ntFlushEnabled = enabled;
}
/**
* Gets time period between calls to Periodic() functions.
*
@@ -342,9 +330,7 @@ public abstract class IterativeRobotBase extends RobotBase {
m_watchdog.disable();
// Flush NetworkTables
if (m_ntFlushEnabled) {
NetworkTableInstance.getDefault().flushLocal();
}
NetworkTableInstance.getDefault().flushLocal();
// Warn on loop time overruns
if (m_watchdog.isExpired()) {

View File

@@ -1,107 +0,0 @@
// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package org.wpilib.system;
import org.wpilib.hardware.hal.util.AllocationException;
import org.wpilib.hardware.hal.util.CheckedAllocationException;
/**
* Track resources in the program. The Resource class is a convenient way of keeping track of
* allocated arbitrary resources in the program. Resources are just indices that have a lower and
* upper bound that are tracked by this class. In the library they are used for tracking allocation
* of hardware channels but this is purely arbitrary. The resource class does not do any actual
* allocation, but simply tracks if a given index is currently in use.
*
* <p><b>WARNING:</b> this should only be statically allocated. When the program loads into memory
* all the static constructors are called. At that time a linked list of all the "Resources" is
* created. Then, when the program actually starts - in the Robot constructor, all resources are
* initialized. This ensures that the program is restartable in memory without having to
* unload/reload.
*
* @deprecated Will be removed with no replacement.
*/
@Deprecated(forRemoval = true, since = "2025")
public final class Resource {
private static Resource resourceList;
private final boolean[] m_numAllocated;
private final int m_size;
private final Resource m_nextResource;
/** Clears all allocated resources. */
public static void restartProgram() {
for (Resource r = Resource.resourceList; r != null; r = r.m_nextResource) {
for (int i = 0; i < r.m_size; i++) {
r.m_numAllocated[i] = false;
}
}
}
/**
* Allocate storage for a new instance of Resource. Allocate a bool array of values that will get
* initialized to indicate that no resources have been allocated yet. The indices of the resources
* are 0..size-1.
*
* @param size The number of blocks to allocate
*/
public Resource(final int size) {
m_size = size;
m_numAllocated = new boolean[size];
for (int i = 0; i < size; i++) {
m_numAllocated[i] = false;
}
m_nextResource = Resource.resourceList;
Resource.resourceList = this;
}
/**
* Allocate a resource. When a resource is requested, mark it allocated. In this case, a free
* resource value within the range is located and returned after it is marked allocated.
*
* @return The index of the allocated block.
* @throws CheckedAllocationException If there are no resources available to be allocated.
*/
public int allocate() throws CheckedAllocationException {
for (int i = 0; i < m_size; i++) {
if (!m_numAllocated[i]) {
m_numAllocated[i] = true;
return i;
}
}
throw new CheckedAllocationException("No available resources");
}
/**
* Allocate a specific resource value. The user requests a specific resource value, i.e. channel
* number, and it is verified unallocated, then returned.
*
* @param index The resource to allocate
* @return The index of the allocated block
* @throws CheckedAllocationException If there are no resources available to be allocated.
*/
public int allocate(final int index) throws CheckedAllocationException {
if (index >= m_size || index < 0) {
throw new CheckedAllocationException("Index " + index + " out of range");
}
if (m_numAllocated[index]) {
throw new CheckedAllocationException("Resource at index " + index + " already allocated");
}
m_numAllocated[index] = true;
return index;
}
/**
* Free an allocated resource. After a resource is no longer needed, for example a destructor is
* called for a channel assignment class, this method will release the resource value, so it can
* be reused somewhere else in the program.
*
* @param index The index of the resource to free.
*/
public void free(final int index) {
if (!m_numAllocated[index]) {
throw new AllocationException("No resource available to be freed");
}
m_numAllocated[index] = false;
}
}