From b74948475591de60652ffac6ed1e71057ea85677 Mon Sep 17 00:00:00 2001 From: Zoe Pfister <zoe.pfister@uibk.ac.at> Date: Thu, 27 Oct 2022 16:08:35 +0200 Subject: [PATCH] WIP: mutex --- host/esp-t-sim7000g/src/main.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/host/esp-t-sim7000g/src/main.cpp b/host/esp-t-sim7000g/src/main.cpp index 67e087c..06a9655 100644 --- a/host/esp-t-sim7000g/src/main.cpp +++ b/host/esp-t-sim7000g/src/main.cpp @@ -18,7 +18,7 @@ const char *ntpServer = "pool.ntp.org"; const long gmtOffset_sec = 0; const int daylightOffset_sec = 0; -SemaphoreHandle_t xBinarySemaphore; +SemaphoreHandle_t xMutex; TaskHandle_t Task1; @@ -89,9 +89,9 @@ void on_data_recv(const uint8_t *mac, const uint8_t *incomingData, int len) + measurementType + "=" + value + " " + timestamp; Serial.println(lineData); - xSemaphoreTake(xBinarySemaphore, portMAX_DELAY); + xSemaphoreTake(xMutex, portMAX_DELAY); queue.push(lineData); - xSemaphoreGive(xBinarySemaphore); + xSemaphoreGive(xMutex); } [[noreturn]] void Task1code(void *parameter) @@ -197,7 +197,7 @@ void setup() Serial.println(str); } - xBinarySemaphore = xSemaphoreCreateBinary(); + xMutex = xSemaphoreCreateMutex(); Serial.println("\nWait..."); @@ -364,10 +364,10 @@ void loop() return; } - xSemaphoreTake(xBinarySemaphore, portMAX_DELAY); + xSemaphoreTake(xMutex, portMAX_DELAY); String lineData = queue.front(); queue.pop(); - xSemaphoreGive(xBinarySemaphore); + xSemaphoreGive(xMutex); //"sensorName":"DRS26","timestamp":1666872216,"protocol":"I2C","value":0,"channel":0,"measurementType":"CIRCUMFERENCE_INCREMENT" -- GitLab