Fix: Re-Request grid profile parameters if received data are invalid / to short

Fixes #1874
This commit is contained in:
Thomas Basler 2024-03-31 12:42:00 +02:00
parent 6f3b8fb8e1
commit 1888054627
3 changed files with 10 additions and 3 deletions

View File

@ -114,7 +114,7 @@ void HoymilesClass::loop()
}
// Fetch grid profile
if (iv->Statistics()->getLastUpdate() > 0 && iv->GridProfile()->getLastUpdate() == 0) {
if (iv->Statistics()->getLastUpdate() > 0 && (iv->GridProfile()->getLastUpdate() == 0 || !iv->GridProfile()->containsValidData())) {
iv->sendGridOnProFileParaRequest();
}

View File

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (C) 2023 Thomas Basler and others
* Copyright (C) 2023 - 2024 Thomas Basler and others
*/
#include "GridProfileParser.h"
#include "../Hoymiles.h"
@ -446,6 +446,11 @@ std::list<GridProfileSection_t> GridProfileParser::getProfile() const
return l;
}
bool GridProfileParser::containsValidData() const
{
return _gridProfileLength > 6;
}
uint8_t GridProfileParser::getSectionSize(const uint8_t section_id, const uint8_t section_version)
{
uint8_t count = 0;

View File

@ -43,6 +43,8 @@ public:
std::list<GridProfileSection_t> getProfile() const;
bool containsValidData() const;
private:
static uint8_t getSectionSize(const uint8_t section_id, const uint8_t section_version);
static int16_t getSectionStart(const uint8_t section_id, const uint8_t section_version);