Merge pull request 'Fix: Mutex in getter of safety state' (#9) from bugfix/get-safety-state-critial-section into main
Reviewed-on: #9
This commit is contained in:
		| @ -155,5 +155,16 @@ void getSensorSanityStates(sSensorSanityCheck *pSensorSanityChecks) | |||||||
|  |  | ||||||
| eSafetyState getSafetyState(void) | eSafetyState getSafetyState(void) | ||||||
| { | { | ||||||
|     return sSafetyState; |     eSafetyState state = SAFETY_NO_ERROR; | ||||||
|  |     if (xSemaphoreTakeRecursive(xMutexAccessSafety, pdMS_TO_TICKS(5000)) == pdTRUE) | ||||||
|  |     { | ||||||
|  |         state = sSafetyState; | ||||||
|  |         xSemaphoreGiveRecursive(xMutexAccessSafety); | ||||||
|  |     } | ||||||
|  |     else | ||||||
|  |     { | ||||||
|  |         state = SAFETY_INTERNAL_ERROR; | ||||||
|  |         ESP_LOGE(TAG, "Unable to take mutex: getSafetyState()"); | ||||||
|  |     } | ||||||
|  |     return state; | ||||||
| } | } | ||||||
		Reference in New Issue
	
	Block a user