platform: arduino: mqtt: use streamutils buffering for faster mqtt sending
This commit is contained in:
parent
f224a1755e
commit
418e13b797
@ -1,6 +1,7 @@
|
|||||||
#include "MQTTTelemetry.h"
|
#include "MQTTTelemetry.h"
|
||||||
|
|
||||||
#include <ArduinoJson.h>
|
#include <ArduinoJson.h>
|
||||||
|
#include <StreamUtils.h>
|
||||||
|
|
||||||
#include "../../Static.h"
|
#include "../../Static.h"
|
||||||
#include "../../Config.h"
|
#include "../../Config.h"
|
||||||
@ -340,7 +341,9 @@ void
|
|||||||
MQTTTelemetry::publishDoc(const char* topic, bool retain)
|
MQTTTelemetry::publishDoc(const char* topic, bool retain)
|
||||||
{
|
{
|
||||||
m_mqtt.beginPublish(topic, measureJson(m_json), 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();
|
m_mqtt.endPublish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user