From 96eb32ca63b2a6d5163f3950d440b00ed5494526 Mon Sep 17 00:00:00 2001 From: lumapu Date: Sun, 19 Mar 2023 13:16:39 +0100 Subject: [PATCH] 0.5.103 merged heap improvements #772 --- src/CHANGES.md | 1 + src/publisher/pubMqtt.h | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/CHANGES.md b/src/CHANGES.md index cf72d38f..dd5f3e5f 100644 --- a/src/CHANGES.md +++ b/src/CHANGES.md @@ -5,6 +5,7 @@ ## 0.5.103 * merged MI improvements, thx @rejoe2 #778 * changed display inverter online message +* merged heap improvements #772 ## 0.5.102 * Warning: old exports are not compatible any more! diff --git a/src/publisher/pubMqtt.h b/src/publisher/pubMqtt.h index d66f5899..e98b1978 100644 --- a/src/publisher/pubMqtt.h +++ b/src/publisher/pubMqtt.h @@ -210,7 +210,7 @@ class PubMqtt { DPRINTLN(DBG_VERBOSE, F("sendMqttDiscoveryConfig")); char topic[64], name[32], uniq_id[32]; - StaticJsonDocument<256> doc; + DynamicJsonDocument doc(256); uint8_t fldTotal[4] = {FLD_PAC, FLD_YT, FLD_YD, FLD_PDC}; const char* unitTotal[4] = {"W", "kWh", "Wh", "W"}; @@ -267,7 +267,7 @@ class PubMqtt { stateCls = getFieldStateClass(fldTotal[i]); } - StaticJsonDocument<512> doc2; + DynamicJsonDocument doc2(512); doc2[F("name")] = name; doc2[F("stat_t")] = String(mCfgMqtt->topic) + "/" + ((!total) ? String(iv->config->name) : "total" ) + String(topic); doc2[F("unit_of_meas")] = ((!total) ? (iv->getUnit(i,rec)) : (unitTotal[i])); @@ -359,7 +359,7 @@ class PubMqtt { if(NULL == mSubscriptionCb) return; - StaticJsonDocument<128> json; + DynamicJsonDocument json(128); JsonObject root = json.to(); bool limitAbs = false;