[hal, wpilib] Incorporate pneumatic control type into wpilibc/j (#3728)

This commit is contained in:
Thad House
2021-11-23 20:32:02 -08:00
committed by GitHub
parent 9aba2b7583
commit b156db400d
35 changed files with 693 additions and 216 deletions

View File

@@ -84,17 +84,38 @@ bool PneumaticsControlModule::GetCompressor() const {
return result;
}
void PneumaticsControlModule::SetClosedLoopControl(bool enabled) {
void PneumaticsControlModule::DisableCompressor() {
int32_t status = 0;
HAL_SetCTREPCMClosedLoopControl(m_handle, enabled, &status);
HAL_SetCTREPCMClosedLoopControl(m_handle, false, &status);
FRC_CheckErrorStatus(status, "Module {}", m_module);
}
bool PneumaticsControlModule::GetClosedLoopControl() const {
void PneumaticsControlModule::EnableCompressorDigital() {
int32_t status = 0;
HAL_SetCTREPCMClosedLoopControl(m_handle, true, &status);
FRC_CheckErrorStatus(status, "Module {}", m_module);
}
void PneumaticsControlModule::EnableCompressorAnalog(double minAnalogVoltage,
double maxAnalogVoltage) {
int32_t status = 0;
HAL_SetCTREPCMClosedLoopControl(m_handle, true, &status);
FRC_CheckErrorStatus(status, "Module {}", m_module);
}
void PneumaticsControlModule::EnableCompressorHybrid(double minAnalogVoltage,
double maxAnalogVoltage) {
int32_t status = 0;
HAL_SetCTREPCMClosedLoopControl(m_handle, true, &status);
FRC_CheckErrorStatus(status, "Module {}", m_module);
}
CompressorConfigType PneumaticsControlModule::GetCompressorConfigType() const {
int32_t status = 0;
auto result = HAL_GetCTREPCMClosedLoopControl(m_handle, &status);
FRC_CheckErrorStatus(status, "Module {}", m_module);
return result;
return result ? CompressorConfigType::Digital
: CompressorConfigType::Disabled;
}
bool PneumaticsControlModule::GetPressureSwitch() const {