mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[hal, wpilib] Incorporate pneumatic control type into wpilibc/j (#3728)
This commit is contained in:
@@ -19,7 +19,7 @@ Compressor::Compressor(int module, PneumaticsModuleType moduleType)
|
||||
throw FRC_MakeError(err::ResourceAlreadyAllocated, "{}", module);
|
||||
}
|
||||
|
||||
SetClosedLoopControl(true);
|
||||
m_module->EnableCompressorDigital();
|
||||
|
||||
HAL_Report(HALUsageReporting::kResourceType_Compressor, module + 1);
|
||||
wpi::SendableRegistry::AddLW(this, "Compressor", module);
|
||||
@@ -33,11 +33,11 @@ Compressor::~Compressor() {
|
||||
}
|
||||
|
||||
void Compressor::Start() {
|
||||
SetClosedLoopControl(true);
|
||||
EnableDigital();
|
||||
}
|
||||
|
||||
void Compressor::Stop() {
|
||||
SetClosedLoopControl(false);
|
||||
Disable();
|
||||
}
|
||||
|
||||
bool Compressor::Enabled() const {
|
||||
@@ -48,23 +48,34 @@ bool Compressor::GetPressureSwitchValue() const {
|
||||
return m_module->GetPressureSwitch();
|
||||
}
|
||||
|
||||
double Compressor::GetCompressorCurrent() const {
|
||||
double Compressor::GetCurrent() const {
|
||||
return m_module->GetCompressorCurrent();
|
||||
}
|
||||
|
||||
void Compressor::SetClosedLoopControl(bool on) {
|
||||
m_module->SetClosedLoopControl(on);
|
||||
void Compressor::Disable() {
|
||||
m_module->DisableCompressor();
|
||||
}
|
||||
|
||||
bool Compressor::GetClosedLoopControl() const {
|
||||
return m_module->GetClosedLoopControl();
|
||||
void Compressor::EnableDigital() {
|
||||
m_module->EnableCompressorDigital();
|
||||
}
|
||||
|
||||
void Compressor::EnableAnalog(double minAnalogVoltage,
|
||||
double maxAnalogVoltage) {
|
||||
m_module->EnableCompressorAnalog(minAnalogVoltage, maxAnalogVoltage);
|
||||
}
|
||||
|
||||
void Compressor::EnableHybrid(double minAnalogVoltage,
|
||||
double maxAnalogVoltage) {
|
||||
m_module->EnableCompressorHybrid(minAnalogVoltage, maxAnalogVoltage);
|
||||
}
|
||||
|
||||
CompressorConfigType Compressor::GetConfigType() const {
|
||||
return m_module->GetCompressorConfigType();
|
||||
}
|
||||
|
||||
void Compressor::InitSendable(wpi::SendableBuilder& builder) {
|
||||
builder.SetSmartDashboardType("Compressor");
|
||||
builder.AddBooleanProperty(
|
||||
"Closed Loop Control", [=]() { return GetClosedLoopControl(); },
|
||||
[=](bool value) { SetClosedLoopControl(value); });
|
||||
builder.AddBooleanProperty(
|
||||
"Enabled", [=] { return Enabled(); }, nullptr);
|
||||
builder.AddBooleanProperty(
|
||||
|
||||
Reference in New Issue
Block a user