From 3736bff9abe65d4e648fd7c80c53f24a6fd332a4 Mon Sep 17 00:00:00 2001 From: Patrick Amrhein Date: Sat, 30 Mar 2024 18:23:19 +0100 Subject: [PATCH] Optimize --- src/plugins/zeroExport/zeroExport.h | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/plugins/zeroExport/zeroExport.h b/src/plugins/zeroExport/zeroExport.h index a80e2e9b..c7dfacf0 100644 --- a/src/plugins/zeroExport/zeroExport.h +++ b/src/plugins/zeroExport/zeroExport.h @@ -401,6 +401,7 @@ class ZeroExport { mLog["D"] = eTsp - bTsp; } sendLog(); + clearLog(); return; } } @@ -435,6 +436,7 @@ class ZeroExport { mLog["D"] = eTsp - bTsp; } sendLog(); + clearLog(); return; } } @@ -449,9 +451,13 @@ class ZeroExport { return; } - // if (!iv->isAvailable()) { - // return; - // } + if (!iv->isAvailable()) { + return; + } + + if (!iv->isProducing()) { + return; + } if (iv->actPowerLimit == 65535) { return; @@ -466,7 +472,8 @@ class ZeroExport { mLog["g"] = group; mLog["i"] = inv; mLog["id"] = iv->id; - mLog["a"] = iv->isAvailable(); + // mLog["a"] = iv->isAvailable(); + // mLog["p"] = iv->isProducing(); mLog["ivL%"] = iv->actPowerLimit; mLog["ivPm"] = iv->getMaxPower(); uint16_t ivL = (iv->getMaxPower() * iv->actPowerLimit) / 100; @@ -481,6 +488,7 @@ class ZeroExport { mLog["D"] = eTsp - bTsp; } sendLog(); + clearLog(); return; } } @@ -502,6 +510,7 @@ class ZeroExport { mLog["MQTT"] = obj; sendLog(); + clearLog(); } private: @@ -1480,10 +1489,6 @@ class ZeroExport { mCfg->groups[group].lastRun = *tsp; - *doLog = true; - - return true; - if (mMqtt->isConnected()) { DynamicJsonDocument doc(512); JsonObject obj = doc.to(); @@ -1553,7 +1558,8 @@ class ZeroExport { */ void sendLog(void) { if (mCfg->log_over_webserial) { - DBGPRINTLN(String("ze: ") + mDocLog.as()); +// DBGPRINTLN(String("ze: ") + mDocLog.as()); + DPRINTLN(DBG_INFO, String("ze: ") + mDocLog.as()); } if (mCfg->log_over_mqtt) {