From aa8481c42e9d1051295c52489c152b99f940c7c4 Mon Sep 17 00:00:00 2001 From: proddy Date: Sun, 26 Jul 2026 17:39:58 +0200 Subject: [PATCH] migrate espMqttClient upsteam patches --- lib/espMqttClient/src/MqttClient.cpp | 5 +++++ lib/espMqttClient/src/Outbox.h | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/espMqttClient/src/MqttClient.cpp b/lib/espMqttClient/src/MqttClient.cpp index 745cde1c0..625300a49 100644 --- a/lib/espMqttClient/src/MqttClient.cpp +++ b/lib/espMqttClient/src/MqttClient.cpp @@ -62,11 +62,16 @@ MqttClient::MqttClient(espMqttClientTypes::UseInternalTask useInternalTask, uint _xSemaphore = xSemaphoreCreateMutex(); EMC_SEMAPHORE_GIVE(); // release before first use if (_useInternalTask == espMqttClientTypes::UseInternalTask::YES) { +#ifdef CONFIG_FREERTOS_UNICORE + // no core to pin to on single-core targets (S2, C3, C6) + xTaskCreate((TaskFunction_t)_loop, "mqttclient", EMC_TASK_STACK_SIZE, this, priority, &_taskHandle); +#else if (core > 1) { xTaskCreate((TaskFunction_t)_loop, "mqttclient", EMC_TASK_STACK_SIZE, this, priority, &_taskHandle); } else { xTaskCreatePinnedToCore((TaskFunction_t)_loop, "mqttclient", EMC_TASK_STACK_SIZE, this, priority, &_taskHandle, core); } +#endif } #else (void) useInternalTask; diff --git a/lib/espMqttClient/src/Outbox.h b/lib/espMqttClient/src/Outbox.h index 4f9971c5f..a4ee0327c 100644 --- a/lib/espMqttClient/src/Outbox.h +++ b/lib/espMqttClient/src/Outbox.h @@ -154,8 +154,12 @@ class Outbox { if (!it) return; Node* node = it._node; Node* prev = it._prev; - ++it; + Node* next = node->next; + _remove(prev, node); + + it._prev = prev; + it._node = next; } // remove current node, current points to next