From 982c201d4811592b8ae927ca4755e99043863d9b Mon Sep 17 00:00:00 2001 From: lumapu Date: Mon, 3 Jul 2023 22:29:38 +0200 Subject: [PATCH] 0.7.7 * attempt to fix MqTT `YieldDay` in `TotalValues` #927 * attempt to fix MqTT `YieldDay` and `YieldTotal` even if inverters are not completly available #929 * fix wrong message 'NRF not connected' if it is disabled #1007 --- src/CHANGES.md | 2 ++ src/publisher/pubMqttIvData.h | 22 +++++++--------------- src/web/RestApi.h | 4 ++-- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/src/CHANGES.md b/src/CHANGES.md index ee3c6740..5907f51d 100644 --- a/src/CHANGES.md +++ b/src/CHANGES.md @@ -2,6 +2,8 @@ ## 0.7.7 - 2023-07-03 * attempt to fix MqTT `YieldDay` in `TotalValues` #927 +* attempt to fix MqTT `YieldDay` and `YieldTotal` even if inverters are not completly available #929 +* fix wrong message 'NRF not connected' if it is disabled #1007 ## 0.7.6 - 2023-06-17 * fix display of hidden SSID checkbox diff --git a/src/publisher/pubMqttIvData.h b/src/publisher/pubMqttIvData.h index f998aeda..58880f72 100644 --- a/src/publisher/pubMqttIvData.h +++ b/src/publisher/pubMqttIvData.h @@ -71,8 +71,7 @@ class PubMqttIvData { mCmd = mSendList->front().cmd; mIvSend = mSendList->front().iv; - if((RealTimeRunData_Debug != mCmd) || !mRTRDataHasBeenSent) { - mSendTotals = (RealTimeRunData_Debug == mCmd); + if((RealTimeRunData_Debug != mCmd) || !mRTRDataHasBeenSent) { // send RealTimeRunData only once memset(mTotal, 0, sizeof(float) * 4); mState = FIND_NXT_IV; } else @@ -97,18 +96,10 @@ class PubMqttIvData { mLastIvId++; mPos = 0; - if(found) { + if(found) mState = SEND_DATA; - if(!mIv->isAvailable(*mUtcTimestamp)) - mSendTotals = false; // avoid send total values on no availability, because the sum of values is not built - } - else if(mSendTotals) + else mState = SEND_TOTALS; - else { - mSendList->pop(); - mZeroValues = false; - mState = START; - } } void stateSend() { @@ -138,7 +129,8 @@ class PubMqttIvData { if (CH0 == rec->assign[mPos].ch) { switch (rec->assign[mPos].fieldId) { case FLD_PAC: - mTotal[0] += mIv->getValue(mPos, rec); + if(mIv->isProducing(*mUtcTimestamp)) + mTotal[0] += mIv->getValue(mPos, rec); break; case FLD_YT: mTotal[1] += mIv->getValue(mPos, rec); @@ -147,7 +139,8 @@ class PubMqttIvData { mTotal[2] += mIv->getValue(mPos, rec); break; case FLD_PDC: - mTotal[3] += mIv->getValue(mPos, rec); + if(mIv->isProducing(*mUtcTimestamp)) + mTotal[3] += mIv->getValue(mPos, rec); break; } } @@ -208,7 +201,6 @@ class PubMqttIvData { uint8_t mCmd; uint8_t mLastIvId; - bool mSendTotals; float mTotal[4]; Inverter<> *mIv, *mIvSend; diff --git a/src/web/RestApi.h b/src/web/RestApi.h index 20a7245d..b95065b7 100644 --- a/src/web/RestApi.h +++ b/src/web/RestApi.h @@ -469,9 +469,9 @@ class RestApi { } JsonArray warn = obj.createNestedArray(F("warnings")); - if(!mRadio->isChipConnected()) + if(!mRadio->isChipConnected() && mConfig->nrf.enabled) warn.add(F("your NRF24 module can't be reached, check the wiring, pinout and enable")); - else if(!mRadio->isPVariant()) + else if(!mRadio->isPVariant() && mConfig->nrf.enabled) warn.add(F("your NRF24 module isn't a plus version(+), maybe incompatible")); if(!mApp->getSettingsValid()) warn.add(F("your settings are invalid"));