From 98dd25c5bb63dfe9637672bd360f7c02c293f098 Mon Sep 17 00:00:00 2001 From: Proddy Date: Sat, 15 Jul 2023 11:00:04 +0200 Subject: [PATCH] make EMS-ESP compile standalone on osx/darwin and linux --- Makefile | 2 +- lib/espMqttClient/src/MqttClient.cpp | 2 +- lib/espMqttClient/src/MqttClient.h | 3 +-- platformio.ini | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 236667ad7..e39169edb 100644 --- a/Makefile +++ b/Makefile @@ -30,7 +30,7 @@ CHECKFLAGS = -q --force --std=c++11 #---------------------------------------------------------------------- C_STANDARD := -std=c17 # CXX_STANDARD := -std=c++17 -CXX_STANDARD := -std=gnu++17 +CXX_STANDARD := -std=gnu++11 # C_STANDARD := -std=c11 # CXX_STANDARD := -std=c++11 diff --git a/lib/espMqttClient/src/MqttClient.cpp b/lib/espMqttClient/src/MqttClient.cpp index f93bb78f5..b5bc827eb 100644 --- a/lib/espMqttClient/src/MqttClient.cpp +++ b/lib/espMqttClient/src/MqttClient.cpp @@ -197,7 +197,7 @@ const char * MqttClient::getClientId() const { } void MqttClient::loop() { - switch (_state) { + switch ((State)_state) { // TOOD modified by proddy for EMS-ESP compiling on osx case State::disconnected: #if defined(ARDUINO_ARCH_ESP32) if (_useInternalTask == espMqttClientTypes::UseInternalTask::YES) { diff --git a/lib/espMqttClient/src/MqttClient.h b/lib/espMqttClient/src/MqttClient.h index dbcf7ec5b..24bbeadc0 100644 --- a/lib/espMqttClient/src/MqttClient.h +++ b/lib/espMqttClient/src/MqttClient.h @@ -123,8 +123,7 @@ class MqttClient { #elif defined(ARDUINO_ARCH_ESP8266) && EMC_ESP8266_MULTITHREADING std::atomic _xSemaphore = false; #elif defined(__linux__) - // added mutable to compile EMS-ESP standalone - mutable std::mutex mtx; + mutable std::mutex mtx; // TOOD modified by proddy for EMS-ESP #endif uint8_t _rxBuffer[EMC_RX_BUFFER_SIZE]; diff --git a/platformio.ini b/platformio.ini index 7e72571b5..ac5673075 100644 --- a/platformio.ini +++ b/platformio.ini @@ -147,7 +147,7 @@ build_flags = -DEMSESP_DEBUG -DEMSESP_STANDALONE -DEMSESP_TEST -D__linux__ -DEMSESP_DEFAULT_LOCALE=\"en\" -DEMSESP_DEFAULT_TX_MODE=8 -DEMSESP_DEFAULT_VERSION=\"3.6.0-dev\" -DEMSESP_DEFAULT_BOARD_PROFILE=\"S32\" -lpthread - -std=gnu++17 -Og -ggdb + -std=gnu++11 -Og -ggdb build_src_flags = -Wall -Wextra -Werror -Wswitch-enum -Wno-unused-parameter -Wno-inconsistent-missing-override -Wno-unused-lambda-capture -Wno-missing-braces