[wpilib] Don't print PD errors for LiveWindow reads (#3708)

If something happens with the PD connection, these would have spammed messages continuously.
This wasn't the case previously, and we don't want this behavior now.
This commit is contained in:
Thad House
2021-11-07 13:45:28 -08:00
committed by GitHub
parent 7699a1f827
commit 3dd41c0d37
4 changed files with 117 additions and 9 deletions

View File

@@ -160,11 +160,16 @@ public class PowerDistribution implements Sendable, AutoCloseable {
int numChannels = getNumChannels();
for (int i = 0; i < numChannels; ++i) {
final int chan = i;
builder.addDoubleProperty("Chan" + i, () -> getCurrent(chan), null);
builder.addDoubleProperty(
"Chan" + i, () -> PowerDistributionJNI.getChannelCurrentNoError(m_handle, chan), null);
}
builder.addDoubleProperty("Voltage", this::getVoltage, null);
builder.addDoubleProperty("TotalCurrent", this::getTotalCurrent, null);
builder.addDoubleProperty(
"Voltage", () -> PowerDistributionJNI.getVoltageNoError(m_handle), null);
builder.addDoubleProperty(
"TotalCurrent", () -> PowerDistributionJNI.getTotalCurrent(m_handle), null);
builder.addBooleanProperty(
"SwitchableChannel", this::getSwitchableChannel, this::setSwitchableChannel);
"SwitchableChannel",
() -> PowerDistributionJNI.getSwitchableChannelNoError(m_handle),
value -> PowerDistributionJNI.setSwitchableChannel(m_handle, value));
}
}