Open gcschmit opened 1 year ago
From CD message: "There is a pneumatics.getCompressorConfigType() method that I believe tells you if the PDH is configured for digital or analog pressure sensor."
I spent some time look at this today. Just detecting the compressor type requires the compressor mode to be set prior. I think the better option is to select the compressor mode when instantiating the pneumatic class. See my (yet untested): https://github.com/FRC-Sonic-Squirrels/3061-lib/commit/509db00a68b54b18da5a9475767bc0db34922378
There is also a hybrid mode, that uses both digital and analog sensors, so any calls to enableCompressorAnalog()
could be replaced with enableCompressorHybrid()
and I think it should work with either or both.
https://first.wpi.edu/wpilib/allwpilib/docs/release/java/edu/wpi/first/wpilibj/PneumaticHub.html#enableCompressorHybrid(double,double)
Maybe an enumeration with more options:
or maybe two parameters – the first specifies the enumerated value related to compressor control and the second a boolean to indicate if a second analog pressure sensor is present to log pressure downstream of the regulator.
I got my version of Pneumatics working with the digital sensor on my fork. Looks very similar to your solution.
The pneumatics subsystem currently only supports dual analog pressure sensors (from Rev). It would be relatively straight forward to add a parameter to the constructor to select between the above three options. (If using a digital pressure sensor, replace enableCompressorAnalog with enableCompressorDigital.)