mirror of
https://github.com/tbnobody/OpenDTU.git
synced 2025-12-18 16:20:41 +01:00
Added check in statistics data that at least all required bytes are received
It can occour for some inverters that incomplete fragments with valid crc but less bytes are received This was mentioned in #1084
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
* Copyright (C) 2022 Thomas Basler and others
|
||||
*/
|
||||
#include "RealTimeRunDataCommand.h"
|
||||
#include "Hoymiles.h"
|
||||
#include "inverters/InverterAbstract.h"
|
||||
|
||||
RealTimeRunDataCommand::RealTimeRunDataCommand(uint64_t target_address, uint64_t router_address, time_t time)
|
||||
@@ -25,6 +26,18 @@ bool RealTimeRunDataCommand::handleResponse(InverterAbstract* inverter, fragment
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if at least all required bytes are received
|
||||
// In case of low power in the inverter it occours that some incomplete fragments
|
||||
// with a valid CRC are received.
|
||||
if (getTotalFragmentSize(fragment, max_fragment_id) < inverter->Statistics()->getMaxByteCount()) {
|
||||
Hoymiles.getMessageOutput()->printf("ERROR in %s: Received fragment size: %d min. expected size: %d\r\n",
|
||||
getCommandName().c_str(),
|
||||
getTotalFragmentSize(fragment, max_fragment_id),
|
||||
inverter->Statistics()->getMaxByteCount());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Move all fragments into target buffer
|
||||
uint8_t offs = 0;
|
||||
inverter->Statistics()->clearBuffer();
|
||||
|
||||
Reference in New Issue
Block a user