mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-27 02:01:42 +00:00
don't use uninitialized variables
Change-Id: I9869c3bf64f00ddff641e5dc06b16179c3b3ce2f
This commit is contained in:
committed by
James Kuszmaul
parent
d1d28e70e1
commit
880eae1424
@@ -760,6 +760,10 @@ void CANJaguar::verify()
|
||||
message = LM_API_POS_PC;
|
||||
else if(m_controlMode == kCurrent)
|
||||
message = LM_API_ICTRL_PC;
|
||||
else {
|
||||
wpi_setWPIErrorWithContext(IncompatibleMode, "PID constants only apply in Speed, Position, and Current mode");
|
||||
return;
|
||||
}
|
||||
|
||||
if(getMessage(message, CAN_MSGID_FULL_M, dataBuffer, &dataSize))
|
||||
{
|
||||
@@ -788,6 +792,10 @@ void CANJaguar::verify()
|
||||
message = LM_API_POS_IC;
|
||||
else if(m_controlMode == kCurrent)
|
||||
message = LM_API_ICTRL_IC;
|
||||
else {
|
||||
wpi_setWPIErrorWithContext(IncompatibleMode, "PID constants only apply in Speed, Position, and Current mode");
|
||||
return;
|
||||
}
|
||||
|
||||
if(getMessage(message, CAN_MSGID_FULL_M, dataBuffer, &dataSize))
|
||||
{
|
||||
@@ -816,6 +824,10 @@ void CANJaguar::verify()
|
||||
message = LM_API_POS_DC;
|
||||
else if(m_controlMode == kCurrent)
|
||||
message = LM_API_ICTRL_DC;
|
||||
else {
|
||||
wpi_setWPIErrorWithContext(IncompatibleMode, "PID constants only apply in Speed, Position, and Current mode");
|
||||
return;
|
||||
}
|
||||
|
||||
if(getMessage(message, CAN_MSGID_FULL_M, dataBuffer, &dataSize))
|
||||
{
|
||||
|
||||
@@ -117,7 +117,7 @@ void CANTalon::Set(float value, uint8_t syncGroup)
|
||||
m_safetyHelper->Feed();
|
||||
if(m_controlEnabled) {
|
||||
m_setPoint = value;
|
||||
CTR_Code status;
|
||||
CTR_Code status = CTR_OKAY;
|
||||
switch(m_controlMode) {
|
||||
case CANSpeedController::kPercentVbus:
|
||||
{
|
||||
@@ -730,7 +730,7 @@ bool CANTalon::GetForwardLimitOK()
|
||||
{
|
||||
int limSwit=0;
|
||||
int softLim=0;
|
||||
CTR_Code status;
|
||||
CTR_Code status = CTR_OKAY;
|
||||
status = m_impl->GetFault_ForSoftLim(softLim);
|
||||
if(status != CTR_OKAY) {
|
||||
wpi_setErrorWithContext(status, getHALErrorMessage(status));
|
||||
@@ -750,7 +750,7 @@ bool CANTalon::GetReverseLimitOK()
|
||||
{
|
||||
int limSwit=0;
|
||||
int softLim=0;
|
||||
CTR_Code status;
|
||||
CTR_Code status = CTR_OKAY;
|
||||
status = m_impl->GetFault_RevSoftLim(softLim);
|
||||
if(status != CTR_OKAY) {
|
||||
wpi_setErrorWithContext(status, getHALErrorMessage(status));
|
||||
@@ -770,7 +770,7 @@ uint16_t CANTalon::GetFaults()
|
||||
{
|
||||
uint16_t retval = 0;
|
||||
int val;
|
||||
CTR_Code status;
|
||||
CTR_Code status = CTR_OKAY;
|
||||
|
||||
/* temperature */
|
||||
val = 0;
|
||||
@@ -820,7 +820,7 @@ uint16_t CANTalon::GetStickyFaults()
|
||||
{
|
||||
uint16_t retval = 0;
|
||||
int val;
|
||||
CTR_Code status;
|
||||
CTR_Code status = CTR_OKAY;
|
||||
|
||||
/* temperature */
|
||||
val = 0;
|
||||
@@ -962,7 +962,7 @@ void CANTalon::ClearIaccum()
|
||||
*/
|
||||
void CANTalon::ConfigNeutralMode(NeutralMode mode)
|
||||
{
|
||||
CTR_Code status;
|
||||
CTR_Code status = CTR_OKAY;
|
||||
switch(mode){
|
||||
default:
|
||||
case kNeutralMode_Jumper: /* use default setting in flash based on webdash/BrakeCal button selection */
|
||||
@@ -1032,7 +1032,7 @@ void CANTalon::DisableSoftPositionLimits()
|
||||
*/
|
||||
void CANTalon::ConfigLimitMode(LimitMode mode)
|
||||
{
|
||||
CTR_Code status;
|
||||
CTR_Code status = CTR_OKAY;
|
||||
switch(mode){
|
||||
case kLimitMode_SwitchInputsOnly: /** Only use switches for limits */
|
||||
/* turn OFF both limits. SRX has individual enables and polarity for each limit switch.*/
|
||||
@@ -1091,7 +1091,7 @@ void CANTalon::ConfigLimitMode(LimitMode mode)
|
||||
*/
|
||||
void CANTalon::ConfigForwardLimit(double forwardLimitPosition)
|
||||
{
|
||||
CTR_Code status;
|
||||
CTR_Code status = CTR_OKAY;
|
||||
status = m_impl->SetForwardSoftLimit(forwardLimitPosition);
|
||||
if(status != CTR_OKAY) {
|
||||
wpi_setErrorWithContext(status, getHALErrorMessage(status));
|
||||
@@ -1136,7 +1136,7 @@ void CANTalon::ConfigRevLimitSwitchNormallyOpen(bool normallyOpen)
|
||||
*/
|
||||
void CANTalon::ConfigReverseLimit(double reverseLimitPosition)
|
||||
{
|
||||
CTR_Code status;
|
||||
CTR_Code status = CTR_OKAY;
|
||||
status = m_impl->SetReverseSoftLimit(reverseLimitPosition);
|
||||
if(status != CTR_OKAY) {
|
||||
wpi_setErrorWithContext(status, getHALErrorMessage(status));
|
||||
|
||||
Reference in New Issue
Block a user