platform: arduino: mqtt: use streamutils buffering for faster mqtt sending

This commit is contained in:
Torrie Fischer 2023-12-23 11:08:52 +01:00
parent f224a1755e
commit 418e13b797

View File

@ -1,6 +1,7 @@
#include "MQTTTelemetry.h"
#include <ArduinoJson.h>
#include <StreamUtils.h>
#include "../../Static.h"
#include "../../Config.h"
@ -340,7 +341,9 @@ void
MQTTTelemetry::publishDoc(const char* topic, bool retain)
{
m_mqtt.beginPublish(topic, measureJson(m_json), retain);
serializeJson(m_json, m_mqtt);
BufferingPrint buf(m_mqtt, 64);
serializeJson(m_json, buf);
buf.flush();
m_mqtt.endPublish();
}