mirror of
https://github.com/tbnobody/OpenDTU.git
synced 2025-12-18 08:11:55 +01:00
Fix: Prevent wrong values of statistics data because of non-atomic transaction
This commit is contained in:
@@ -40,11 +40,13 @@ bool RealTimeRunDataCommand::handleResponse(InverterAbstract* inverter, fragment
|
||||
|
||||
// Move all fragments into target buffer
|
||||
uint8_t offs = 0;
|
||||
inverter->Statistics()->beginAppendFragment();
|
||||
inverter->Statistics()->clearBuffer();
|
||||
for (uint8_t i = 0; i < max_fragment_id; i++) {
|
||||
inverter->Statistics()->appendFragment(offs, fragment[i].fragment, fragment[i].len);
|
||||
offs += (fragment[i].len);
|
||||
}
|
||||
inverter->Statistics()->endAppendFragment();
|
||||
inverter->Statistics()->resetRxFailureCount();
|
||||
inverter->Statistics()->setLastUpdate(millis());
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user