diff --git a/lib/Hoymiles/src/HoymilesRadio.cpp b/lib/Hoymiles/src/HoymilesRadio.cpp index 8cbc6e1..db70d8b 100644 --- a/lib/Hoymiles/src/HoymilesRadio.cpp +++ b/lib/Hoymiles/src/HoymilesRadio.cpp @@ -127,7 +127,7 @@ void HoymilesRadio::loop() } } else { // If inverter was not found, assume the command is invalid - Serial.println(F("Invalid inverter found")); + Serial.println(F("RX: Invalid inverter found")); _commandQueue.pop(); _busyFlag = false; } @@ -137,8 +137,13 @@ void HoymilesRadio::loop() CommandAbstract* cmd = _commandQueue.front().get(); auto inv = Hoymiles.getInverterBySerial(cmd->getTargetAddress()); - inv->clearRxFragmentBuffer(); - sendEsbPacket(cmd); + if (nullptr != inv) { + inv->clearRxFragmentBuffer(); + sendEsbPacket(cmd); + } else { + Serial.println(F("TX: Invalid inverter found")); + _commandQueue.pop(); + } } } }