mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-05 03:21:42 +00:00
[wpilib] PH: Revert to 5V rail being fixed 5V (#5122)
This commit is contained in:
@@ -161,11 +161,14 @@ void PneumaticHub::EnableCompressorAnalog(
|
|||||||
"maxPressure must be between 0 and 120 PSI, got {}",
|
"maxPressure must be between 0 and 120 PSI, got {}",
|
||||||
maxPressure);
|
maxPressure);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Send the voltage as it would be if the 5V rail was at exactly 5V.
|
||||||
|
// The firmware will compensate for the real 5V rail voltage, which
|
||||||
|
// can fluctuate somewhat over time.
|
||||||
|
units::volt_t minAnalogVoltage = PSIToVolts(minPressure, 5_V);
|
||||||
|
units::volt_t maxAnalogVoltage = PSIToVolts(maxPressure, 5_V);
|
||||||
|
|
||||||
int32_t status = 0;
|
int32_t status = 0;
|
||||||
units::volt_t minAnalogVoltage =
|
|
||||||
PSIToVolts(minPressure, Get5VRegulatedVoltage());
|
|
||||||
units::volt_t maxAnalogVoltage =
|
|
||||||
PSIToVolts(maxPressure, Get5VRegulatedVoltage());
|
|
||||||
HAL_SetREVPHClosedLoopControlAnalog(m_handle, minAnalogVoltage.value(),
|
HAL_SetREVPHClosedLoopControlAnalog(m_handle, minAnalogVoltage.value(),
|
||||||
maxAnalogVoltage.value(), &status);
|
maxAnalogVoltage.value(), &status);
|
||||||
FRC_ReportError(status, "Module {}", m_module);
|
FRC_ReportError(status, "Module {}", m_module);
|
||||||
@@ -188,11 +191,14 @@ void PneumaticHub::EnableCompressorHybrid(
|
|||||||
"maxPressure must be between 0 and 120 PSI, got {}",
|
"maxPressure must be between 0 and 120 PSI, got {}",
|
||||||
maxPressure);
|
maxPressure);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Send the voltage as it would be if the 5V rail was at exactly 5V.
|
||||||
|
// The firmware will compensate for the real 5V rail voltage, which
|
||||||
|
// can fluctuate somewhat over time.
|
||||||
|
units::volt_t minAnalogVoltage = PSIToVolts(minPressure, 5_V);
|
||||||
|
units::volt_t maxAnalogVoltage = PSIToVolts(maxPressure, 5_V);
|
||||||
|
|
||||||
int32_t status = 0;
|
int32_t status = 0;
|
||||||
units::volt_t minAnalogVoltage =
|
|
||||||
PSIToVolts(minPressure, Get5VRegulatedVoltage());
|
|
||||||
units::volt_t maxAnalogVoltage =
|
|
||||||
PSIToVolts(maxPressure, Get5VRegulatedVoltage());
|
|
||||||
HAL_SetREVPHClosedLoopControlHybrid(m_handle, minAnalogVoltage.value(),
|
HAL_SetREVPHClosedLoopControlHybrid(m_handle, minAnalogVoltage.value(),
|
||||||
maxAnalogVoltage.value(), &status);
|
maxAnalogVoltage.value(), &status);
|
||||||
FRC_ReportError(status, "Module {}", m_module);
|
FRC_ReportError(status, "Module {}", m_module);
|
||||||
|
|||||||
@@ -294,8 +294,12 @@ public class PneumaticHub implements PneumaticsBase {
|
|||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"maxPressure must be between 0 and 120 PSI, got " + maxPressure);
|
"maxPressure must be between 0 and 120 PSI, got " + maxPressure);
|
||||||
}
|
}
|
||||||
double minAnalogVoltage = psiToVolts(minPressure, get5VRegulatedVoltage());
|
|
||||||
double maxAnalogVoltage = psiToVolts(maxPressure, get5VRegulatedVoltage());
|
// Send the voltage as it would be if the 5V rail was at exactly 5V.
|
||||||
|
// The firmware will compensate for the real 5V rail voltage, which
|
||||||
|
// can fluctuate somewhat over time.
|
||||||
|
double minAnalogVoltage = psiToVolts(minPressure, 5);
|
||||||
|
double maxAnalogVoltage = psiToVolts(maxPressure, 5);
|
||||||
REVPHJNI.setClosedLoopControlAnalog(m_handle, minAnalogVoltage, maxAnalogVoltage);
|
REVPHJNI.setClosedLoopControlAnalog(m_handle, minAnalogVoltage, maxAnalogVoltage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -339,8 +343,12 @@ public class PneumaticHub implements PneumaticsBase {
|
|||||||
throw new IllegalArgumentException(
|
throw new IllegalArgumentException(
|
||||||
"maxPressure must be between 0 and 120 PSI, got " + maxPressure);
|
"maxPressure must be between 0 and 120 PSI, got " + maxPressure);
|
||||||
}
|
}
|
||||||
double minAnalogVoltage = psiToVolts(minPressure, get5VRegulatedVoltage());
|
|
||||||
double maxAnalogVoltage = psiToVolts(maxPressure, get5VRegulatedVoltage());
|
// Send the voltage as it would be if the 5V rail was at exactly 5V.
|
||||||
|
// The firmware will compensate for the real 5V rail voltage, which
|
||||||
|
// can fluctuate somewhat over time.
|
||||||
|
double minAnalogVoltage = psiToVolts(minPressure, 5);
|
||||||
|
double maxAnalogVoltage = psiToVolts(maxPressure, 5);
|
||||||
REVPHJNI.setClosedLoopControlHybrid(m_handle, minAnalogVoltage, maxAnalogVoltage);
|
REVPHJNI.setClosedLoopControlHybrid(m_handle, minAnalogVoltage, maxAnalogVoltage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user