[wpilib] Use PSI for compressor config and sensor reading (#3847)

This adds the REV Analog Pressure Sensor PSI to volt (and vice versa) conversion to allow setting the compressor config in PSI and getting the sensor reading in PSI. Also adds input validation for pressure values at the higher level.

Co-authored-by: Tyler Veness <calcmogul@gmail.com>
This commit is contained in:
Jan-Felix Abellera
2021-12-31 22:04:56 -07:00
committed by GitHub
parent f401ea9aae
commit 7c09f44898
12 changed files with 208 additions and 52 deletions

View File

@@ -56,6 +56,10 @@ units::volt_t Compressor::GetAnalogVoltage() const {
return m_module->GetAnalogVoltage(0);
}
units::pounds_per_square_inch_t Compressor::GetPressure() const {
return m_module->GetPressure(0);
}
void Compressor::Disable() {
m_module->DisableCompressor();
}
@@ -64,14 +68,14 @@ void Compressor::EnableDigital() {
m_module->EnableCompressorDigital();
}
void Compressor::EnableAnalog(units::volt_t minAnalogVoltage,
units::volt_t maxAnalogVoltage) {
m_module->EnableCompressorAnalog(minAnalogVoltage, maxAnalogVoltage);
void Compressor::EnableAnalog(units::pounds_per_square_inch_t minPressure,
units::pounds_per_square_inch_t maxPressure) {
m_module->EnableCompressorAnalog(minPressure, maxPressure);
}
void Compressor::EnableHybrid(units::volt_t minAnalogVoltage,
units::volt_t maxAnalogVoltage) {
m_module->EnableCompressorHybrid(minAnalogVoltage, maxAnalogVoltage);
void Compressor::EnableHybrid(units::pounds_per_square_inch_t minPressure,
units::pounds_per_square_inch_t maxPressure) {
m_module->EnableCompressorHybrid(minPressure, maxPressure);
}
CompressorConfigType Compressor::GetConfigType() const {