diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/ADXL345_I2C.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/ADXL345_I2C.java index 4b154bee4c..b7fc15d91c 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/ADXL345_I2C.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/ADXL345_I2C.java @@ -175,7 +175,6 @@ public class ADXL345_I2C extends SensorBase implements Accelerometer, LiveWindow return "3AxisAccelerometer"; } - private NetworkTable m_table; @SuppressWarnings("MemberName") private NetworkTableEntry m_xEntry; @SuppressWarnings("MemberName") @@ -185,11 +184,10 @@ public class ADXL345_I2C extends SensorBase implements Accelerometer, LiveWindow @Override public void initTable(NetworkTable subtable) { - m_table = subtable; - if (m_table != null) { - m_xEntry = m_table.getEntry("X"); - m_yEntry = m_table.getEntry("Y"); - m_zEntry = m_table.getEntry("Z"); + if (subtable != null) { + m_xEntry = subtable.getEntry("X"); + m_yEntry = subtable.getEntry("Y"); + m_zEntry = subtable.getEntry("Z"); updateTable(); } else { m_xEntry = null; @@ -211,11 +209,6 @@ public class ADXL345_I2C extends SensorBase implements Accelerometer, LiveWindow } } - @Override - public NetworkTable getTable() { - return m_table; - } - @Override public void startLiveWindowMode() { } diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/ADXL345_SPI.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/ADXL345_SPI.java index 4e03d9f30c..99ecbcccd4 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/ADXL345_SPI.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/ADXL345_SPI.java @@ -193,7 +193,6 @@ public class ADXL345_SPI extends SensorBase implements Accelerometer, LiveWindow return "3AxisAccelerometer"; } - private NetworkTable m_table; @SuppressWarnings("MemberName") private NetworkTableEntry m_xEntry; @SuppressWarnings("MemberName") @@ -203,11 +202,10 @@ public class ADXL345_SPI extends SensorBase implements Accelerometer, LiveWindow @Override public void initTable(NetworkTable subtable) { - m_table = subtable; - if (m_table != null) { - m_xEntry = m_table.getEntry("X"); - m_yEntry = m_table.getEntry("Y"); - m_zEntry = m_table.getEntry("Z"); + if (subtable != null) { + m_xEntry = subtable.getEntry("X"); + m_yEntry = subtable.getEntry("Y"); + m_zEntry = subtable.getEntry("Z"); updateTable(); } else { m_xEntry = null; @@ -229,11 +227,6 @@ public class ADXL345_SPI extends SensorBase implements Accelerometer, LiveWindow } } - @Override - public NetworkTable getTable() { - return m_table; - } - @Override public void startLiveWindowMode() { } diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/ADXL362.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/ADXL362.java index 6a2fcfc7c7..88bba13591 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/ADXL362.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/ADXL362.java @@ -209,7 +209,6 @@ public class ADXL362 extends SensorBase implements Accelerometer, LiveWindowSend return "3AxisAccelerometer"; } - private NetworkTable m_table; @SuppressWarnings("MemberName") private NetworkTableEntry m_xEntry; @SuppressWarnings("MemberName") @@ -219,11 +218,10 @@ public class ADXL362 extends SensorBase implements Accelerometer, LiveWindowSend @Override public void initTable(NetworkTable subtable) { - m_table = subtable; - if (m_table != null) { - m_xEntry = m_table.getEntry("X"); - m_yEntry = m_table.getEntry("Y"); - m_zEntry = m_table.getEntry("Z"); + if (subtable != null) { + m_xEntry = subtable.getEntry("X"); + m_yEntry = subtable.getEntry("Y"); + m_zEntry = subtable.getEntry("Z"); updateTable(); } else { m_xEntry = null; @@ -245,11 +243,6 @@ public class ADXL362 extends SensorBase implements Accelerometer, LiveWindowSend } } - @Override - public NetworkTable getTable() { - return m_table; - } - @Override public void startLiveWindowMode() { } diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogAccelerometer.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogAccelerometer.java index 8af0708eac..6746172f2a 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogAccelerometer.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogAccelerometer.java @@ -141,25 +141,18 @@ public class AnalogAccelerometer extends SensorBase implements PIDSource, LiveWi /* * Live Window code, only does anything if live window is activated. */ - private NetworkTable m_table; private NetworkTableEntry m_valueEntry; @Override public void initTable(NetworkTable subtable) { - m_table = subtable; - if (m_table != null) { - m_valueEntry = m_table.getEntry("Value"); + if (subtable != null) { + m_valueEntry = subtable.getEntry("Value"); updateTable(); } else { m_valueEntry = null; } } - @Override - public NetworkTable getTable() { - return m_table; - } - @Override public void updateTable() { if (m_valueEntry != null) { diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogInput.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogInput.java index 28bd2dce55..17f04a0294 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogInput.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogInput.java @@ -365,14 +365,12 @@ public class AnalogInput extends SensorBase implements PIDSource, LiveWindowSend return "Analog Input"; } - private NetworkTable m_table; private NetworkTableEntry m_valueEntry; @Override public void initTable(NetworkTable subtable) { - m_table = subtable; - if (m_table != null) { - m_valueEntry = m_table.getEntry("Value"); + if (subtable != null) { + m_valueEntry = subtable.getEntry("Value"); updateTable(); } else { m_valueEntry = null; @@ -386,11 +384,6 @@ public class AnalogInput extends SensorBase implements PIDSource, LiveWindowSend } } - @Override - public NetworkTable getTable() { - return m_table; - } - /** * Analog Channels don't have to do anything special when entering the LiveWindow. {@inheritDoc} */ diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogOutput.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogOutput.java index a08424771b..990b9f9d10 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogOutput.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogOutput.java @@ -70,14 +70,12 @@ public class AnalogOutput extends SensorBase implements LiveWindowSendable { return "Analog Output"; } - private NetworkTable m_table; private NetworkTableEntry m_valueEntry; @Override public void initTable(NetworkTable subtable) { - m_table = subtable; - if (m_table != null) { - m_valueEntry = m_table.getEntry("Value"); + if (subtable != null) { + m_valueEntry = subtable.getEntry("Value"); updateTable(); } else { m_valueEntry = null; @@ -91,11 +89,6 @@ public class AnalogOutput extends SensorBase implements LiveWindowSendable { } } - @Override - public NetworkTable getTable() { - return m_table; - } - /** * Analog Channels don't have to do anything special when entering the LiveWindow. {@inheritDoc} */ diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogPotentiometer.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogPotentiometer.java index 8f8568817d..5ed5a6955b 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogPotentiometer.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/AnalogPotentiometer.java @@ -153,14 +153,12 @@ public class AnalogPotentiometer implements Potentiometer, LiveWindowSendable { return "Analog Input"; } - private NetworkTable m_table; private NetworkTableEntry m_valueEntry; @Override public void initTable(NetworkTable subtable) { - m_table = subtable; - if (m_table != null) { - m_valueEntry = m_table.getEntry("Value"); + if (subtable != null) { + m_valueEntry = subtable.getEntry("Value"); updateTable(); } else { m_valueEntry = null; @@ -174,11 +172,6 @@ public class AnalogPotentiometer implements Potentiometer, LiveWindowSendable { } } - @Override - public NetworkTable getTable() { - return m_table; - } - /** * Frees this resource. */ diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/BuiltInAccelerometer.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/BuiltInAccelerometer.java index f2a64fc436..c3e71abd9f 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/BuiltInAccelerometer.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/BuiltInAccelerometer.java @@ -98,7 +98,6 @@ public class BuiltInAccelerometer implements Accelerometer, LiveWindowSendable { return "3AxisAccelerometer"; } - private NetworkTable m_table; @SuppressWarnings("MemberName") private NetworkTableEntry m_xEntry; @SuppressWarnings("MemberName") @@ -108,11 +107,10 @@ public class BuiltInAccelerometer implements Accelerometer, LiveWindowSendable { @Override public void initTable(NetworkTable subtable) { - m_table = subtable; - if (m_table != null) { - m_xEntry = m_table.getEntry("X"); - m_yEntry = m_table.getEntry("Y"); - m_zEntry = m_table.getEntry("Z"); + if (subtable != null) { + m_xEntry = subtable.getEntry("X"); + m_yEntry = subtable.getEntry("Y"); + m_zEntry = subtable.getEntry("Z"); updateTable(); } else { m_xEntry = null; @@ -134,11 +132,6 @@ public class BuiltInAccelerometer implements Accelerometer, LiveWindowSendable { } } - @Override - public NetworkTable getTable() { - return m_table; - } - @Override public void startLiveWindowMode() { } diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/CANSpeedController.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/CANSpeedController.java index b3831b39af..deebe07edc 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/CANSpeedController.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/CANSpeedController.java @@ -7,8 +7,6 @@ package edu.wpi.first.wpilibj; -import edu.wpi.first.networktables.EntryListenerFlags; -import edu.wpi.first.networktables.NetworkTable; import edu.wpi.first.wpilibj.livewindow.LiveWindowSendable; public interface CANSpeedController extends SpeedController, PIDInterface, LiveWindowSendable { @@ -141,94 +139,8 @@ public interface CANSpeedController extends SpeedController, PIDInterface, LiveW */ String SMART_DASHBOARD_TYPE = "CANSpeedController"; - @Override - default void updateTable() { - NetworkTable table = getTable(); - if (table != null) { - table.getEntry("~TYPE~").setString(SMART_DASHBOARD_TYPE); - table.getEntry("Type").setString(getClass().getSimpleName()); - table.getEntry("Mode").setDouble(getControlMode().getValue()); - if (getControlMode().isPID()) { - table.getEntry("p").setDouble(getP()); - table.getEntry("i").setDouble(getI()); - table.getEntry("d").setDouble(getD()); - table.getEntry("f").setDouble(getF()); - } - table.getEntry("Enabled").setBoolean(isEnabled()); - table.getEntry("Value").setDouble(get()); - } - } - @Override default String getSmartDashboardType() { return SMART_DASHBOARD_TYPE; } - - /** - * Remove table listeners. - */ - default void removeTableListeners(int[] listeners) { - NetworkTable table = getTable(); - if (table != null) { - table.getEntry("Mode").removeListener(listeners[0]); - table.getEntry("p").removeListener(listeners[1]); - table.getEntry("i").removeListener(listeners[2]); - table.getEntry("d").removeListener(listeners[3]); - table.getEntry("f").removeListener(listeners[4]); - table.getEntry("Enabled").removeListener(listeners[5]); - table.getEntry("Value").removeListener(listeners[6]); - } - } - - /** - * Create table listeners. - */ - default int[] createTableListeners() { - int[] listeners = new int[7]; - NetworkTable table = getTable(); - if (table != null) { - listeners[0] = table.getEntry("Mode").addListener( - (event) -> setControlMode((int) event.value.getDouble()), - EntryListenerFlags.kNew | EntryListenerFlags.kUpdate); - - listeners[1] = table.getEntry("p").addListener((event) -> { - if (getControlMode().isPID()) { - setP(event.value.getDouble()); - } - }, EntryListenerFlags.kNew | EntryListenerFlags.kUpdate); - - listeners[2] = table.getEntry("i").addListener((event) -> { - if (getControlMode().isPID()) { - setI(event.value.getDouble()); - } - }, EntryListenerFlags.kNew | EntryListenerFlags.kUpdate); - - listeners[3] = table.getEntry("d").addListener((event) -> { - if (getControlMode().isPID()) { - setD(event.value.getDouble()); - } - }, EntryListenerFlags.kNew | EntryListenerFlags.kUpdate); - - listeners[4] = table.getEntry("f").addListener((event) -> { - if (getControlMode().isPID()) { - setF(event.value.getDouble()); - } - }, EntryListenerFlags.kNew | EntryListenerFlags.kUpdate); - - listeners[5] = table.getEntry("Enabled").addListener((event) -> { - if (event.value.getBoolean()) { - enable(); - } else { - disable(); - } - }, EntryListenerFlags.kNew | EntryListenerFlags.kUpdate); - - listeners[6] = table.getEntry("Value").addListener( - (event) -> set(event.value.getDouble()), - EntryListenerFlags.kNew | EntryListenerFlags.kUpdate); - } - return listeners; - } - - } diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Compressor.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Compressor.java index 15e56afe43..138361bdd0 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Compressor.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Compressor.java @@ -35,7 +35,6 @@ public class Compressor extends SensorBase implements LiveWindowSendable { * @param module The PCM CAN device ID (0 - 62 inclusive) */ public Compressor(int module) { - m_table = null; m_module = (byte) module; m_compressorHandle = CompressorJNI.initializeCompressor((byte) module); @@ -215,17 +214,15 @@ public class Compressor extends SensorBase implements LiveWindowSendable { return "Compressor"; } - private NetworkTable m_table; private NetworkTableEntry m_enabledEntry; private NetworkTableEntry m_pressureSwitchEntry; private int m_enabledListener; @Override public void initTable(NetworkTable subtable) { - m_table = subtable; - if (m_table != null) { - m_enabledEntry = m_table.getEntry("Enabled"); - m_pressureSwitchEntry = m_table.getEntry("Pressure Switch"); + if (subtable != null) { + m_enabledEntry = subtable.getEntry("Enabled"); + m_pressureSwitchEntry = subtable.getEntry("Pressure Switch"); updateTable(); } else { m_enabledEntry = null; @@ -233,11 +230,6 @@ public class Compressor extends SensorBase implements LiveWindowSendable { } } - @Override - public NetworkTable getTable() { - return m_table; - } - @Override public void updateTable() { if (m_enabledEntry != null) { diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Counter.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Counter.java index 1ed7ef537d..579b9209e8 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Counter.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Counter.java @@ -557,25 +557,18 @@ public class Counter extends SensorBase implements CounterBase, LiveWindowSendab return "Counter"; } - private NetworkTable m_table; private NetworkTableEntry m_valueEntry; @Override public void initTable(NetworkTable subtable) { - m_table = subtable; - if (m_table != null) { - m_valueEntry = m_table.getEntry("Value"); + if (subtable != null) { + m_valueEntry = subtable.getEntry("Value"); updateTable(); } else { m_valueEntry = null; } } - @Override - public NetworkTable getTable() { - return m_table; - } - @Override public void updateTable() { if (m_valueEntry != null) { diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/DigitalInput.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/DigitalInput.java index 27b03e0658..a1163092ef 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/DigitalInput.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/DigitalInput.java @@ -106,14 +106,12 @@ public class DigitalInput extends DigitalSource implements LiveWindowSendable { return "Digital Input"; } - private NetworkTable m_table; private NetworkTableEntry m_valueEntry; @Override public void initTable(NetworkTable subtable) { - m_table = subtable; - if (m_table != null) { - m_valueEntry = m_table.getEntry("Value"); + if (subtable != null) { + m_valueEntry = subtable.getEntry("Value"); updateTable(); } else { m_valueEntry = null; @@ -129,12 +127,6 @@ public class DigitalInput extends DigitalSource implements LiveWindowSendable { } - @Override - public NetworkTable getTable() { - return m_table; - } - - @Override public void startLiveWindowMode() { } diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/DigitalOutput.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/DigitalOutput.java index 1ac392d57d..7ca411cdba 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/DigitalOutput.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/DigitalOutput.java @@ -205,16 +205,14 @@ public class DigitalOutput extends DigitalSource implements LiveWindowSendable { return "Digital Output"; } - private NetworkTable m_table; private NetworkTableEntry m_valueEntry; private int m_valueListener; @Override public void initTable(NetworkTable subtable) { - m_table = subtable; - if (m_table != null) { - m_valueEntry = m_table.getEntry("Value"); + if (subtable != null) { + m_valueEntry = subtable.getEntry("Value"); updateTable(); } else { m_valueEntry = null; @@ -222,12 +220,6 @@ public class DigitalOutput extends DigitalSource implements LiveWindowSendable { } - @Override - public NetworkTable getTable() { - return m_table; - } - - @Override public void updateTable() { // TODO: Put current value. diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/DoubleSolenoid.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/DoubleSolenoid.java index 01b42c1731..b1952e946a 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/DoubleSolenoid.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/DoubleSolenoid.java @@ -176,26 +176,19 @@ public class DoubleSolenoid extends SolenoidBase implements LiveWindowSendable { return "Double Solenoid"; } - private NetworkTable m_table; private NetworkTableEntry m_valueEntry; private int m_valueListener; @Override public void initTable(NetworkTable subtable) { - m_table = subtable; - if (m_table != null) { - m_valueEntry = m_table.getEntry("Value"); + if (subtable != null) { + m_valueEntry = subtable.getEntry("Value"); updateTable(); } else { m_valueEntry = null; } } - @Override - public NetworkTable getTable() { - return m_table; - } - @Override public void updateTable() { if (m_valueEntry != null) { diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Encoder.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Encoder.java index c2fffcc74e..bb60a1d843 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Encoder.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Encoder.java @@ -577,18 +577,16 @@ public class Encoder extends SensorBase implements CounterBase, PIDSource, LiveW return "Encoder"; } - private NetworkTable m_table; private NetworkTableEntry m_speedEntry; private NetworkTableEntry m_distanceEntry; private NetworkTableEntry m_distancePerTickEntry; @Override public void initTable(NetworkTable subtable) { - m_table = subtable; - if (m_table != null) { - m_speedEntry = m_table.getEntry("Speed"); - m_distanceEntry = m_table.getEntry("Distance"); - m_distancePerTickEntry = m_table.getEntry("Distance per Tick"); + if (subtable != null) { + m_speedEntry = subtable.getEntry("Speed"); + m_distanceEntry = subtable.getEntry("Distance"); + m_distancePerTickEntry = subtable.getEntry("Distance per Tick"); updateTable(); } else { m_speedEntry = null; @@ -597,11 +595,6 @@ public class Encoder extends SensorBase implements CounterBase, PIDSource, LiveW } } - @Override - public NetworkTable getTable() { - return m_table; - } - @Override public void updateTable() { if (m_speedEntry != null) { diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/GyroBase.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/GyroBase.java index 80ab407826..7fbcc7542a 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/GyroBase.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/GyroBase.java @@ -60,25 +60,18 @@ public abstract class GyroBase extends SensorBase implements Gyro, PIDSource, Li return "Gyro"; } - private NetworkTable m_table; private NetworkTableEntry m_valueEntry; @Override public void initTable(NetworkTable subtable) { - m_table = subtable; - if (m_table != null) { - m_valueEntry = m_table.getEntry("Value"); + if (subtable != null) { + m_valueEntry = subtable.getEntry("Value"); updateTable(); } else { m_valueEntry = null; } } - @Override - public NetworkTable getTable() { - return m_table; - } - @Override public void updateTable() { if (m_valueEntry != null) { diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/PIDController.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/PIDController.java index 1c9fa419ce..ca78e48350 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/PIDController.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/PIDController.java @@ -695,7 +695,6 @@ public class PIDController implements PIDInterface, LiveWindowSendable, Controll return "PIDController"; } - private NetworkTable m_table; @SuppressWarnings("MemberName") private NetworkTableEntry m_pEntry; @SuppressWarnings("MemberName") @@ -741,7 +740,6 @@ public class PIDController implements PIDInterface, LiveWindowSendable, Controll @Override public void initTable(NetworkTable table) { removeListeners(); - m_table = table; if (table != null) { m_pEntry = table.getEntry("p"); m_pEntry.setDouble(getP()); @@ -826,12 +824,6 @@ public class PIDController implements PIDInterface, LiveWindowSendable, Controll return error; } - @Override - public NetworkTable getTable() { - return m_table; - } - - @Override public void updateTable() { } diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/PWM.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/PWM.java index fee2ae6ad9..b8e88debc4 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/PWM.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/PWM.java @@ -250,15 +250,13 @@ public class PWM extends SensorBase implements LiveWindowSendable { return "Speed Controller"; } - private NetworkTable m_table; private NetworkTableEntry m_valueEntry; private int m_valueListener; @Override public void initTable(NetworkTable subtable) { - m_table = subtable; - if (m_table != null) { - m_valueEntry = m_table.getEntry("Value"); + if (subtable != null) { + m_valueEntry = subtable.getEntry("Value"); updateTable(); } else { m_valueEntry = null; @@ -272,11 +270,6 @@ public class PWM extends SensorBase implements LiveWindowSendable { } } - @Override - public NetworkTable getTable() { - return m_table; - } - @Override public void startLiveWindowMode() { setSpeed(0); // Stop for safety diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/PowerDistributionPanel.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/PowerDistributionPanel.java index 47abab0ec8..203e9aa556 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/PowerDistributionPanel.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/PowerDistributionPanel.java @@ -118,21 +118,19 @@ public class PowerDistributionPanel extends SensorBase implements LiveWindowSend /* * Live Window code, only does anything if live window is activated. */ - private NetworkTable m_table; private NetworkTableEntry[] m_chanEntry; private NetworkTableEntry m_voltageEntry; private NetworkTableEntry m_totalCurrentEntry; @Override public void initTable(NetworkTable subtable) { - m_table = subtable; - if (m_table != null) { + if (subtable != null) { m_chanEntry = new NetworkTableEntry[16]; for (int i = 0; i < m_chanEntry.length; i++) { - m_chanEntry[i] = m_table.getEntry("Chan" + i); + m_chanEntry[i] = subtable.getEntry("Chan" + i); } - m_voltageEntry = m_table.getEntry("Voltage"); - m_totalCurrentEntry = m_table.getEntry("TotalCurrent"); + m_voltageEntry = subtable.getEntry("Voltage"); + m_totalCurrentEntry = subtable.getEntry("TotalCurrent"); updateTable(); } else { m_chanEntry = null; @@ -141,11 +139,6 @@ public class PowerDistributionPanel extends SensorBase implements LiveWindowSend } } - @Override - public NetworkTable getTable() { - return m_table; - } - @Override public void updateTable() { if (m_chanEntry != null) { diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Relay.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Relay.java index 5b05d0e209..9bb1720c6e 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Relay.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Relay.java @@ -337,26 +337,19 @@ public class Relay extends SensorBase implements MotorSafety, LiveWindowSendable return "Relay"; } - private NetworkTable m_table; private NetworkTableEntry m_valueEntry; private int m_valueListener; @Override public void initTable(NetworkTable subtable) { - m_table = subtable; - if (m_table != null) { - m_valueEntry = m_table.getEntry("Value"); + if (subtable != null) { + m_valueEntry = subtable.getEntry("Value"); updateTable(); } else { m_valueEntry = null; } } - @Override - public NetworkTable getTable() { - return m_table; - } - @Override public void updateTable() { if (m_valueEntry != null) { diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Sendable.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Sendable.java index bf701827da..005c0aac7a 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Sendable.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Sendable.java @@ -21,13 +21,6 @@ public interface Sendable { */ void initTable(NetworkTable subtable); - /** - * The table that is associated with this {@link Sendable}. - * - * @return the table that is currently associated with the {@link Sendable}. - */ - NetworkTable getTable(); - /** * The string representation of the named data type that will be used by the smart dashboard for * this {@link Sendable}. diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Solenoid.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Solenoid.java index 740091acbd..a2a12d58f1 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Solenoid.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Solenoid.java @@ -105,26 +105,19 @@ public class Solenoid extends SolenoidBase implements LiveWindowSendable { return "Solenoid"; } - private NetworkTable m_table; private NetworkTableEntry m_valueEntry; private int m_valueListener; @Override public void initTable(NetworkTable subtable) { - m_table = subtable; - if (m_table != null) { - m_valueEntry = m_table.getEntry("Value"); + if (subtable != null) { + m_valueEntry = subtable.getEntry("Value"); updateTable(); } else { m_valueEntry = null; } } - @Override - public NetworkTable getTable() { - return m_table; - } - @Override public void updateTable() { if (m_valueEntry != null) { diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Ultrasonic.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Ultrasonic.java index c8f0fb6daf..2709dcbd8c 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/Ultrasonic.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/Ultrasonic.java @@ -399,25 +399,18 @@ public class Ultrasonic extends SensorBase implements PIDSource, LiveWindowSenda return "Ultrasonic"; } - private NetworkTable m_table; private NetworkTableEntry m_valueEntry; @Override public void initTable(NetworkTable subtable) { - m_table = subtable; - if (m_table != null) { - m_valueEntry = m_table.getEntry("Value"); + if (subtable != null) { + m_valueEntry = subtable.getEntry("Value"); updateTable(); } else { m_valueEntry = null; } } - @Override - public NetworkTable getTable() { - return m_table; - } - @Override public void updateTable() { if (m_valueEntry != null) { diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/buttons/Trigger.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/buttons/Trigger.java index 4c4a0188ee..674176225a 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/buttons/Trigger.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/buttons/Trigger.java @@ -195,12 +195,10 @@ public abstract class Trigger implements Sendable { return "Button"; } - private NetworkTable m_table; private NetworkTableEntry m_pressedEntry; @Override public void initTable(NetworkTable table) { - m_table = table; if (table != null) { m_pressedEntry = table.getEntry("pressed"); m_pressedEntry.setBoolean(get()); @@ -208,9 +206,4 @@ public abstract class Trigger implements Sendable { m_pressedEntry = null; } } - - @Override - public NetworkTable getTable() { - return m_table; - } } diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/command/Command.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/command/Command.java index 952da2c551..ff2efbb3cb 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/command/Command.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/command/Command.java @@ -564,7 +564,6 @@ public abstract class Command implements NamedSendable { return "Command"; } - private NetworkTable m_table; private NetworkTableEntry m_runningEntry; private NetworkTableEntry m_isParentedEntry; private int m_runningListener; @@ -574,7 +573,6 @@ public abstract class Command implements NamedSendable { if (m_runningEntry != null) { m_runningEntry.removeListener(m_runningListener); } - m_table = table; if (table != null) { m_runningEntry = table.getEntry("running"); m_isParentedEntry = table.getEntry("isParented"); @@ -593,10 +591,4 @@ public abstract class Command implements NamedSendable { m_isParentedEntry = null; } } - - @Override - public NetworkTable getTable() { - return m_table; - } - } diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/command/Scheduler.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/command/Scheduler.java index 7a7b3dd20c..33f75cae49 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/command/Scheduler.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/command/Scheduler.java @@ -73,7 +73,6 @@ public class Scheduler implements NamedSendable { * A list of all {@link Command Commands} which need to be added. */ private Vector m_additions = new Vector<>(); - private NetworkTable m_table; private NetworkTableEntry m_namesEntry; private NetworkTableEntry m_idsEntry; private NetworkTableEntry m_cancelEntry; @@ -315,11 +314,10 @@ public class Scheduler implements NamedSendable { @Override public void initTable(NetworkTable subtable) { - m_table = subtable; - if (m_table != null) { - m_namesEntry = m_table.getEntry("Names"); - m_idsEntry = m_table.getEntry("Ids"); - m_cancelEntry = m_table.getEntry("Cancel"); + if (subtable != null) { + m_namesEntry = subtable.getEntry("Names"); + m_idsEntry = subtable.getEntry("Ids"); + m_cancelEntry = subtable.getEntry("Cancel"); m_namesEntry.setStringArray(new String[0]); m_idsEntry.setDoubleArray(new double[0]); m_cancelEntry.setDoubleArray(new double[0]); @@ -331,7 +329,7 @@ public class Scheduler implements NamedSendable { } private void updateTable() { - if (m_table != null) { + if (m_namesEntry != null && m_idsEntry != null && m_cancelEntry != null) { // Get the commands to cancel double[] toCancel = m_cancelEntry.getDoubleArray(new double[0]); if (toCancel.length > 0) { @@ -365,11 +363,6 @@ public class Scheduler implements NamedSendable { } } - @Override - public NetworkTable getTable() { - return m_table; - } - @Override public String getSmartDashboardType() { return "Scheduler"; diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/command/Subsystem.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/command/Subsystem.java index c83863c4f8..8b04ff4e95 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/command/Subsystem.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/command/Subsystem.java @@ -110,7 +110,7 @@ public abstract class Subsystem implements NamedSendable { } m_defaultCommand = command; } - if (m_table != null) { + if (m_hasDefaultEntry != null && m_defaultEntry != null) { if (m_defaultCommand != null) { m_hasDefaultEntry.setBoolean(true); m_defaultEntry.setString(m_defaultCommand.getName()); @@ -150,7 +150,7 @@ public abstract class Subsystem implements NamedSendable { */ void confirmCommand() { if (m_currentCommandChanged) { - if (m_table != null) { + if (m_hasCommandEntry != null && m_commandEntry != null) { if (m_currentCommand != null) { m_hasCommandEntry.setBoolean(true); m_commandEntry.setString(m_currentCommand.getName()); @@ -191,7 +191,6 @@ public abstract class Subsystem implements NamedSendable { return "Subsystem"; } - private NetworkTable m_table; private NetworkTableEntry m_hasDefaultEntry; private NetworkTableEntry m_defaultEntry; private NetworkTableEntry m_hasCommandEntry; @@ -199,7 +198,6 @@ public abstract class Subsystem implements NamedSendable { @Override public void initTable(NetworkTable table) { - m_table = table; if (table != null) { m_hasDefaultEntry = table.getEntry("hasDefault"); m_defaultEntry = table.getEntry("default"); @@ -220,9 +218,4 @@ public abstract class Subsystem implements NamedSendable { } } } - - @Override - public NetworkTable getTable() { - return m_table; - } } diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/smartdashboard/SendableChooser.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/smartdashboard/SendableChooser.java index b22d24ae7f..1661122899 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/smartdashboard/SendableChooser.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/smartdashboard/SendableChooser.java @@ -103,14 +103,12 @@ public class SendableChooser implements Sendable { return "String Chooser"; } - private NetworkTable m_table; private NetworkTableEntry m_tableDefault; private NetworkTableEntry m_tableSelected; private NetworkTableEntry m_tableOptions; @Override public void initTable(NetworkTable table) { - m_table = table; if (table != null) { m_tableDefault = table.getEntry(DEFAULT); m_tableSelected = table.getEntry(SELECTED); @@ -121,9 +119,4 @@ public class SendableChooser implements Sendable { } } } - - @Override - public NetworkTable getTable() { - return m_table; - } }