Prepends all HAL functions with HAL_ (#146)

This commit is contained in:
Thad House
2016-07-09 00:24:26 -07:00
committed by Peter Johnson
parent 5ad28d58ec
commit b637b9ee4c
162 changed files with 2855 additions and 2747 deletions

View File

@@ -186,13 +186,13 @@ void CANTalon::Set(float value) {
break;
}
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
status = m_impl->SetModeSelect(m_sendMode);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
}
}
@@ -250,7 +250,7 @@ bool CANTalon::IsEnabled() const { return IsControlEnabled(); }
void CANTalon::SetP(double p) {
CTR_Code status = m_impl->SetPgain(m_profile, p);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
}
@@ -263,7 +263,7 @@ void CANTalon::SetP(double p) {
void CANTalon::SetI(double i) {
CTR_Code status = m_impl->SetIgain(m_profile, i);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
}
@@ -276,7 +276,7 @@ void CANTalon::SetI(double i) {
void CANTalon::SetD(double d) {
CTR_Code status = m_impl->SetDgain(m_profile, d);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
}
@@ -289,7 +289,7 @@ void CANTalon::SetD(double d) {
void CANTalon::SetF(double f) {
CTR_Code status = m_impl->SetFgain(m_profile, f);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
}
@@ -302,7 +302,7 @@ void CANTalon::SetF(double f) {
void CANTalon::SetIzone(unsigned iz) {
CTR_Code status = m_impl->SetIzone(m_profile, iz);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
}
@@ -314,7 +314,7 @@ void CANTalon::SelectProfileSlot(int slotIdx) {
m_profile = (slotIdx == 0) ? 0 : 1; /* only get two slots for now */
CTR_Code status = m_impl->SetProfileSlotSelect(m_profile);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
}
@@ -360,7 +360,7 @@ void CANTalon::SetFeedbackDevice(FeedbackDevice feedbackDevice) {
/* pass feedback to actual CAN frame */
CTR_Code status = m_impl->SetFeedbackDeviceSelect((int)feedbackDevice);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
}
@@ -370,7 +370,7 @@ void CANTalon::SetFeedbackDevice(FeedbackDevice feedbackDevice) {
void CANTalon::SetStatusFrameRateMs(StatusFrameRate stateFrame, int periodMs) {
CTR_Code status = m_impl->SetStatusFrameRate((int)stateFrame, periodMs);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
}
@@ -386,7 +386,7 @@ double CANTalon::GetP() const {
// Update the info in m_impl.
CTR_Code status = m_impl->RequestParam(param);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
// small yield for getting response
std::this_thread::sleep_for(
@@ -394,7 +394,7 @@ double CANTalon::GetP() const {
double p;
status = m_impl->GetPgain(m_profile, p);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
return p;
}
@@ -409,7 +409,7 @@ double CANTalon::GetI() const {
// Update the info in m_impl.
CTR_Code status = m_impl->RequestParam(param);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
// small yield for getting response
std::this_thread::sleep_for(
@@ -418,7 +418,7 @@ double CANTalon::GetI() const {
double i;
status = m_impl->GetIgain(m_profile, i);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
return i;
}
@@ -433,7 +433,7 @@ double CANTalon::GetD() const {
// Update the info in m_impl.
CTR_Code status = m_impl->RequestParam(param);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
// small yield for getting response
std::this_thread::sleep_for(
@@ -441,7 +441,7 @@ double CANTalon::GetD() const {
double d;
status = m_impl->GetDgain(m_profile, d);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
return d;
}
@@ -456,7 +456,7 @@ double CANTalon::GetF() const {
// Update the info in m_impl.
CTR_Code status = m_impl->RequestParam(param);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
// small yield for getting response
@@ -465,7 +465,7 @@ double CANTalon::GetF() const {
double f;
status = m_impl->GetFgain(m_profile, f);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
return f;
}
@@ -480,7 +480,7 @@ int CANTalon::GetIzone() const {
// Update the info in m_impl.
CTR_Code status = m_impl->RequestParam(param);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
std::this_thread::sleep_for(
std::chrono::microseconds(kDelayForSolicitedSignalsUs));
@@ -488,7 +488,7 @@ int CANTalon::GetIzone() const {
int iz;
status = m_impl->GetIzone(m_profile, iz);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
return iz;
}
@@ -507,7 +507,7 @@ float CANTalon::GetBusVoltage() const {
double voltage;
CTR_Code status = m_impl->GetBatteryV(voltage);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
return voltage;
}
@@ -520,7 +520,7 @@ float CANTalon::GetOutputVoltage() const {
CTR_Code status = m_impl->GetAppliedThrottle(throttle11);
float voltage = GetBusVoltage() * (float(throttle11) / 1023.0);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
return voltage;
}
@@ -533,7 +533,7 @@ float CANTalon::GetOutputCurrent() const {
CTR_Code status = m_impl->GetCurrent(current);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
return current;
@@ -547,7 +547,7 @@ float CANTalon::GetTemperature() const {
CTR_Code status = m_impl->GetTemp(temp);
if (temp != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
return temp;
}
@@ -563,7 +563,7 @@ void CANTalon::SetPosition(double pos) {
int32_t nativePos = ScaleRotationsToNativeUnits(m_feedbackDevice, pos);
CTR_Code status = m_impl->SetSensorPosition(nativePos);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
}
@@ -581,7 +581,7 @@ double CANTalon::GetPosition() const {
int32_t position;
CTR_Code status = m_impl->GetSensorPosition(position);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
return ScaleNativeUnitsToRotations(m_feedbackDevice, position);
}
@@ -594,7 +594,7 @@ double CANTalon::GetPosition() const {
void CANTalon::SetSensorDirection(bool reverseSensor) {
CTR_Code status = m_impl->SetRevFeedbackSensor(reverseSensor ? 1 : 0);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
}
@@ -612,7 +612,7 @@ void CANTalon::SetSensorDirection(bool reverseSensor) {
void CANTalon::SetClosedLoopOutputDirection(bool reverseOutput) {
CTR_Code status = m_impl->SetRevMotDuringCloseLoopEn(reverseOutput ? 1 : 0);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
}
@@ -626,7 +626,7 @@ int CANTalon::GetClosedLoopError() const {
/* retrieve the closed loop error in native units */
CTR_Code status = m_impl->GetCloseLoopErr(error);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
return error;
}
@@ -670,7 +670,7 @@ double CANTalon::GetSpeed() const {
int32_t speed;
CTR_Code status = m_impl->GetSensorVelocity(speed);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
return ScaleNativeUnitsToRpm(m_feedbackDevice, speed);
}
@@ -687,7 +687,7 @@ int CANTalon::GetAnalogIn() const {
int position;
CTR_Code status = m_impl->GetAnalogInWithOv(position);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
return position;
}
@@ -695,7 +695,7 @@ int CANTalon::GetAnalogIn() const {
void CANTalon::SetAnalogPosition(int newPosition) {
CTR_Code status = m_impl->SetParam(CanTalonSRX::eAinPosition, newPosition);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
}
@@ -717,7 +717,7 @@ int CANTalon::GetAnalogInVel() const {
int vel;
CTR_Code status = m_impl->GetAnalogInVel(vel);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
return vel;
}
@@ -732,14 +732,14 @@ int CANTalon::GetEncPosition() const {
int position;
CTR_Code status = m_impl->GetEncPosition(position);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
return position;
}
void CANTalon::SetEncPosition(int newPosition) {
CTR_Code status = m_impl->SetParam(CanTalonSRX::eEncPosition, newPosition);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
}
@@ -753,7 +753,7 @@ int CANTalon::GetEncVel() const {
int vel;
CTR_Code status = m_impl->GetEncVel(vel);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
return vel;
}
@@ -761,34 +761,34 @@ int CANTalon::GetPulseWidthPosition() const {
int param;
CTR_Code status = m_impl->GetPulseWidthPosition(param);
if (status != CTR_OKAY)
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
return param;
}
void CANTalon::SetPulseWidthPosition(int newPosition) {
CTR_Code status = m_impl->SetParam(CanTalonSRX::ePwdPosition, newPosition);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
}
int CANTalon::GetPulseWidthVelocity() const {
int param;
CTR_Code status = m_impl->GetPulseWidthVelocity(param);
if (status != CTR_OKAY)
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
return param;
}
int CANTalon::GetPulseWidthRiseToFallUs() const {
int param;
CTR_Code status = m_impl->GetPulseWidthRiseToFallUs(param);
if (status != CTR_OKAY)
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
return param;
}
int CANTalon::GetPulseWidthRiseToRiseUs() const {
int param;
CTR_Code status = m_impl->GetPulseWidthRiseToRiseUs(param);
if (status != CTR_OKAY)
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
return param;
}
@@ -840,7 +840,7 @@ int CANTalon::GetPinStateQuadA() const {
int retval;
CTR_Code status = m_impl->GetQuadApin(retval);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
return retval;
}
@@ -852,7 +852,7 @@ int CANTalon::GetPinStateQuadB() const {
int retval;
CTR_Code status = m_impl->GetQuadBpin(retval);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
return retval;
}
@@ -864,7 +864,7 @@ int CANTalon::GetPinStateQuadIdx() const {
int retval;
CTR_Code status = m_impl->GetQuadIdxpin(retval);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
return retval;
}
@@ -878,7 +878,7 @@ int CANTalon::IsFwdLimitSwitchClosed() const {
CTR_Code status = m_impl->GetLimitSwitchClosedFor(
retval); /* rename this func, '1' => open, '0' => closed */
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
return retval ? 0 : 1;
}
@@ -892,7 +892,7 @@ int CANTalon::IsRevLimitSwitchClosed() const {
CTR_Code status = m_impl->GetLimitSwitchClosedRev(
retval); /* rename this func, '1' => open, '0' => closed */
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
return retval ? 0 : 1;
}
@@ -906,7 +906,7 @@ int CANTalon::GetNumberOfQuadIdxRises() const {
CTR_Code status = m_impl->GetEncIndexRiseEvents(
rises); /* rename this func, '1' => open, '0' => closed */
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
return rises;
}
@@ -920,7 +920,7 @@ void CANTalon::SetNumberOfQuadIdxRises(int rises) {
CanTalonSRX::eEncIndexRiseEvents,
rises); /* rename this func, '1' => open, '0' => closed */
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
}
@@ -933,11 +933,11 @@ bool CANTalon::GetForwardLimitOK() const {
CTR_Code status = CTR_OKAY;
status = m_impl->GetFault_ForSoftLim(softLim);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
status = m_impl->GetFault_ForLim(limSwit);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
/* If either fault is asserted, signal caller we are disabled (with false?) */
return (softLim | limSwit) ? false : true;
@@ -952,11 +952,11 @@ bool CANTalon::GetReverseLimitOK() const {
CTR_Code status = CTR_OKAY;
status = m_impl->GetFault_RevSoftLim(softLim);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
status = m_impl->GetFault_RevLim(limSwit);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
/* If either fault is asserted, signal caller we are disabled (with false?) */
return (softLim | limSwit) ? false : true;
@@ -974,42 +974,42 @@ uint16_t CANTalon::GetFaults() const {
val = 0;
status = m_impl->GetFault_OverTemp(val);
if (status != CTR_OKAY)
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
retval |= (val) ? CANSpeedController::kTemperatureFault : 0;
/* voltage */
val = 0;
status = m_impl->GetFault_UnderVoltage(val);
if (status != CTR_OKAY)
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
retval |= (val) ? CANSpeedController::kBusVoltageFault : 0;
/* fwd-limit-switch */
val = 0;
status = m_impl->GetFault_ForLim(val);
if (status != CTR_OKAY)
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
retval |= (val) ? CANSpeedController::kFwdLimitSwitch : 0;
/* rev-limit-switch */
val = 0;
status = m_impl->GetFault_RevLim(val);
if (status != CTR_OKAY)
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
retval |= (val) ? CANSpeedController::kRevLimitSwitch : 0;
/* fwd-soft-limit */
val = 0;
status = m_impl->GetFault_ForSoftLim(val);
if (status != CTR_OKAY)
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
retval |= (val) ? CANSpeedController::kFwdSoftLimit : 0;
/* rev-soft-limit */
val = 0;
status = m_impl->GetFault_RevSoftLim(val);
if (status != CTR_OKAY)
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
retval |= (val) ? CANSpeedController::kRevSoftLimit : 0;
return retval;
@@ -1024,42 +1024,42 @@ uint16_t CANTalon::GetStickyFaults() const {
val = 0;
status = m_impl->GetStckyFault_OverTemp(val);
if (status != CTR_OKAY)
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
retval |= (val) ? CANSpeedController::kTemperatureFault : 0;
/* voltage */
val = 0;
status = m_impl->GetStckyFault_UnderVoltage(val);
if (status != CTR_OKAY)
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
retval |= (val) ? CANSpeedController::kBusVoltageFault : 0;
/* fwd-limit-switch */
val = 0;
status = m_impl->GetStckyFault_ForLim(val);
if (status != CTR_OKAY)
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
retval |= (val) ? CANSpeedController::kFwdLimitSwitch : 0;
/* rev-limit-switch */
val = 0;
status = m_impl->GetStckyFault_RevLim(val);
if (status != CTR_OKAY)
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
retval |= (val) ? CANSpeedController::kRevLimitSwitch : 0;
/* fwd-soft-limit */
val = 0;
status = m_impl->GetStckyFault_ForSoftLim(val);
if (status != CTR_OKAY)
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
retval |= (val) ? CANSpeedController::kFwdSoftLimit : 0;
/* rev-soft-limit */
val = 0;
status = m_impl->GetStckyFault_RevSoftLim(val);
if (status != CTR_OKAY)
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
retval |= (val) ? CANSpeedController::kRevSoftLimit : 0;
return retval;
@@ -1067,7 +1067,7 @@ uint16_t CANTalon::GetStickyFaults() const {
void CANTalon::ClearStickyFaults() {
CTR_Code status = m_impl->ClearStickyFaults();
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
/**
@@ -1088,7 +1088,7 @@ void CANTalon::SetVoltageRampRate(double rampRate) {
double rampRatedThrotPer10ms = (rampRate * 1023.0 / 12.0) / 100;
CTR_Code status = m_impl->SetRampThrottle((int)rampRatedThrotPer10ms);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
}
@@ -1098,7 +1098,7 @@ void CANTalon::SetVoltageCompensationRampRate(double rampRate) {
CTR_Code status = CTR_OKAY;
status = m_impl->SetVoltageCompensationRate(rampRate / 1000);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
}
@@ -1114,7 +1114,7 @@ void CANTalon::SetCloseLoopRampRate(double rampRate) {
CTR_Code status = m_impl->SetCloseLoopRampRate(
m_profile, rampRate * 1023.0 / 12.0 / 1000.0);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
}
@@ -1125,20 +1125,20 @@ uint32_t CANTalon::GetFirmwareVersion() const {
int firmwareVersion;
CTR_Code status = m_impl->RequestParam(CanTalonSRX::eFirmVers);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
std::this_thread::sleep_for(
std::chrono::microseconds(kDelayForSolicitedSignalsUs));
status =
m_impl->GetParamResponseInt32(CanTalonSRX::eFirmVers, firmwareVersion);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
/* only sent once on boot */
// CTR_Code status = m_impl->GetFirmVers(firmwareVersion);
// if (status != CTR_OKAY) {
// wpi_setErrorWithContext(status, getHALErrorMessage(status));
// wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
//}
return firmwareVersion;
@@ -1150,7 +1150,7 @@ uint32_t CANTalon::GetFirmwareVersion() const {
int CANTalon::GetIaccum() const {
CTR_Code status = m_impl->RequestParam(CanTalonSRX::ePidIaccum);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
// small yield for getting response
std::this_thread::sleep_for(
@@ -1158,7 +1158,7 @@ int CANTalon::GetIaccum() const {
int iaccum;
status = m_impl->GetParamResponseInt32(CanTalonSRX::ePidIaccum, iaccum);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
return iaccum;
}
@@ -1169,7 +1169,7 @@ int CANTalon::GetIaccum() const {
void CANTalon::ClearIaccum() {
CTR_Code status = m_impl->SetParam(CanTalonSRX::ePidIaccum, 0);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
}
@@ -1195,7 +1195,7 @@ void CANTalon::ConfigNeutralMode(NeutralMode mode) {
break;
}
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
}
@@ -1207,7 +1207,7 @@ int CANTalon::GetBrakeEnableDuringNeutral() const {
int brakeEn = 0;
CTR_Code status = m_impl->GetBrakeIsEnabled(brakeEn);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
return brakeEn;
}
@@ -1299,7 +1299,7 @@ void CANTalon::ConfigLimitSwitchOverrides(bool bForwardLimitSwitchEn,
/* update signal and error check code */
status = m_impl->SetOverrideLimitSwitchEn(fwdRevEnable);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
}
@@ -1315,17 +1315,17 @@ void CANTalon::ConfigLimitMode(LimitMode mode) {
* limit switch.*/
status = m_impl->SetForwardSoftEnable(false);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
status = m_impl->SetReverseSoftEnable(false);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
/* override enable the limit switches, this circumvents the webdash */
status = m_impl->SetOverrideLimitSwitchEn(
CanTalonSRX::kLimitSwitchOverride_EnableFwd_EnableRev);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
break;
case kLimitMode_SoftPositionLimits: /** Use both switches and soft limits */
@@ -1333,17 +1333,17 @@ void CANTalon::ConfigLimitMode(LimitMode mode) {
* limit switch.*/
status = m_impl->SetForwardSoftEnable(true);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
status = m_impl->SetReverseSoftEnable(true);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
/* override enable the limit switches, this circumvents the webdash */
status = m_impl->SetOverrideLimitSwitchEn(
CanTalonSRX::kLimitSwitchOverride_EnableFwd_EnableRev);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
break;
@@ -1353,17 +1353,17 @@ void CANTalon::ConfigLimitMode(LimitMode mode) {
* limit switch.*/
status = m_impl->SetForwardSoftEnable(false);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
status = m_impl->SetReverseSoftEnable(false);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
/* override enable the limit switches, this circumvents the webdash */
status = m_impl->SetOverrideLimitSwitchEn(
CanTalonSRX::kLimitSwitchOverride_DisableFwd_DisableRev);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
break;
}
@@ -1378,7 +1378,7 @@ void CANTalon::ConfigForwardLimit(double forwardLimitPosition) {
ScaleRotationsToNativeUnits(m_feedbackDevice, forwardLimitPosition);
status = m_impl->SetForwardSoftLimit(nativeLimitPos);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
}
@@ -1393,7 +1393,7 @@ void CANTalon::ConfigForwardSoftLimitEnable(bool bForwardSoftLimitEn) {
CTR_Code status = CTR_OKAY;
status = m_impl->SetForwardSoftEnable(bForwardSoftLimitEn);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
}
@@ -1408,7 +1408,7 @@ void CANTalon::ConfigReverseSoftLimitEnable(bool bReverseSoftLimitEn) {
CTR_Code status = CTR_OKAY;
status = m_impl->SetReverseSoftEnable(bReverseSoftLimitEn);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
}
@@ -1427,7 +1427,7 @@ void CANTalon::ConfigFwdLimitSwitchNormallyOpen(bool normallyOpen) {
m_impl->SetParam(CanTalonSRX::eOnBoot_LimitSwitch_Forward_NormallyClosed,
normallyOpen ? 0 : 1);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
}
@@ -1446,7 +1446,7 @@ void CANTalon::ConfigRevLimitSwitchNormallyOpen(bool normallyOpen) {
m_impl->SetParam(CanTalonSRX::eOnBoot_LimitSwitch_Reverse_NormallyClosed,
normallyOpen ? 0 : 1);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
}
@@ -1459,7 +1459,7 @@ void CANTalon::ConfigReverseLimit(double reverseLimitPosition) {
ScaleRotationsToNativeUnits(m_feedbackDevice, reverseLimitPosition);
status = m_impl->SetReverseSoftLimit(nativeLimitPos);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
}
@@ -1515,7 +1515,7 @@ void CANTalon::ConfigSetParameter(uint32_t paramEnum, double value) {
/* config peak throttle when in closed-loop mode in the positive direction. */
status = m_impl->SetParam((CanTalonSRX::param_t)paramEnum, value);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
}
@@ -1528,7 +1528,7 @@ bool CANTalon::GetParameter(uint32_t paramEnum, double& dvalue) const {
/* send the request frame */
CTR_Code status = m_impl->RequestParam((CanTalonSRX::param_t)paramEnum);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
retval = false;
}
/* small yield for getting response */
@@ -1537,7 +1537,7 @@ bool CANTalon::GetParameter(uint32_t paramEnum, double& dvalue) const {
/* get the last received update */
status = m_impl->GetParamResponse((CanTalonSRX::param_t)paramEnum, dvalue);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
retval = false;
}
return retval;
@@ -1560,8 +1560,8 @@ void CANTalon::ConfigFaultTime(float faultTime) {
*/
void CANTalon::ApplyControlMode(CANSpeedController::ControlMode mode) {
m_controlMode = mode;
HALReport(HALUsageReporting::kResourceType_CANTalonSRX, m_deviceNumber + 1,
mode);
HAL_Report(HALUsageReporting::kResourceType_CANTalonSRX, m_deviceNumber + 1,
mode);
switch (mode) {
case kPercentVbus:
m_sendMode = kThrottle;
@@ -1588,7 +1588,7 @@ void CANTalon::ApplyControlMode(CANSpeedController::ControlMode mode) {
// Keep the talon disabled until Set() is called.
CTR_Code status = m_impl->SetModeSelect((int)kDisabled);
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
}
@@ -1723,7 +1723,7 @@ double CANTalon::GetNativeUnitsPerRotationScalar(
}
/* handle any detected errors */
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
/* if scaling information is not possible, signal caller
* by returning zero
@@ -1979,7 +1979,7 @@ void CANTalon::GetMotionProfileStatus(
0; /* this signal is only used sending pts to Talon */
if (status != CTR_OKAY) {
wpi_setErrorWithContext(status, getHALErrorMessage(status));
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
}
}