From 9609e9fb85401044840d4799b46cf3b3f73e0dff Mon Sep 17 00:00:00 2001 From: Gunnar Skjold Date: Thu, 26 Mar 2026 14:39:33 +0100 Subject: [PATCH] Fixed ESP8266 build errors --- lib/AmsMqttHandler/src/AmsMqttHandler.cpp | 2 +- lib/JsonMqttHandler/src/JsonMqttHandler.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/AmsMqttHandler/src/AmsMqttHandler.cpp b/lib/AmsMqttHandler/src/AmsMqttHandler.cpp index 7aeeea43..26e935a2 100644 --- a/lib/AmsMqttHandler/src/AmsMqttHandler.cpp +++ b/lib/AmsMqttHandler/src/AmsMqttHandler.cpp @@ -149,7 +149,7 @@ bool AmsMqttHandler::connect() { debugger->printf_P(PSTR("Failed to connect to MQTT: %d\n"), mqtt.lastError()); #if defined(ESP8266) if(mqttSecureClient) { - mqttSecureClient->getLastSSLError((char*) json, BufferSize); + mqttSecureClient->getLastSSLError((char*) json, BUF_SIZE_COMMON); debugger->println((char*) json); } #endif diff --git a/lib/JsonMqttHandler/src/JsonMqttHandler.cpp b/lib/JsonMqttHandler/src/JsonMqttHandler.cpp index cc38f5ed..145be3f7 100644 --- a/lib/JsonMqttHandler/src/JsonMqttHandler.cpp +++ b/lib/JsonMqttHandler/src/JsonMqttHandler.cpp @@ -555,6 +555,7 @@ void JsonMqttHandler::onMessage(String &topic, String &payload) { AmsJsonGenerator::generateMonthPlotJson(ds, json, BUF_SIZE_COMMON); bool ret = mqtt.publish(pubTopic, json); loop(); + #if defined(ESP32) } else if(strcmp_P(action, PSTR("getconfig")) == 0) { char pubTopic[192]; snprintf_P(pubTopic, 192, PSTR("%s/config"), mqttConfig.publishTopic); @@ -564,6 +565,7 @@ void JsonMqttHandler::onMessage(String &topic, String &payload) { } else if(strcmp_P(action, PSTR("setconfig")) == 0 && obj.containsKey(F("config"))) { JsonObject configObj = obj[F("config")]; handleConfigMessage(configObj); + #endif } } } @@ -587,6 +589,7 @@ void JsonMqttHandler::onMessage(String &topic, String &payload) { } } +#if defined(ESP32) void JsonMqttHandler::handleConfigMessage(JsonObject& configObj) { // General if(configObj.containsKey(F("g"))) { @@ -1133,6 +1136,7 @@ void JsonMqttHandler::handleConfigMessage(JsonObject& configObj) { } } } +#endif void JsonMqttHandler::toJsonIsoTimestamp(time_t t, char* buf, size_t buflen) { memset(buf, 0, buflen);