mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[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:
committed by
GitHub
parent
f401ea9aae
commit
7c09f44898
@@ -129,7 +129,7 @@ TEST(REVPHSimTest, SetEnableAnalog) {
|
||||
ph.DisableCompressor();
|
||||
EXPECT_EQ(ph.GetCompressorConfigType(), CompressorConfigType::Disabled);
|
||||
|
||||
ph.EnableCompressorAnalog(1_V, 2_V);
|
||||
ph.EnableCompressorAnalog(1_psi, 2_psi);
|
||||
EXPECT_EQ(sim.GetCompressorConfigType(),
|
||||
static_cast<int>(CompressorConfigType::Analog));
|
||||
EXPECT_EQ(ph.GetCompressorConfigType(), CompressorConfigType::Analog);
|
||||
@@ -150,7 +150,7 @@ TEST(REVPHSimTest, SetEnableHybrid) {
|
||||
ph.DisableCompressor();
|
||||
EXPECT_EQ(ph.GetCompressorConfigType(), CompressorConfigType::Disabled);
|
||||
|
||||
ph.EnableCompressorHybrid(1_V, 2_V);
|
||||
ph.EnableCompressorHybrid(1_psi, 2_psi);
|
||||
EXPECT_EQ(sim.GetCompressorConfigType(),
|
||||
static_cast<int>(CompressorConfigType::Hybrid));
|
||||
EXPECT_EQ(ph.GetCompressorConfigType(), CompressorConfigType::Hybrid);
|
||||
|
||||
Reference in New Issue
Block a user