[hal] Fix PCM sticky faults clear function crashing (#3932)

A call to the PCM clear function was using the wrong handle passed down to the CAN layer, causing an error.
This commit is contained in:
Thad House
2022-01-18 00:59:51 -08:00
committed by GitHub
parent 104d7e2abc
commit 0b990bf0f5

View File

@@ -335,8 +335,13 @@ HAL_Bool HAL_GetCTREPCMSolenoidVoltageFault(HAL_CTREPCMHandle handle,
void HAL_ClearAllCTREPCMStickyFaults(HAL_CTREPCMHandle handle,
int32_t* status) {
auto pcm = pcmHandles->Get(handle);
if (pcm == nullptr) {
*status = HAL_HANDLE_ERROR;
return;
}
uint8_t controlData[] = {0, 0, 0, 0x80};
HAL_WriteCANPacket(handle, controlData, sizeof(controlData), Control2,
HAL_WriteCANPacket(pcm->canHandle, controlData, sizeof(controlData), Control2,
status);
}