From 915f961828f169300912dc9f318fd99b79840644 Mon Sep 17 00:00:00 2001 From: proddy Date: Mon, 20 Jul 2020 17:53:19 +0200 Subject: [PATCH] reduce mqtt queue from 50 to 30, to save of heap memory on the ESP8266 --- src/mqtt.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/mqtt.h b/src/mqtt.h index 96c37683f..06b9d3f8d 100644 --- a/src/mqtt.h +++ b/src/mqtt.h @@ -118,13 +118,12 @@ class Mqtt { static AsyncMqttClient * mqttClient_; - static constexpr size_t MAX_MQTT_MESSAGES = 50; - static size_t maximum_mqtt_messages_; - static uint16_t mqtt_message_id_; - static bool mqtt_retain_; + static size_t maximum_mqtt_messages_; + static uint16_t mqtt_message_id_; + static bool mqtt_retain_; - static constexpr uint8_t MQTT_QUEUE_MAX_SIZE = 50; - static constexpr uint32_t MQTT_PUBLISH_WAIT = 250; // delay between sending publishes, to account for large payloads + static constexpr size_t MAX_MQTT_MESSAGES = 30; // size of queue + static constexpr uint32_t MQTT_PUBLISH_WAIT = 200; // delay between sending publishes, to account for large payloads static constexpr uint8_t MQTT_PUBLISH_MAX_RETRY = 3; // max retries for giving up on publishing static void queue_publish_message(const std::string & topic, const std::string & payload, const bool retain);