From 1b42d3ff86405802a858626145a9f158fcecb65f Mon Sep 17 00:00:00 2001 From: JulianHolzwarth Date: Wed, 20 Mar 2019 16:11:57 +0100 Subject: [PATCH] cpu/esp32/freertos/semphr.c::xSemaphoreTake() return value fix xSemaphoreTake() returned before the fix: pdFALSE(equal to pdFAIL) when the call was successful in obtaining the semaphore and pdTRUE(equal to pdPASS) when the call did not successfully obtain the semaphore. According to freertos documentation: "pdPASS Returned only if the call to xSemaphoreTake() was successful in obtaining the semaphore" "pdFAIL Returned if the call to xSemaphoreTake() did not successfully obtain the semaphore." Fixed it to return the correct value. --- cpu/esp32/freertos/semphr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpu/esp32/freertos/semphr.c b/cpu/esp32/freertos/semphr.c index 04ee642d80..42436b2452 100644 --- a/cpu/esp32/freertos/semphr.c +++ b/cpu/esp32/freertos/semphr.c @@ -94,7 +94,7 @@ BaseType_t xSemaphoreTake (SemaphoreHandle_t xSemaphore, case queueQUEUE_TYPE_MUTEX: { if (xTicksToWait == 0) { - return (mutex_trylock(mutex) == 0) ? pdTRUE : pdFALSE; + return (mutex_trylock(mutex) == 1) ? pdTRUE : pdFALSE; } else { mutex_lock(mutex);