mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-07-06 03:31:43 +00:00
Two param constructor added to C++/java CANTalon so caller can optionally specify the periodMs at which the talon control frame is sent.
The param is capped in the HAL C++ class to [1ms, 95ms] so that zero and negative periods are caped to 1ms, and so that caller can't pass an absurdly large value, which causes TALON is appear disabled. Change-Id: I4207194be25a33bbd6ad281a75301ce6684659a5
This commit is contained in:
@@ -242,6 +242,11 @@ typedef struct _TALON_Param_Response_t {
|
||||
|
||||
CanTalonSRX::CanTalonSRX(int deviceNumber,int controlPeriodMs): CtreCanNode(deviceNumber), _can_h(0), _can_stat(0)
|
||||
{
|
||||
/* bound period to be within [1 ms,95 ms] */
|
||||
if(controlPeriodMs < 1)
|
||||
controlPeriodMs = 1;
|
||||
else if(controlPeriodMs > 95)
|
||||
controlPeriodMs = 95;
|
||||
RegisterRx(STATUS_1 | (UINT8)deviceNumber );
|
||||
RegisterRx(STATUS_2 | (UINT8)deviceNumber );
|
||||
RegisterRx(STATUS_3 | (UINT8)deviceNumber );
|
||||
|
||||
Reference in New Issue
Block a user