diff --git a/Makefile b/Makefile index e2ff47a4a..e39169edb 100644 --- a/Makefile +++ b/Makefile @@ -23,15 +23,17 @@ LIBRARIES := CPPCHECK = cppcheck # CHECKFLAGS = -q --force --std=c++17 -CHECKFLAGS = -q --force --std=c++11 -pthread +CHECKFLAGS = -q --force --std=c++11 #---------------------------------------------------------------------- # Languages Standard #---------------------------------------------------------------------- -# C_STANDARD := -std=c17 +C_STANDARD := -std=c17 # CXX_STANDARD := -std=c++17 -C_STANDARD := -std=c11 -CXX_STANDARD := -std=c++11 +CXX_STANDARD := -std=gnu++11 + +# C_STANDARD := -std=c11 +# CXX_STANDARD := -std=c++11 #---------------------------------------------------------------------- # Defined Symbols @@ -79,7 +81,7 @@ CPPFLAGS += -g3 CPPFLAGS += -Os CFLAGS += $(CPPFLAGS) -CFLAGS += -Wall -Wextra -Werror -Wswitch-enum -Wno-unused-parameter +CFLAGS += -Wall -Wextra -Werror -Wswitch-enum -Wno-unused-parameter -Wno-inconsistent-missing-override -Wno-missing-braces -Wno-unused-lambda-capture CXXFLAGS += $(CFLAGS) -MMD diff --git a/interface/index.html b/interface/index.html index 602add36a..462186dc0 100644 --- a/interface/index.html +++ b/interface/index.html @@ -1,4 +1,4 @@ - + diff --git a/interface/package.json b/interface/package.json index 70b5d9796..08b84ca52 100644 --- a/interface/package.json +++ b/interface/package.json @@ -53,7 +53,7 @@ "@typescript-eslint/eslint-plugin": "^6.0.0", "@typescript-eslint/parser": "^6.0.0", "cspell": "^6.31.1", - "eslint": "^8.44.0", + "eslint": "^8.45.0", "eslint-config-airbnb": "^19.0.4", "eslint-config-airbnb-typescript": "^17.1.0", "eslint-config-prettier": "^8.8.0", diff --git a/interface/yarn.lock b/interface/yarn.lock index 8deea2580..ece5f3f7d 100644 --- a/interface/yarn.lock +++ b/interface/yarn.lock @@ -1967,7 +1967,7 @@ __metadata: alova: ^2.9.2 async-validator: ^4.2.5 cspell: ^6.31.1 - eslint: ^8.44.0 + eslint: ^8.45.0 eslint-config-airbnb: ^19.0.4 eslint-config-airbnb-typescript: ^17.1.0 eslint-config-prettier: ^8.8.0 @@ -3488,9 +3488,9 @@ __metadata: languageName: node linkType: hard -"eslint@npm:^8.44.0": - version: 8.44.0 - resolution: "eslint@npm:8.44.0" +"eslint@npm:^8.45.0": + version: 8.45.0 + resolution: "eslint@npm:8.45.0" dependencies: "@eslint-community/eslint-utils": ^4.2.0 "@eslint-community/regexpp": ^4.4.0 @@ -3517,7 +3517,6 @@ __metadata: globals: ^13.19.0 graphemer: ^1.4.0 ignore: ^5.2.0 - import-fresh: ^3.0.0 imurmurhash: ^0.1.4 is-glob: ^4.0.0 is-path-inside: ^3.0.3 @@ -3529,11 +3528,10 @@ __metadata: natural-compare: ^1.4.0 optionator: ^0.9.3 strip-ansi: ^6.0.1 - strip-json-comments: ^3.1.0 text-table: ^0.2.0 bin: eslint: bin/eslint.js - checksum: a31ca4571a67012629936d891141a4a5747d5902fb7f4e10119a5acd632e0976b9ba1b761d8c81cff8a9cc3e796df2c56f86c02535fd977de962a98ce585624a + checksum: 2a043b8d3b9a5684e2f66bd446c3dc8522cc7afbb0982d0a5be76ea1f578d0e617598a7b289616a861ab8272b57f6056acb2b264bec6302c9b0921a1cfa66fdb languageName: node linkType: hard @@ -4254,7 +4252,7 @@ __metadata: languageName: node linkType: hard -"import-fresh@npm:^3.0.0, import-fresh@npm:^3.2.1, import-fresh@npm:^3.3.0": +"import-fresh@npm:^3.2.1, import-fresh@npm:^3.3.0": version: 3.3.0 resolution: "import-fresh@npm:3.3.0" dependencies: @@ -6406,7 +6404,7 @@ __metadata: languageName: node linkType: hard -"strip-json-comments@npm:^3.1.0, strip-json-comments@npm:^3.1.1": +"strip-json-comments@npm:^3.1.1": version: 3.1.1 resolution: "strip-json-comments@npm:3.1.1" checksum: 9681a6257b925a7fa0f285851c0e613cc934a50661fa7bb41ca9cbbff89686bb4a0ee366e6ecedc4daafd01e83eee0720111ab294366fe7c185e935475ebcecd diff --git a/lib/PButton/PButon.cpp b/lib/PButton/PButon.cpp index a19fe96df..28eb41f0f 100644 --- a/lib/PButton/PButon.cpp +++ b/lib/PButton/PButon.cpp @@ -54,7 +54,7 @@ bool PButton::init(uint8_t pin, bool pullMode) { #if defined(ESP32) pinMode(pin_, pullMode ? INPUT_PULLUP : INPUT_PULLDOWN); -#else // esp8266 and standalone +#else // esp8266 and standalone pinMode(pin_, pullMode ? INPUT_PULLUP : INPUT); #endif enabled_ = (digitalRead(pin_) == pullMode); // see if a button is connected diff --git a/lib/PButton/PButton.h b/lib/PButton/PButton.h index 16899ff49..d7be73447 100644 --- a/lib/PButton/PButton.h +++ b/lib/PButton/PButton.h @@ -47,21 +47,21 @@ class PButton { bool pullMode_; bool enabled_; - bool state_; // Value read from button - bool lastState_; // Last value of button state - bool dblClickWaiting_; // whether we're waiting for a double click (down) - bool dblClickOnNextUp_; // whether to register a double click on next release, or whether to wait and click - bool singleClickOK_; // whether it's OK to do a single click + bool state_; // Value read from button + bool lastState_; // Last value of button state + bool dblClickWaiting_; // whether we're waiting for a double click (down) + bool dblClickOnNextUp_; // whether to register a double click on next release, or whether to wait and click + bool singleClickOK_; // whether it's OK to do a single click - uint32_t downTime_; // time the button was pressed down - uint32_t upTime_; // time the button was released + uint32_t downTime_; // time the button was pressed down + uint32_t upTime_; // time the button was released bool ignoreUP_; // whether to ignore the button release because the click+hold was triggered bool waitForUP_; // when held, whether to wait for the up event bool longPressHappened_; // whether or not the hold event happened already bool vLongPressHappened_; // whether or not the long hold event happened already - bool buttonBusy_; // false if idle + bool buttonBusy_; // false if idle buttonEventHandler cb_onClick, cb_onDblClick, cb_onLongPress, cb_onVLongPress; }; diff --git a/lib/espMqttClient/src/MqttClient.cpp b/lib/espMqttClient/src/MqttClient.cpp index f93bb78f5..a428158ed 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) { // modified by proddy for EMS-ESP compiling standalone 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..d09db68c5 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; // modified by proddy for EMS-ESP compiling standalone #endif uint8_t _rxBuffer[EMC_RX_BUFFER_SIZE]; diff --git a/lib/espMqttClient/src/Transport/ClientPosix.cpp b/lib/espMqttClient/src/Transport/ClientPosix.cpp index 83b555d1b..edccad065 100644 --- a/lib/espMqttClient/src/Transport/ClientPosix.cpp +++ b/lib/espMqttClient/src/Transport/ClientPosix.cpp @@ -38,7 +38,7 @@ bool ClientPosix::connect(IPAddress ip, uint16_t port) { memset(&_host, 0, sizeof(_host)); _host.sin_family = AF_INET; _host.sin_addr.s_addr = htonl(uint32_t(ip)); - _host.sin_port = ::htons(port); + _host.sin_port = htons(port); // modified by proddy for EMS-ESP compiling standalone int ret = ::connect(_sockfd, (struct sockaddr *)&_host, sizeof(_host)); diff --git a/lib/framework/APSettingsService.cpp b/lib/framework/APSettingsService.cpp index 4c3c7994d..d4811be01 100644 --- a/lib/framework/APSettingsService.cpp +++ b/lib/framework/APSettingsService.cpp @@ -1,6 +1,6 @@ #include -#include "../../src/emsesp_stub.hpp" // proddy added +#include "../../src/emsesp_stub.hpp" APSettingsService::APSettingsService(AsyncWebServer * server, FS * fs, SecurityManager * securityManager) : _httpEndpoint(APSettings::read, APSettings::update, this, server, AP_SETTINGS_SERVICE_PATH, securityManager) diff --git a/lib/framework/FactoryResetService.cpp b/lib/framework/FactoryResetService.cpp index 46a6443d8..02045421a 100644 --- a/lib/framework/FactoryResetService.cpp +++ b/lib/framework/FactoryResetService.cpp @@ -18,10 +18,7 @@ void FactoryResetService::handleRequest(AsyncWebServerRequest * request) { * Delete function assumes that all files are stored flat, within the config directory. */ void FactoryResetService::factoryReset() { - /* - * Based on LittleFS. Modified by proddy - * Could be replaced with fs.rmdir(FS_CONFIG_DIRECTORY) in IDF 4.2 - */ + // TODO Could be replaced with fs.rmdir(FS_CONFIG_DIRECTORY) in IDF 4.2 File root = fs->open(FS_CONFIG_DIRECTORY); File file; while (file = root.openNextFile()) { diff --git a/lib/framework/FeaturesService.cpp b/lib/framework/FeaturesService.cpp index 5dceb1a66..f8a82f441 100644 --- a/lib/framework/FeaturesService.cpp +++ b/lib/framework/FeaturesService.cpp @@ -1,7 +1,7 @@ #include -#include "../../src/emsesp_stub.hpp" // proddy added +#include "../../src/emsesp_stub.hpp" -using namespace std::placeholders; // for `_1` etc +using namespace std::placeholders; // for `_1` etc FeaturesService::FeaturesService(AsyncWebServer * server) { server->on(FEATURES_SERVICE_PATH, HTTP_GET, std::bind(&FeaturesService::features, this, _1)); diff --git a/lib/framework/HttpEndpoint.h b/lib/framework/HttpEndpoint.h index 0e0014049..448d36b46 100644 --- a/lib/framework/HttpEndpoint.h +++ b/lib/framework/HttpEndpoint.h @@ -115,7 +115,7 @@ class HttpPostEndpoint { response->setLength(); if (outcome == StateUpdateResult::CHANGED_RESTART) { - response->setCode(205); // added by proddy, reboot required + response->setCode(205); // reboot required } request->send(response); } diff --git a/lib/framework/MqttSettingsService.cpp b/lib/framework/MqttSettingsService.cpp index aef0d014d..e6c0caec7 100644 --- a/lib/framework/MqttSettingsService.cpp +++ b/lib/framework/MqttSettingsService.cpp @@ -1,8 +1,8 @@ #include -#include "../../src/emsesp_stub.hpp" // proddy added +#include "../../src/emsesp_stub.hpp" -using namespace std::placeholders; // for `_1` etc +using namespace std::placeholders; // for `_1` etc /** * Retains a copy of the cstr provided in the pointer provided using dynamic allocation. @@ -144,7 +144,6 @@ void MqttSettingsService::onConfigUpdated() { _reconfigureMqtt = true; _disconnectedAt = 0; - // added by proddy startClient(); emsesp::EMSESP::mqtt_.start(); // reload EMS-ESP MQTT settings } @@ -231,7 +230,6 @@ void MqttSettings::read(MqttSettings & settings, JsonObject & root) { root["clean_session"] = settings.cleanSession; root["entity_format"] = settings.entity_format; - // added by proddy for EMS-ESP root["publish_time_boiler"] = settings.publish_time_boiler; root["publish_time_thermostat"] = settings.publish_time_thermostat; root["publish_time_solar"] = settings.publish_time_solar; diff --git a/lib/framework/MqttSettingsService.h b/lib/framework/MqttSettingsService.h index e13b4f4c8..90d1a53c7 100644 --- a/lib/framework/MqttSettingsService.h +++ b/lib/framework/MqttSettingsService.h @@ -76,7 +76,7 @@ class MqttSettings { uint16_t keepAlive; bool cleanSession; - // proddy EMS-ESP specific + // EMS-ESP specific String base; uint16_t publish_time_boiler; uint16_t publish_time_thermostat; diff --git a/lib/framework/MqttStatus.cpp b/lib/framework/MqttStatus.cpp index c5ff2a05c..2a12ac16f 100644 --- a/lib/framework/MqttStatus.cpp +++ b/lib/framework/MqttStatus.cpp @@ -1,6 +1,6 @@ #include -#include "../../src/emsesp_stub.hpp" // proddy added +#include "../../src/emsesp_stub.hpp" using namespace std::placeholders; // for `_1` etc @@ -20,9 +20,9 @@ void MqttStatus::mqttStatus(AsyncWebServerRequest * request) { root["client_id"] = _mqttSettingsService->getClientId(); root["disconnect_reason"] = (uint8_t)_mqttSettingsService->getDisconnectReason(); - root["mqtt_queued"] = emsesp::Mqtt::publish_queued(); // mdvp added - root["mqtt_fails"] = emsesp::Mqtt::publish_fails(); // proddy added - root["connect_count"] = emsesp::Mqtt::connect_count(); // mdvp added + root["mqtt_queued"] = emsesp::Mqtt::publish_queued(); + root["mqtt_fails"] = emsesp::Mqtt::publish_fails(); + root["connect_count"] = emsesp::Mqtt::connect_count(); response->setLength(); request->send(response); diff --git a/lib/framework/NTPSettingsService.cpp b/lib/framework/NTPSettingsService.cpp index 61ec95020..5d4529d96 100644 --- a/lib/framework/NTPSettingsService.cpp +++ b/lib/framework/NTPSettingsService.cpp @@ -1,7 +1,7 @@ #include #include -#include "../../src/emsesp_stub.hpp" // proddy added +#include "../../src/emsesp_stub.hpp" using namespace std::placeholders; // for `_1` etc diff --git a/lib/framework/NTPStatus.cpp b/lib/framework/NTPStatus.cpp index 9433d6253..069814dfa 100644 --- a/lib/framework/NTPStatus.cpp +++ b/lib/framework/NTPStatus.cpp @@ -1,5 +1,5 @@ #include -#include "../../src/emsesp_stub.hpp" // proddy added +#include "../../src/emsesp_stub.hpp" using namespace std::placeholders; // for `_1` etc diff --git a/lib/framework/NetworkSettingsService.cpp b/lib/framework/NetworkSettingsService.cpp index 23428d2f4..da89434b3 100644 --- a/lib/framework/NetworkSettingsService.cpp +++ b/lib/framework/NetworkSettingsService.cpp @@ -69,7 +69,7 @@ void NetworkSettingsService::manageSTA() { esp_wifi_set_bandwidth((wifi_interface_t)ESP_IF_WIFI_STA, WIFI_BW_HT40); } if (networkSettings.nosleep) { - WiFi.setSleep(false); // turn off sleep - WIFI_PS_NONE + WiFi.setSleep(false); // turn off sleep - WIFI_PS_NONE } WiFi.begin(_state.ssid.c_str(), _state.password.c_str()); // attempt to connect to the network esp_wifi_set_max_tx_power(networkSettings.tx_power * 4); // set power after wifi is startet for C3 diff --git a/lib/framework/NetworkStatus.cpp b/lib/framework/NetworkStatus.cpp index 8a999c46e..6aea4580f 100644 --- a/lib/framework/NetworkStatus.cpp +++ b/lib/framework/NetworkStatus.cpp @@ -1,6 +1,6 @@ #include -#include "../../src/emsesp_stub.hpp" // proddy added +#include "../../src/emsesp_stub.hpp" using namespace std::placeholders; // for `_1` etc diff --git a/lib/framework/OTASettingsService.cpp b/lib/framework/OTASettingsService.cpp index 3fb20eeee..c20f4cadd 100644 --- a/lib/framework/OTASettingsService.cpp +++ b/lib/framework/OTASettingsService.cpp @@ -1,6 +1,6 @@ #include -#include "../../src/emsesp_stub.hpp" // proddy added +#include "../../src/emsesp_stub.hpp" using namespace std::placeholders; // for `_1` etc diff --git a/lib/framework/SecuritySettingsService.cpp b/lib/framework/SecuritySettingsService.cpp index 87f7fbc95..5427a2fa8 100644 --- a/lib/framework/SecuritySettingsService.cpp +++ b/lib/framework/SecuritySettingsService.cpp @@ -2,7 +2,7 @@ #if FT_ENABLED(FT_SECURITY) -#include "../../src/emsesp_stub.hpp" // proddy added +#include "../../src/emsesp_stub.hpp" SecuritySettingsService::SecuritySettingsService(AsyncWebServer * server, FS * fs) : _httpEndpoint(SecuritySettings::read, SecuritySettings::update, this, server, SECURITY_SETTINGS_PATH, this) diff --git a/lib/framework/StatefulService.h b/lib/framework/StatefulService.h index 01943088d..7ee72e0a0 100644 --- a/lib/framework/StatefulService.h +++ b/lib/framework/StatefulService.h @@ -19,7 +19,7 @@ enum class StateUpdateResult { CHANGED = 0, // The update changed the state and propagation should take place if required - CHANGED_RESTART, // a restart of the device is needed - added by proddy + CHANGED_RESTART, // a restart of the device is needed UNCHANGED, // The state was unchanged, propagation should not take place ERROR // There was a problem updating the state, propagation should not take place }; diff --git a/lib/framework/SystemStatus.cpp b/lib/framework/SystemStatus.cpp index 53bafdb22..10c7a7856 100644 --- a/lib/framework/SystemStatus.cpp +++ b/lib/framework/SystemStatus.cpp @@ -1,7 +1,7 @@ #include #include -#include "../../src/emsesp_stub.hpp" // proddy added +#include "../../src/emsesp_stub.hpp" using namespace std::placeholders; // for `_1` etc @@ -39,7 +39,7 @@ void SystemStatus::systemStatus(AsyncWebServerRequest * request) { const esp_partition_t * partition = esp_partition_find_first(ESP_PARTITION_TYPE_APP, ESP_PARTITION_SUBTYPE_APP_FACTORY, NULL); if (partition != NULL) { // factory partition found root["has_loader"] = true; - } else { // check for not empty, smaller OTA partition + } else { // check for not empty, smaller OTA partition partition = esp_ota_get_next_update_partition(NULL); if (partition) { uint64_t buffer; diff --git a/lib/uuid-common/src/get_uptime_ms.cpp b/lib/uuid-common/src/get_uptime_ms.cpp index 48e5fe3c9..c995341e4 100644 --- a/lib/uuid-common/src/get_uptime_ms.cpp +++ b/lib/uuid-common/src/get_uptime_ms.cpp @@ -22,7 +22,6 @@ namespace uuid { -// added by proddy for EMS-ESP static uint64_t now_millis = 0; // returns system uptime in seconds diff --git a/lib/uuid-common/src/loop.cpp b/lib/uuid-common/src/loop.cpp index 389c52350..d4969cb8f 100644 --- a/lib/uuid-common/src/loop.cpp +++ b/lib/uuid-common/src/loop.cpp @@ -21,7 +21,7 @@ namespace uuid { void loop() { - set_uptime(); // added by proddy + set_uptime(); } } // namespace uuid diff --git a/lib/uuid-common/src/uuid/common.h b/lib/uuid-common/src/uuid/common.h index 6184ef971..ae0baee64 100644 --- a/lib/uuid-common/src/uuid/common.h +++ b/lib/uuid-common/src/uuid/common.h @@ -102,8 +102,8 @@ void loop(); */ uint64_t get_uptime_ms(); -uint32_t get_uptime(); // added by proddy for EMS-ESP -uint32_t get_uptime_sec(); // added by proddy for EMS-ESP +uint32_t get_uptime(); +uint32_t get_uptime_sec(); void set_uptime(); diff --git a/lib/uuid-console/src/shell_prompt.cpp b/lib/uuid-console/src/shell_prompt.cpp index 576756296..a6130f1be 100644 --- a/lib/uuid-console/src/shell_prompt.cpp +++ b/lib/uuid-console/src/shell_prompt.cpp @@ -65,7 +65,6 @@ void Shell::display_prompt() { std::string context = context_text(); print(prompt_prefix()); - // colors added by proddy if (!hostname.empty()) { print(COLOR_BRIGHT_GREEN); print(COLOR_BOLD_ON); @@ -78,7 +77,6 @@ void Shell::display_prompt() { print(COLOR_BOLD_ON); print(context); print(COLOR_RESET); - // print(' '); } print(prompt_suffix()); print(' '); diff --git a/lib/uuid-syslog/src/syslog.cpp b/lib/uuid-syslog/src/syslog.cpp index d97ca7540..313da45b6 100644 --- a/lib/uuid-syslog/src/syslog.cpp +++ b/lib/uuid-syslog/src/syslog.cpp @@ -365,7 +365,7 @@ bool SyslogService::can_transmit() { #endif if (!emsesp::EMSESP::system_.network_connected()) { - return false; // added by proddy. Check Ethernet + return false; } const uint64_t now = uuid::get_uptime_ms(); diff --git a/lib_standalone/FS.h b/lib_standalone/FS.h index c7a7b056d..d85355f22 100644 --- a/lib_standalone/FS.h +++ b/lib_standalone/FS.h @@ -61,11 +61,11 @@ class File : public Stream { bool seek(uint32_t pos) { return seek(pos, SeekSet); } - size_t position() const; - size_t size() const; - bool setBufferSize(size_t size); - void close(); - operator bool() const; + size_t position() const; + size_t size() const; + bool setBufferSize(size_t size); + void close(); + operator bool() const; time_t getLastWrite(); const char * path() const; const char * name() const; diff --git a/lib_standalone/Stream.h b/lib_standalone/Stream.h index fad3ac00d..0153703be 100644 --- a/lib_standalone/Stream.h +++ b/lib_standalone/Stream.h @@ -91,7 +91,7 @@ class Stream : public Print { // initial characters that are not digits (or the minus sign) are skipped // integer is terminated by the first character that is not a digit. - float parseFloat(); // float version of parseInt + float parseFloat(); // float version of parseInt virtual size_t readBytes(char * buffer, size_t length) // read chars from stream into buffer { diff --git a/platformio.ini b/platformio.ini index 4b9a078cb..ac5673075 100644 --- a/platformio.ini +++ b/platformio.ini @@ -144,12 +144,13 @@ build_flags = ${common.build_flags} -O2 platform = native build_flags = -DARDUINOJSON_ENABLE_STD_STRING=1 -DARDUINOJSON_ENABLE_PROGMEM=1 -DARDUINOJSON_ENABLE_ARDUINO_STRING -DARDUINOJSON_USE_DOUBLE=0 - -DEMSESP_DEBUG -DEMSESP_STANDALONE -DEMSESP_TEST + -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++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 -I./lib_standalone -I./lib/ArduinoJson/src -I./lib/uuid-common/src diff --git a/src/mqtt.cpp b/src/mqtt.cpp index ef2f4d061..f3a4cdfcb 100644 --- a/src/mqtt.cpp +++ b/src/mqtt.cpp @@ -210,13 +210,18 @@ void Mqtt::incoming(const char * topic, const char * payload) { // received an MQTT message that we subscribed too // topic is the full path // payload is json or a single string and converted to a json with key 'value' -void Mqtt::on_message(const char * topic, const char * payload, size_t len) const { +void Mqtt::on_message(const char * topic, const char * message, size_t len) const { + // This causes a compile error "error: variable-sized object may not be initialized" + // so commenting out and assuming with the new mqtt lib it's always null terminated + + /* // sometimes the payload is not terminated correctly, so make a copy // convert payload to a null-terminated char string char message[len + 2] = {'\0'}; if (payload != nullptr) { strlcpy(message, payload, len + 1); } + */ #if defined(EMSESP_DEBUG) if (len) { diff --git a/src/mqtt.h b/src/mqtt.h index dc530c25c..edc4377a9 100644 --- a/src/mqtt.h +++ b/src/mqtt.h @@ -251,7 +251,7 @@ class Mqtt { static std::vector mqtt_subfunctions_; // list of mqtt subscribe callbacks for all devices - uint32_t last_mqtt_poll_ = 0; + // uint32_t last_mqtt_poll_ = 0; uint32_t last_publish_boiler_ = 0; uint32_t last_publish_thermostat_ = 0; uint32_t last_publish_solar_ = 0; @@ -259,7 +259,7 @@ class Mqtt { uint32_t last_publish_other_ = 0; uint32_t last_publish_sensor_ = 0; uint32_t last_publish_heartbeat_ = 0; - uint32_t last_publish_queue_ = 0; + // uint32_t last_publish_queue_ = 0; static bool connecting_; static bool initialized_;