Browse Source

0.8.152

* patching MqTT library to prevent raise conditions while using semaphores
* update ESP32 espressif platform to `0.6.9`
* update ESPAsyncWebServer to `3.3.12`
development03
lumapu 3 months ago
parent
commit
3afc165157
  1. 88
      patches/espMqttClientSemaphore.patch
  2. 2
      scripts/applyPatches.py
  3. 5
      src/CHANGES.md
  4. 2
      src/defines.h
  5. 30
      src/platformio.ini

88
patches/espMqttClientSemaphore.patch

@ -0,0 +1,88 @@
diff --git a/src/MqttClient.cpp b/src/MqttClient.cpp
index dc21f74..d4b35c4 100644
--- a/src/MqttClient.cpp
+++ b/src/MqttClient.cpp
@@ -1,7 +1,7 @@
/*
Copyright (c) 2022 Bert Melis. All rights reserved.
-This work is licensed under the terms of the MIT license.
+This work is licensed under the terms of the MIT license.
For a copy, see <https://opensource.org/licenses/MIT> or
the LICENSE file.
*/
@@ -148,16 +148,19 @@ uint16_t MqttClient::publish(const char* topic, uint8_t qos, bool retain, const
#endif
return 0;
}
- EMC_SEMAPHORE_TAKE();
- uint16_t packetId = (qos > 0) ? _getNextPacketId() : 1;
- if (!_addPacket(packetId, topic, payload, length, qos, retain)) {
- emc_log_e("Could not create PUBLISH packet");
+ uint16_t packetId = 0;
+ if(pdTRUE == EMC_SEMAPHORE_TAKE()) {
+ packetId = (qos > 0) ? _getNextPacketId() : 1;
+ if (!_addPacket(packetId, topic, payload, length, qos, retain)) {
+ emc_log_e("Could not create PUBLISH packet");
+ EMC_SEMAPHORE_GIVE();
+ _onError(packetId, Error::OUT_OF_MEMORY);
+ if(pdTRUE == EMC_SEMAPHORE_TAKE())
+ packetId = 0;
+ }
EMC_SEMAPHORE_GIVE();
- _onError(packetId, Error::OUT_OF_MEMORY);
- EMC_SEMAPHORE_TAKE();
- packetId = 0;
+ yield();
}
- EMC_SEMAPHORE_GIVE();
return packetId;
}
@@ -174,16 +177,19 @@ uint16_t MqttClient::publish(const char* topic, uint8_t qos, bool retain, espMqt
#endif
return 0;
}
- EMC_SEMAPHORE_TAKE();
- uint16_t packetId = (qos > 0) ? _getNextPacketId() : 1;
- if (!_addPacket(packetId, topic, callback, length, qos, retain)) {
- emc_log_e("Could not create PUBLISH packet");
+ uint16_t packetId = 0;
+ if(pdTRUE == EMC_SEMAPHORE_TAKE()) {
+ packetId = (qos > 0) ? _getNextPacketId() : 1;
+ if (!_addPacket(packetId, topic, callback, length, qos, retain)) {
+ emc_log_e("Could not create PUBLISH packet");
+ EMC_SEMAPHORE_GIVE();
+ _onError(packetId, Error::OUT_OF_MEMORY);
+ if(pdTRUE == EMC_SEMAPHORE_TAKE())
+ packetId = 0;
+ }
EMC_SEMAPHORE_GIVE();
- _onError(packetId, Error::OUT_OF_MEMORY);
- EMC_SEMAPHORE_TAKE();
- packetId = 0;
+ yield();
}
- EMC_SEMAPHORE_GIVE();
return packetId;
}
@@ -237,11 +243,13 @@ void MqttClient::loop() {
case State::connectingMqtt:
#if EMC_WAIT_FOR_CONNACK
if (_transport->connected()) {
- EMC_SEMAPHORE_TAKE();
- _sendPacket();
- _checkIncoming();
- _checkPing();
- EMC_SEMAPHORE_GIVE();
+ if(pdTRUE == EMC_SEMAPHORE_TAKE()) {
+ _sendPacket();
+ _checkIncoming();
+ _checkPing();
+ EMC_SEMAPHORE_GIVE();
+ yield();
+ }
} else {
_setState(State::disconnectingTcp1);
_disconnectReason = DisconnectReason::TCP_DISCONNECTED;

2
scripts/applyPatches.py

@ -25,6 +25,8 @@ def applyPatch(libName, patchFile):
os.chdir(start)
applyPatch("espMqttClient", "../patches/espMqttClientSemaphore.patch")
# list of patches to apply (relative to /src)
if (env['PIOENV'][:5] == "esp32") or (env['PIOENV'][:13] == "opendtufusion"):
applyPatch("GxEPD2", "../patches/GxEPD2_HAL.patch")

5
src/CHANGES.md

@ -1,5 +1,10 @@
# Development Changes
## 0.8.152 - 2024-10-07
* patching MqTT library to prevent raise conditions while using semaphores
* update ESP32 espressif platform to `0.6.9`
* update ESPAsyncWebServer to `3.3.12`
## 0.8.151 - 2024-10-03
* don't interrupt current command by setting a new limit #1757
* add button for CMT inverters to catch them independend on which frequency they were before #1749

2
src/defines.h

@ -13,7 +13,7 @@
//-------------------------------------
#define VERSION_MAJOR 0
#define VERSION_MINOR 8
#define VERSION_PATCH 151
#define VERSION_PATCH 152
//-------------------------------------
typedef struct {
uint8_t ch;

30
src/platformio.ini

@ -152,18 +152,18 @@ monitor_filters =
esp8266_exception_decoder
[env:esp32-wroom32-minimal]
platform = espressif32@6.7.0
platform = espressif32@6.9.0
board = lolin_d32
lib_deps =
${env.lib_deps}
https://github.com/mathieucarbou/ESPAsyncWebServer#v3.3.7
https://github.com/mathieucarbou/ESPAsyncWebServer#v3.3.12
build_flags = ${env.build_flags}
-DSPI_HAL
monitor_filters =
esp32_exception_decoder
[env:esp32-wroom32]
platform = espressif32@6.7.0
platform = espressif32@6.9.0
board = lolin_d32
lib_deps = ${env:esp32-wroom32-minimal.lib_deps}
build_flags = ${env:esp32-wroom32-minimal.build_flags}
@ -193,7 +193,7 @@ monitor_filters =
esp32_exception_decoder
[env:esp32-wroom32-de]
platform = espressif32@6.7.0
platform = espressif32@6.9.0
board = lolin_d32
lib_deps = ${env:esp32-wroom32-minimal.lib_deps}
build_flags = ${env:esp32-wroom32.build_flags}
@ -202,7 +202,7 @@ monitor_filters =
esp32_exception_decoder
[env:esp32-wroom32-prometheus]
platform = espressif32@6.7.0
platform = espressif32@6.9.0
board = lolin_d32
lib_deps = ${env:esp32-wroom32-minimal.lib_deps}
build_flags = ${env:esp32-wroom32.build_flags}
@ -211,7 +211,7 @@ monitor_filters =
esp32_exception_decoder
[env:esp32-wroom32-prometheus-de]
platform = espressif32@6.7.0
platform = espressif32@6.9.0
board = lolin_d32
lib_deps = ${env:esp32-wroom32-minimal.lib_deps}
build_flags = ${env:esp32-wroom32-prometheus.build_flags}
@ -220,7 +220,7 @@ monitor_filters =
esp32_exception_decoder
[env:esp32-s2-mini]
platform = espressif32@6.7.0
platform = espressif32@6.9.0
board = lolin_s2_mini
lib_deps = ${env:esp32-wroom32-minimal.lib_deps}
build_flags = ${env.build_flags}
@ -244,7 +244,7 @@ monitor_filters =
esp32_exception_decoder
[env:esp32-s2-mini-de]
platform = espressif32@6.7.0
platform = espressif32@6.9.0
board = lolin_s2_mini
lib_deps = ${env:esp32-wroom32-minimal.lib_deps}
build_flags = ${env:esp32-s2-mini.build_flags}
@ -253,7 +253,7 @@ monitor_filters =
esp32_exception_decoder
[env:esp32-c3-mini]
platform = espressif32@6.7.0
platform = espressif32@6.9.0
board = lolin_c3_mini
lib_deps = ${env:esp32-wroom32-minimal.lib_deps}
build_flags = ${env.build_flags}
@ -277,7 +277,7 @@ monitor_filters =
esp32_exception_decoder
[env:esp32-c3-mini-de]
platform = espressif32@6.7.0
platform = espressif32@6.9.0
board = lolin_c3_mini
lib_deps = ${env:esp32-wroom32-minimal.lib_deps}
build_flags = ${env:esp32-c3-mini.build_flags}
@ -286,7 +286,7 @@ monitor_filters =
esp32_exception_decoder
[env:opendtufusion-minimal]
platform = espressif32@6.7.0
platform = espressif32@6.9.0
board = esp32-s3-devkitc-1
upload_protocol = esp-builtin
lib_deps = ${env:esp32-wroom32-minimal.lib_deps}
@ -312,7 +312,7 @@ monitor_filters =
esp32_exception_decoder, colorize
[env:opendtufusion]
platform = espressif32@6.7.0
platform = espressif32@6.9.0
board = esp32-s3-devkitc-1
upload_protocol = esp-builtin
lib_deps = ${env:esp32-wroom32-minimal.lib_deps}
@ -331,7 +331,7 @@ monitor_filters =
esp32_exception_decoder, colorize
[env:opendtufusion-de]
platform = espressif32@6.7.0
platform = espressif32@6.9.0
board = esp32-s3-devkitc-1
upload_protocol = esp-builtin
lib_deps = ${env:esp32-wroom32-minimal.lib_deps}
@ -341,7 +341,7 @@ monitor_filters =
esp32_exception_decoder, colorize
[env:opendtufusion-16MB]
platform = espressif32@6.7.0
platform = espressif32@6.9.0
board = esp32-s3-devkitc-1
board_upload.flash_size = 16MB
board_build.partitions = default_16MB.csv
@ -352,7 +352,7 @@ monitor_filters =
esp32_exception_decoder, colorize
[env:opendtufusion-16MB-de]
platform = espressif32@6.7.0
platform = espressif32@6.9.0
board = esp32-s3-devkitc-1
upload_protocol = esp-builtin
lib_deps = ${env:esp32-wroom32-minimal.lib_deps}

Loading…
Cancel
Save