mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-26 01:51:41 +00:00
[hal] REVPH: Improve handling of disconnected CAN Bus (#4169)
Force the status to be 0 (no error) upon initialization of the REV PneumaticHub. This prevents a program crash in the case of a robot code restart with no CAN Bus present.
This commit is contained in:
@@ -233,9 +233,11 @@ void HAL_SetCTREPCMClosedLoopControl(HAL_CTREPCMHandle handle, HAL_Bool enabled,
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t can_status = 0;
|
||||
|
||||
std::scoped_lock lock{pcm->lock};
|
||||
pcm->control.bits.closedLoopEnable = enabled ? 1 : 0;
|
||||
SendControl(pcm.get(), status);
|
||||
SendControl(pcm.get(), &can_status);
|
||||
}
|
||||
|
||||
HAL_Bool HAL_GetCTREPCMClosedLoopControl(HAL_CTREPCMHandle handle,
|
||||
|
||||
Reference in New Issue
Block a user