Browse Source

0.5.103

merged heap improvements #772
pull/788/head
lumapu 2 years ago
parent
commit
96eb32ca63
  1. 1
      src/CHANGES.md
  2. 6
      src/publisher/pubMqtt.h

1
src/CHANGES.md

@ -5,6 +5,7 @@
## 0.5.103 ## 0.5.103
* merged MI improvements, thx @rejoe2 #778 * merged MI improvements, thx @rejoe2 #778
* changed display inverter online message * changed display inverter online message
* merged heap improvements #772
## 0.5.102 ## 0.5.102
* Warning: old exports are not compatible any more! * Warning: old exports are not compatible any more!

6
src/publisher/pubMqtt.h

@ -210,7 +210,7 @@ class PubMqtt {
DPRINTLN(DBG_VERBOSE, F("sendMqttDiscoveryConfig")); DPRINTLN(DBG_VERBOSE, F("sendMqttDiscoveryConfig"));
char topic[64], name[32], uniq_id[32]; 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}; uint8_t fldTotal[4] = {FLD_PAC, FLD_YT, FLD_YD, FLD_PDC};
const char* unitTotal[4] = {"W", "kWh", "Wh", "W"}; const char* unitTotal[4] = {"W", "kWh", "Wh", "W"};
@ -267,7 +267,7 @@ class PubMqtt {
stateCls = getFieldStateClass(fldTotal[i]); stateCls = getFieldStateClass(fldTotal[i]);
} }
StaticJsonDocument<512> doc2; DynamicJsonDocument doc2(512);
doc2[F("name")] = name; doc2[F("name")] = name;
doc2[F("stat_t")] = String(mCfgMqtt->topic) + "/" + ((!total) ? String(iv->config->name) : "total" ) + String(topic); 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])); doc2[F("unit_of_meas")] = ((!total) ? (iv->getUnit(i,rec)) : (unitTotal[i]));
@ -359,7 +359,7 @@ class PubMqtt {
if(NULL == mSubscriptionCb) if(NULL == mSubscriptionCb)
return; return;
StaticJsonDocument<128> json; DynamicJsonDocument json(128);
JsonObject root = json.to<JsonObject>(); JsonObject root = json.to<JsonObject>();
bool limitAbs = false; bool limitAbs = false;

Loading…
Cancel
Save