mirror of
https://github.com/tbnobody/OpenDTU.git
synced 2025-12-17 15:49:51 +01:00
Use references instead of pointers whenver possible
This commit is contained in:
@@ -35,7 +35,7 @@ String RealTimeRunDataCommand::getCommandName() const
|
||||
return "RealTimeRunData";
|
||||
}
|
||||
|
||||
bool RealTimeRunDataCommand::handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
||||
bool RealTimeRunDataCommand::handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
||||
{
|
||||
// Check CRC of whole payload
|
||||
if (!MultiDataCommand::handleResponse(inverter, fragment, max_fragment_id)) {
|
||||
@@ -46,7 +46,7 @@ bool RealTimeRunDataCommand::handleResponse(InverterAbstract* inverter, const fr
|
||||
// In case of low power in the inverter it occours that some incomplete fragments
|
||||
// with a valid CRC are received.
|
||||
const uint8_t fragmentsSize = getTotalFragmentSize(fragment, max_fragment_id);
|
||||
const uint8_t expectedSize = inverter->Statistics()->getExpectedByteCount();
|
||||
const uint8_t expectedSize = inverter.Statistics()->getExpectedByteCount();
|
||||
if (fragmentsSize < expectedSize) {
|
||||
Hoymiles.getMessageOutput()->printf("ERROR in %s: Received fragment size: %d, min expected size: %d\r\n",
|
||||
getCommandName().c_str(), fragmentsSize, expectedSize);
|
||||
@@ -56,19 +56,19 @@ bool RealTimeRunDataCommand::handleResponse(InverterAbstract* inverter, const fr
|
||||
|
||||
// Move all fragments into target buffer
|
||||
uint8_t offs = 0;
|
||||
inverter->Statistics()->beginAppendFragment();
|
||||
inverter->Statistics()->clearBuffer();
|
||||
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);
|
||||
inverter.Statistics()->appendFragment(offs, fragment[i].fragment, fragment[i].len);
|
||||
offs += (fragment[i].len);
|
||||
}
|
||||
inverter->Statistics()->endAppendFragment();
|
||||
inverter->Statistics()->resetRxFailureCount();
|
||||
inverter->Statistics()->setLastUpdate(millis());
|
||||
inverter.Statistics()->endAppendFragment();
|
||||
inverter.Statistics()->resetRxFailureCount();
|
||||
inverter.Statistics()->setLastUpdate(millis());
|
||||
return true;
|
||||
}
|
||||
|
||||
void RealTimeRunDataCommand::gotTimeout(InverterAbstract* inverter)
|
||||
void RealTimeRunDataCommand::gotTimeout(InverterAbstract& inverter)
|
||||
{
|
||||
inverter->Statistics()->incrementRxFailureCount();
|
||||
inverter.Statistics()->incrementRxFailureCount();
|
||||
}
|
||||
Reference in New Issue
Block a user