mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-26 01:51:41 +00:00
CANJaguar::Disable stops periodic setpoints
Calling CANJaguar::Disable() now makes NetComms stop periodic setpoint messages, so the motor actually stops until EnableControl() is called again. Change-Id: Ib4eb4ad5f729be5c74e799f02ed000511de1e03d
This commit is contained in:
@@ -16,7 +16,6 @@
|
||||
#include "LiveWindow/LiveWindow.h"
|
||||
|
||||
/* we are on ARM-LE now, not Freescale so no need to swap */
|
||||
//TODO: is this defined in a PN way? or is this Jag-specific?
|
||||
#define swap16(x) (x)
|
||||
#define swap32(x) (x)
|
||||
|
||||
@@ -1322,24 +1321,19 @@ void CANJaguar::DisableControl()
|
||||
uint8_t dataBuffer[8];
|
||||
uint8_t dataSize = 0;
|
||||
|
||||
switch(m_controlMode)
|
||||
{
|
||||
case kPercentVbus:
|
||||
sendMessage(LM_API_VOLT_DIS, dataBuffer, dataSize);
|
||||
break;
|
||||
case kSpeed:
|
||||
sendMessage(LM_API_SPD_DIS, dataBuffer, dataSize);
|
||||
break;
|
||||
case kPosition:
|
||||
sendMessage(LM_API_POS_DIS, dataBuffer, dataSize);
|
||||
break;
|
||||
case kCurrent:
|
||||
sendMessage(LM_API_ICTRL_DIS, dataBuffer, dataSize);
|
||||
break;
|
||||
case kVoltage:
|
||||
sendMessage(LM_API_VCOMP_DIS, dataBuffer, dataSize);
|
||||
break;
|
||||
}
|
||||
// Disable all control
|
||||
sendMessage(LM_API_VOLT_DIS, dataBuffer, dataSize);
|
||||
sendMessage(LM_API_SPD_DIS, dataBuffer, dataSize);
|
||||
sendMessage(LM_API_POS_DIS, dataBuffer, dataSize);
|
||||
sendMessage(LM_API_ICTRL_DIS, dataBuffer, dataSize);
|
||||
sendMessage(LM_API_VCOMP_DIS, dataBuffer, dataSize);
|
||||
|
||||
// Stop all periodic setpoints
|
||||
sendMessage(LM_API_VOLT_T_SET, dataBuffer, dataSize, CAN_SEND_PERIOD_STOP_REPEATING);
|
||||
sendMessage(LM_API_SPD_T_SET, dataBuffer, dataSize, CAN_SEND_PERIOD_STOP_REPEATING);
|
||||
sendMessage(LM_API_POS_T_SET, dataBuffer, dataSize, CAN_SEND_PERIOD_STOP_REPEATING);
|
||||
sendMessage(LM_API_ICTRL_T_SET, dataBuffer, dataSize, CAN_SEND_PERIOD_STOP_REPEATING);
|
||||
sendMessage(LM_API_VCOMP_T_SET, dataBuffer, dataSize, CAN_SEND_PERIOD_STOP_REPEATING);
|
||||
|
||||
m_controlEnabled = false;
|
||||
}
|
||||
|
||||
@@ -1033,27 +1033,19 @@ public class CANJaguar implements MotorSafety, PIDOutput, SpeedController, LiveW
|
||||
* Stop driving the output based on the feedback.
|
||||
*/
|
||||
public void disableControl() {
|
||||
switch(m_controlMode) {
|
||||
case PercentVbus:
|
||||
sendMessage(CANJNI.LM_API_VOLT_DIS, new byte[0], 0);
|
||||
break;
|
||||
// Disable all control modes.
|
||||
sendMessage(CANJNI.LM_API_VOLT_DIS, new byte[0], 0);
|
||||
sendMessage(CANJNI.LM_API_SPD_DIS, new byte[0], 0);
|
||||
sendMessage(CANJNI.LM_API_POS_DIS, new byte[0], 0);
|
||||
sendMessage(CANJNI.LM_API_ICTRL_DIS, new byte[0], 0);
|
||||
sendMessage(CANJNI.LM_API_VCOMP_DIS, new byte[0], 0);
|
||||
|
||||
case Speed:
|
||||
sendMessage(CANJNI.LM_API_SPD_DIS, new byte[0], 0);
|
||||
break;
|
||||
|
||||
case Position:
|
||||
sendMessage(CANJNI.LM_API_POS_DIS, new byte[0], 0);
|
||||
break;
|
||||
|
||||
case Current:
|
||||
sendMessage(CANJNI.LM_API_ICTRL_DIS, new byte[0], 0);
|
||||
break;
|
||||
|
||||
case Voltage:
|
||||
sendMessage(CANJNI.LM_API_VCOMP_DIS, new byte[0], 0);
|
||||
break;
|
||||
}
|
||||
// Stop all periodic setpoints
|
||||
sendMessage(CANJNI.LM_API_VOLT_T_SET, new byte[0], 0, CANJNI.CAN_SEND_PERIOD_STOP_REPEATING);
|
||||
sendMessage(CANJNI.LM_API_SPD_T_SET, new byte[0], 0, CANJNI.CAN_SEND_PERIOD_STOP_REPEATING);
|
||||
sendMessage(CANJNI.LM_API_POS_T_SET, new byte[0], 0, CANJNI.CAN_SEND_PERIOD_STOP_REPEATING);
|
||||
sendMessage(CANJNI.LM_API_ICTRL_T_SET, new byte[0], 0, CANJNI.CAN_SEND_PERIOD_STOP_REPEATING);
|
||||
sendMessage(CANJNI.LM_API_VCOMP_T_SET, new byte[0], 0, CANJNI.CAN_SEND_PERIOD_STOP_REPEATING);
|
||||
|
||||
m_controlEnabled = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user