mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-04 03:11:43 +00:00
SolenoidBase functions are now static (#530)
Instance methods were kept around for backwards compat in Java. In C++, the instance methods were changed to match Java. Also some cleanup to the JNI layer to match updated variable types we missed. Closes #416
This commit is contained in:
committed by
Peter Johnson
parent
f32e696fef
commit
e1fc60b8dd
@@ -22,16 +22,41 @@ SolenoidBase::SolenoidBase(int moduleNumber) : m_moduleNumber(moduleNumber) {}
|
||||
/**
|
||||
* Read all 8 solenoids as a single byte
|
||||
*
|
||||
* @param module the module to read from
|
||||
* @return The current value of all 8 solenoids on the module.
|
||||
*/
|
||||
int SolenoidBase::GetAll(int module) const {
|
||||
int SolenoidBase::GetAll(int module) {
|
||||
int value = 0;
|
||||
int32_t status = 0;
|
||||
value = HAL_GetAllSolenoids(static_cast<int>(module), &status);
|
||||
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
value = HAL_GetAllSolenoids(module, &status);
|
||||
wpi_setGlobalErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read all 8 solenoids as a single byte
|
||||
*
|
||||
* @return The current value of all 8 solenoids on the module.
|
||||
*/
|
||||
int SolenoidBase::GetAll() const {
|
||||
return SolenoidBase::GetAll(m_moduleNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads complete solenoid blacklist for all 8 solenoids as a single byte.
|
||||
*
|
||||
* If a solenoid is shorted, it is added to the blacklist and
|
||||
* disabled until power cycle, or until faults are cleared.
|
||||
* @see ClearAllPCMStickyFaults()
|
||||
*
|
||||
* @param module the module to read from
|
||||
* @return The solenoid blacklist of all 8 solenoids on the module.
|
||||
*/
|
||||
int SolenoidBase::GetPCMSolenoidBlackList(int module) {
|
||||
int32_t status = 0;
|
||||
return HAL_GetPCMSolenoidBlackList(module, &status);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reads complete solenoid blacklist for all 8 solenoids as a single byte.
|
||||
*
|
||||
@@ -41,28 +66,61 @@ int SolenoidBase::GetAll(int module) const {
|
||||
*
|
||||
* @return The solenoid blacklist of all 8 solenoids on the module.
|
||||
*/
|
||||
int SolenoidBase::GetPCMSolenoidBlackList(int module) const {
|
||||
int SolenoidBase::GetPCMSolenoidBlackList() const {
|
||||
return SolenoidBase::GetPCMSolenoidBlackList(m_moduleNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param module the module to read from
|
||||
* @return true if PCM sticky fault is set : The common highside solenoid
|
||||
* voltage rail is too low, most likely a solenoid channel is shorted.
|
||||
*/
|
||||
bool SolenoidBase::GetPCMSolenoidVoltageStickyFault(int module) {
|
||||
int32_t status = 0;
|
||||
return HAL_GetPCMSolenoidBlackList(static_cast<int>(module), &status);
|
||||
return HAL_GetPCMSolenoidVoltageStickyFault(module, &status);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if PCM sticky fault is set : The common highside solenoid
|
||||
* voltage rail is too low, most likely a solenoid channel is shorted.
|
||||
*/
|
||||
bool SolenoidBase::GetPCMSolenoidVoltageStickyFault(int module) const {
|
||||
bool SolenoidBase::GetPCMSolenoidVoltageStickyFault() const {
|
||||
return SolenoidBase::GetPCMSolenoidVoltageStickyFault(m_moduleNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param module the module to read from
|
||||
* @return true if PCM is in fault state : The common highside solenoid voltage
|
||||
* rail is too low, most likely a solenoid channel is shorted.
|
||||
*/
|
||||
bool SolenoidBase::GetPCMSolenoidVoltageFault(int module) {
|
||||
int32_t status = 0;
|
||||
return HAL_GetPCMSolenoidVoltageStickyFault(static_cast<int>(module),
|
||||
&status);
|
||||
return HAL_GetPCMSolenoidVoltageFault(module, &status);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if PCM is in fault state : The common highside solenoid voltage
|
||||
* rail is too low, most likely a solenoid channel is shorted.
|
||||
*/
|
||||
bool SolenoidBase::GetPCMSolenoidVoltageFault(int module) const {
|
||||
bool SolenoidBase::GetPCMSolenoidVoltageFault() const {
|
||||
return SolenoidBase::GetPCMSolenoidVoltageFault(m_moduleNumber);
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear ALL sticky faults inside PCM that Compressor is wired to.
|
||||
*
|
||||
* If a sticky fault is set, then it will be persistently cleared. Compressor
|
||||
* drive maybe momentarily disable while flags are being cleared. Care should
|
||||
* be taken to not call this too frequently, otherwise normal compressor
|
||||
* functionality may be prevented.
|
||||
*
|
||||
* If no sticky faults are set then this call will have no effect.
|
||||
*
|
||||
* @param module the module to read from
|
||||
*/
|
||||
void SolenoidBase::ClearAllPCMStickyFaults(int module) {
|
||||
int32_t status = 0;
|
||||
return HAL_GetPCMSolenoidVoltageFault(static_cast<int>(module), &status);
|
||||
return HAL_ClearAllPCMStickyFaults(module, &status);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,7 +133,6 @@ bool SolenoidBase::GetPCMSolenoidVoltageFault(int module) const {
|
||||
*
|
||||
* If no sticky faults are set then this call will have no effect.
|
||||
*/
|
||||
void SolenoidBase::ClearAllPCMStickyFaults(int module) {
|
||||
int32_t status = 0;
|
||||
return HAL_ClearAllPCMStickyFaults(static_cast<int>(module), &status);
|
||||
void SolenoidBase::ClearAllPCMStickyFaults() {
|
||||
SolenoidBase::ClearAllPCMStickyFaults(m_moduleNumber);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user