Fix: xSemaphoreTake was useless

There was no check of the return value implemented therefore xSemaphoreTake was just executed and not locked
This commit is contained in:
Thomas Basler 2023-04-28 21:02:10 +02:00
parent 0441bbbe72
commit 3504884836
2 changed files with 7 additions and 3 deletions

View File

@ -12,7 +12,9 @@
#include "inverters/HM_4CH.h" #include "inverters/HM_4CH.h"
#include <Arduino.h> #include <Arduino.h>
#define HOY_SEMAPHORE_TAKE() xSemaphoreTake(_xSemaphore, portMAX_DELAY) #define HOY_SEMAPHORE_TAKE() \
do { \
} while (xSemaphoreTake(_xSemaphore, portMAX_DELAY) != pdPASS)
#define HOY_SEMAPHORE_GIVE() xSemaphoreGive(_xSemaphore) #define HOY_SEMAPHORE_GIVE() xSemaphoreGive(_xSemaphore)
HoymilesClass Hoymiles; HoymilesClass Hoymiles;

View File

@ -8,7 +8,9 @@
MessageOutputClass MessageOutput; MessageOutputClass MessageOutput;
#define MSG_LOCK() xSemaphoreTake(_lock, portMAX_DELAY) #define MSG_LOCK() \
do { \
} while (xSemaphoreTake(_lock, portMAX_DELAY) != pdPASS)
#define MSG_UNLOCK() xSemaphoreGive(_lock) #define MSG_UNLOCK() xSemaphoreGive(_lock)
MessageOutputClass::MessageOutputClass() MessageOutputClass::MessageOutputClass()
@ -45,7 +47,7 @@ void MessageOutputClass::loop()
_ws->textAll(_buffer, _buff_pos); _ws->textAll(_buffer, _buff_pos);
_buff_pos = 0; _buff_pos = 0;
} }
if(_forceSend) { if (_forceSend) {
_buff_pos = 0; _buff_pos = 0;
} }
MSG_UNLOCK(); MSG_UNLOCK();