change queue size for standalone

This commit is contained in:
proddy
2020-11-14 15:41:05 +01:00
parent af08bc607d
commit b51dfae718
2 changed files with 9 additions and 8 deletions

View File

@@ -181,7 +181,7 @@ void Mqtt::show_mqtt(uuid::console::Shell & shell) {
return;
}
shell.printfln(F("MQTT queue (%d messages):"), mqtt_messages_.size());
shell.printfln(F("MQTT queue (%d/%d messages):"), mqtt_messages_.size(), MAX_MQTT_MESSAGES);
for (const auto & message : mqtt_messages_) {
auto content = message.content_;
@@ -730,7 +730,6 @@ void Mqtt::register_mqtt_ha_binary_sensor(const __FlashStringHelper * name, cons
// delay(MQTT_PUBLISH_WAIT);
delay(50);
}
// HA config for a normal 'sensor' type
@@ -826,6 +825,5 @@ void Mqtt::register_mqtt_ha_sensor(const char * prefix,
// delay(MQTT_PUBLISH_WAIT); // don't flood asynctcp
delay(50); // enough time to send the short message out
}
} // namespace emsesp

View File

@@ -171,11 +171,14 @@ class Mqtt {
static std::list<QueuedMqttMessage> mqtt_messages_;
static AsyncMqttClient * mqttClient_;
// static size_t maximum_mqtt_messages_;
static uint16_t mqtt_message_id_;
#if defined(EMSESP_STANDALONE)
static constexpr size_t MAX_MQTT_MESSAGES = 70; // size of queue
#else
static constexpr size_t MAX_MQTT_MESSAGES = 20; // size of queue
#endif
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