From 0439b6f7c4abe467359a9638e5343b60e97de9f4 Mon Sep 17 00:00:00 2001 From: Yurii Date: Sun, 25 Oct 2026 04:50:43 +0300 Subject: [PATCH] perf: replace global buffer with MQTT config URL storage --- src/MqttTask.h | 5 +++-- src/defines.h | 2 -- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/MqttTask.h b/src/MqttTask.h index 41efccf..47ff63d 100644 --- a/src/MqttTask.h +++ b/src/MqttTask.h @@ -79,6 +79,7 @@ protected: MqttClient* client = nullptr; HaHelper* haHelper = nullptr; MqttWriter* writer = nullptr; + char configUrl[64] = {}; UnitSystem currentUnitSystem = UnitSystem::METRIC; bool currentHomeAssistantDiscovery = false; std::unordered_map queueReconfigureSensors; @@ -148,8 +149,8 @@ protected: this->haHelper->setDeviceName(PROJECT_NAME); this->haHelper->setWriter(this->writer); - sprintf(buffer, CONFIG_URL, WiFi.localIP().toString().c_str()); - this->haHelper->setDeviceConfigUrl(buffer); + snprintf(this->configUrl, sizeof(this->configUrl), CONFIG_URL, WiFi.localIP().toString().c_str()); + this->haHelper->setDeviceConfigUrl(this->configUrl); } void loop() { diff --git a/src/defines.h b/src/defines.h index ad6f2e1..9f8ec19 100644 --- a/src/defines.h +++ b/src/defines.h @@ -160,5 +160,3 @@ enum class ChannelDisablingAction : uint8_t { ZERO_SETPOINT = 1, OFF_AND_ZERO_SETPOINT = 2 }; - -char buffer[255];