Fix: Queue consumed whole memory on inverter timeout

When the poll interval was e.g. 1sec it was possible that the queue ran full and consumed the whole memory.
Now new entries are only added to the queue automatically if the queue is empty.  This issue also caused a lot of "DTU command failed" messages.
This commit is contained in:
Thomas Basler 2023-04-25 19:24:56 +02:00
parent 5996fb0edf
commit 0441bbbe72
3 changed files with 8 additions and 2 deletions

View File

@ -54,7 +54,7 @@ void HoymilesClass::loop()
}
}
if (iv != nullptr && iv->getRadio()->isInitialized() && iv->getRadio()->isIdle()) {
if (iv != nullptr && iv->getRadio()->isInitialized() && iv->getRadio()->isQueueEmpty()) {
_messageOutput->print("Fetch inverter: ");
_messageOutput->println(iv->serial(), HEX);

View File

@ -69,4 +69,9 @@ bool HoymilesRadio::isInitialized()
bool HoymilesRadio::isIdle()
{
return !_busyFlag;
}
}
bool HoymilesRadio::isQueueEmpty()
{
return _commandQueue.size() == 0;
}

View File

@ -12,6 +12,7 @@ public:
virtual void setDtuSerial(uint64_t serial);
bool isIdle();
bool isQueueEmpty();
bool isInitialized();
template <typename T>