Fix: Offset cache for "YieldDay" did not work correctly

This commit is contained in:
Thomas Basler 2023-12-18 12:14:11 +01:00
parent fbc39ef742
commit 8798ca5a13
2 changed files with 2 additions and 5 deletions

View File

@ -82,8 +82,6 @@ void StatisticsParser::clearBuffer()
{
memset(_payloadStatistic, 0, STATISTIC_PACKET_SIZE);
_statisticLength = 0;
memset(_lastYieldDay, 0, sizeof(_lastYieldDay));
}
void StatisticsParser::appendFragment(const uint8_t offset, const uint8_t* payload, const uint8_t len)
@ -111,8 +109,7 @@ void StatisticsParser::endAppendFragment()
// currently all values are zero --> Add last known values to offset
Hoymiles.getMessageOutput()->printf("Yield Day reset detected!\r\n");
setChannelFieldOffset(TYPE_DC, c, FLD_YD,
getChannelFieldOffset(TYPE_DC, c, FLD_YD) + _lastYieldDay[static_cast<uint8_t>(c)]);
setChannelFieldOffset(TYPE_DC, c, FLD_YD, _lastYieldDay[static_cast<uint8_t>(c)]);
_lastYieldDay[static_cast<uint8_t>(c)] = 0;
} else {

View File

@ -168,5 +168,5 @@ private:
uint32_t _lastUpdateFromInternal = 0;
bool _enableYieldDayCorrection = false;
float _lastYieldDay[CH_CNT];
float _lastYieldDay[CH_CNT] = {};
};