[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:
T Grinch
2022-09-07 11:01:55 -05:00
committed by GitHub
parent 4267fa08d1
commit 0389bf5214
2 changed files with 8 additions and 6 deletions

View File

@@ -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,