mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-26 01:51:41 +00:00
[wpilib] Compressor: Add more Sendable data (#6687)
This commit is contained in:
@@ -24,6 +24,7 @@ import edu.wpi.first.util.sendable.SendableRegistry;
|
||||
*/
|
||||
public class Compressor implements Sendable, AutoCloseable {
|
||||
private PneumaticsBase m_module;
|
||||
private PneumaticsModuleType m_moduleType;
|
||||
|
||||
/**
|
||||
* Constructs a compressor for a specified module and type.
|
||||
@@ -34,6 +35,7 @@ public class Compressor implements Sendable, AutoCloseable {
|
||||
@SuppressWarnings("this-escape")
|
||||
public Compressor(int module, PneumaticsModuleType moduleType) {
|
||||
m_module = PneumaticsBase.getForType(module, moduleType);
|
||||
m_moduleType = moduleType;
|
||||
|
||||
if (!m_module.reserveCompressor()) {
|
||||
m_module.close();
|
||||
@@ -194,5 +196,10 @@ public class Compressor implements Sendable, AutoCloseable {
|
||||
builder.setSmartDashboardType("Compressor");
|
||||
builder.addBooleanProperty("Enabled", this::isEnabled, null);
|
||||
builder.addBooleanProperty("Pressure switch", this::getPressureSwitchValue, null);
|
||||
builder.addDoubleProperty("Current (A)", this::getCurrent, null);
|
||||
if (m_moduleType == PneumaticsModuleType.REVPH) { // These are not supported by the CTRE PCM
|
||||
builder.addDoubleProperty("Analog Voltage", this::getAnalogVoltage, null);
|
||||
builder.addDoubleProperty("Pressure (PSI)", this::getPressure, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user