Fix: do not calc sizes multiple times
tbnobody/OpenDTU/issues/1022
This commit is contained in:
parent
4ae6a2b4ef
commit
82038d3e2d
@ -29,11 +29,11 @@ bool RealTimeRunDataCommand::handleResponse(InverterAbstract* inverter, fragment
|
|||||||
// Check if at least all required bytes are received
|
// Check if at least all required bytes are received
|
||||||
// In case of low power in the inverter it occours that some incomplete fragments
|
// In case of low power in the inverter it occours that some incomplete fragments
|
||||||
// with a valid CRC are received.
|
// with a valid CRC are received.
|
||||||
if (getTotalFragmentSize(fragment, max_fragment_id) < inverter->Statistics()->getExpectedByteCount()) {
|
uint8_t fragmentsSize = getTotalFragmentSize(fragment, max_fragment_id);
|
||||||
Hoymiles.getMessageOutput()->printf("ERROR in %s: Received fragment size: %d min. expected size: %d\r\n",
|
uint8_t expectedSize = inverter->Statistics()->getExpectedByteCount();
|
||||||
getCommandName().c_str(),
|
if (fragmentsSize < expectedSize) {
|
||||||
getTotalFragmentSize(fragment, max_fragment_id),
|
Hoymiles.getMessageOutput()->printf("ERROR in %s: Received fragment size: %d, min expected size: %d\r\n",
|
||||||
inverter->Statistics()->getExpectedByteCount());
|
getCommandName().c_str(), fragmentsSize, expectedSize);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user