Move inverter housekeeping tasks inside the InverterAbstract class

This commit is contained in:
Thomas Basler 2024-09-23 22:08:53 +02:00
parent 93b6e5a885
commit 0c012bf62a
3 changed files with 17 additions and 10 deletions

View File

@ -136,16 +136,7 @@ void HoymilesClass::loop()
if (currentWeekDay != lastWeekDay) { if (currentWeekDay != lastWeekDay) {
for (auto& inv : _inverters) { for (auto& inv : _inverters) {
// Have to reset the offets first, otherwise it will inv->performDailyTask();
// Substract the offset from zero which leads to a high value
inv->Statistics()->resetYieldDayCorrection();
if (inv->getZeroYieldDayOnMidnight()) {
inv->Statistics()->zeroDailyData();
}
if (inv->getClearEventlogOnMidnight()) {
inv->EventLog()->clearBuffer();
}
inv->resetRadioStats();
} }
lastWeekDay = currentWeekDay; lastWeekDay = currentWeekDay;

View File

@ -273,6 +273,20 @@ uint8_t InverterAbstract::verifyAllFragments(CommandAbstract& cmd)
return FRAGMENT_OK; return FRAGMENT_OK;
} }
void InverterAbstract::performDailyTask()
{
// Have to reset the offets first, otherwise it will
// Substract the offset from zero which leads to a high value
Statistics()->resetYieldDayCorrection();
if (getZeroYieldDayOnMidnight()) {
Statistics()->zeroDailyData();
}
if (getClearEventlogOnMidnight()) {
EventLog()->clearBuffer();
}
resetRadioStats();
}
void InverterAbstract::resetRadioStats() void InverterAbstract::resetRadioStats()
{ {
RadioStats = {}; RadioStats = {};

View File

@ -65,6 +65,8 @@ public:
void addRxFragment(const uint8_t fragment[], const uint8_t len); void addRxFragment(const uint8_t fragment[], const uint8_t len);
uint8_t verifyAllFragments(CommandAbstract& cmd); uint8_t verifyAllFragments(CommandAbstract& cmd);
void performDailyTask();
void resetRadioStats(); void resetRadioStats();
struct { struct {