Browse Source

0.6.15

* improved reset values and update MqTT #957
pull/961/head
lumapu 2 years ago
parent
commit
6dcf5ee9aa
  1. 1
      src/CHANGES.md
  2. 21
      src/app.cpp
  3. 19
      src/hm/hmPayload.h

1
src/CHANGES.md

@ -3,6 +3,7 @@
## 0.6.15 - 2023-05-25
* improved Prometheus Endpoint PR #958
* fix turn off ePaper only if setting was set #956
* improved reset values and update MqTT #957
## 0.6.14 - 2023-05-21
* merge PR #902 Mono-Display

21
src/app.cpp

@ -274,6 +274,7 @@ void app::tickComm(void) {
//-----------------------------------------------------------------------------
void app::tickZeroValues(void) {
Inverter<> *iv;
bool changed = false;
// set values to zero, except yields
for (uint8_t id = 0; id < mSys.getNumInverters(); id++) {
iv = mSys.getInverterByPos(id);
@ -281,7 +282,11 @@ void app::tickZeroValues(void) {
continue; // skip to next inverter
mPayload.zeroInverterValues(iv);
changed = true;
}
if(changed)
payloadEventListener(RealTimeRunData_Debug);
}
//-----------------------------------------------------------------------------
@ -289,15 +294,21 @@ void app::tickMinute(void) {
// only triggered if 'reset values on no avail is enabled'
Inverter<> *iv;
bool changed = false;
// set values to zero, except yields
for (uint8_t id = 0; id < mSys.getNumInverters(); id++) {
iv = mSys.getInverterByPos(id);
if (NULL == iv)
continue; // skip to next inverter
if (!iv->isAvailable(mTimestamp) && !iv->isProducing(mTimestamp) && iv->config->enabled)
if (!iv->isAvailable(mTimestamp) && !iv->isProducing(mTimestamp) && iv->config->enabled) {
mPayload.zeroInverterValues(iv);
changed = true;
}
}
if(changed)
payloadEventListener(RealTimeRunData_Debug);
}
//-----------------------------------------------------------------------------
@ -308,16 +319,20 @@ void app::tickMidnight(void) {
onceAt(std::bind(&app::tickMidnight, this), nxtTrig, "mid2");
Inverter<> *iv;
bool changed = false;
// set values to zero, except yield total
for (uint8_t id = 0; id < mSys.getNumInverters(); id++) {
iv = mSys.getInverterByPos(id);
if (NULL == iv)
continue; // skip to next inverter
mPayload.zeroInverterValues(iv);
mPayload.zeroYieldDay(iv);
mPayload.zeroInverterValues(iv, false);
changed = true;
}
if(changed)
payloadEventListener(RealTimeRunData_Debug);
if (mMqttEnabled)
mMqtt.tickerMidnight();
}

19
src/hm/hmPayload.h

@ -93,17 +93,7 @@ class HmPayload {
notify(0x0b);
}*/
void zeroYieldDay(Inverter<> *iv) {
DPRINTLN(DBG_DEBUG, F("zeroYieldDay"));
record_t<> *rec = iv->getRecordStruct(RealTimeRunData_Debug);
uint8_t pos;
for(uint8_t ch = 0; ch <= iv->channels; ch++) {
pos = iv->getPosByChFld(ch, FLD_YD, rec);
iv->setValue(pos, rec, 0.0f);
}
}
void zeroInverterValues(Inverter<> *iv) {
void zeroInverterValues(Inverter<> *iv, bool skipYieldDay = true) {
DPRINTLN(DBG_DEBUG, F("zeroInverterValues"));
record_t<> *rec = iv->getRecordStruct(RealTimeRunData_Debug);
for(uint8_t ch = 0; ch <= iv->channels; ch++) {
@ -111,15 +101,18 @@ class HmPayload {
for(uint8_t fld = 0; fld < FLD_EVT; fld++) {
switch(fld) {
case FLD_YD:
if(skipYieldDay)
continue;
else
break;
case FLD_YT:
continue;
}
pos = iv->getPosByChFld(ch, fld, rec);
iv->setValue(pos, rec, 0.0f);
}
iv->doCalculations();
}
notify(RealTimeRunData_Debug);
}
void ivSendHighPrio(Inverter<> *iv) {

Loading…
Cancel
Save