Code Refactoring: Add inverter reference to each command

Instead of just adding the target_address to a command this patch adds a reference to the whole inverter instance
This commit is contained in:
Thomas Basler
2024-05-16 19:54:09 +02:00
parent 6358b1ebee
commit 6a7bed0ecf
34 changed files with 105 additions and 111 deletions

View File

@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* Copyright (C) 2022-2023 Thomas Basler and others
* Copyright (C) 2022-2024 Thomas Basler and others
*/
/*
@@ -22,8 +22,8 @@ ID Target Addr Source Addr Idx DT ? Time Gap Pa
#include "Hoymiles.h"
#include "inverters/InverterAbstract.h"
RealTimeRunDataCommand::RealTimeRunDataCommand(const uint64_t target_address, const uint64_t router_address, const time_t time)
: MultiDataCommand(target_address, router_address)
RealTimeRunDataCommand::RealTimeRunDataCommand(InverterAbstract* inv, const uint64_t router_address, const time_t time)
: MultiDataCommand(inv, router_address)
{
setTime(time);
setDataType(0x0b);
@@ -71,4 +71,4 @@ bool RealTimeRunDataCommand::handleResponse(InverterAbstract& inverter, const fr
void RealTimeRunDataCommand::gotTimeout(InverterAbstract& inverter)
{
inverter.Statistics()->incrementRxFailureCount();
}
}