Use references instead of pointers whenver possible
This commit is contained in:
parent
8fb43fedf8
commit
e95afbf2cc
@ -6,7 +6,7 @@
|
||||
|
||||
class DatastoreClass {
|
||||
public:
|
||||
void init(Scheduler* scheduler);
|
||||
void init(Scheduler& scheduler);
|
||||
|
||||
// Sum of yield total of all enabled inverters, a inverter which is just disabled at night is also included
|
||||
float getTotalAcYieldTotalEnabled();
|
||||
|
||||
@ -17,7 +17,7 @@ public:
|
||||
DisplayGraphicClass();
|
||||
~DisplayGraphicClass();
|
||||
|
||||
void init(Scheduler* scheduler, const DisplayType_t type, const uint8_t data, const uint8_t clk, const uint8_t cs, const uint8_t reset);
|
||||
void init(Scheduler& scheduler, const DisplayType_t type, const uint8_t data, const uint8_t clk, const uint8_t cs, const uint8_t reset);
|
||||
void setContrast(const uint8_t contrast);
|
||||
void setStatus(const bool turnOn);
|
||||
void setOrientation(const uint8_t rotation = DISPLAY_ROTATION);
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
|
||||
class InverterSettingsClass {
|
||||
public:
|
||||
void init(Scheduler* scheduler);
|
||||
void init(Scheduler& scheduler);
|
||||
|
||||
private:
|
||||
void settingsLoop();
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
class LedSingleClass {
|
||||
public:
|
||||
LedSingleClass();
|
||||
void init(Scheduler* scheduler);
|
||||
void init(Scheduler& scheduler);
|
||||
|
||||
void turnAllOff();
|
||||
void turnAllOn();
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
|
||||
class MessageOutputClass : public Print {
|
||||
public:
|
||||
void init(Scheduler* scheduler);
|
||||
void init(Scheduler& scheduler);
|
||||
size_t write(uint8_t c) override;
|
||||
size_t write(const uint8_t* buffer, size_t size) override;
|
||||
void register_ws_output(AsyncWebSocket* output);
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
|
||||
class MqttHandleDtuClass {
|
||||
public:
|
||||
void init(Scheduler* scheduler);
|
||||
void init(Scheduler& scheduler);
|
||||
|
||||
private:
|
||||
void loop();
|
||||
|
||||
@ -51,7 +51,7 @@ const byteAssign_fieldDeviceClass_t deviceFieldAssignment[] = {
|
||||
|
||||
class MqttHandleHassClass {
|
||||
public:
|
||||
void init(Scheduler* scheduler);
|
||||
void init(Scheduler& scheduler);
|
||||
void publishConfig();
|
||||
void forceUpdate();
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
|
||||
class MqttHandleInverterClass {
|
||||
public:
|
||||
void init(Scheduler* scheduler);
|
||||
void init(Scheduler& scheduler);
|
||||
|
||||
static String getTopic(std::shared_ptr<InverterAbstract> inv, const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId);
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
|
||||
class MqttHandleInverterTotalClass {
|
||||
public:
|
||||
void init(Scheduler* scheduler);
|
||||
void init(Scheduler& scheduler);
|
||||
|
||||
private:
|
||||
void loop();
|
||||
|
||||
@ -39,7 +39,7 @@ typedef struct NetworkEventCbList {
|
||||
class NetworkSettingsClass {
|
||||
public:
|
||||
NetworkSettingsClass();
|
||||
void init(Scheduler* scheduler);
|
||||
void init(Scheduler& scheduler);
|
||||
void applyConfig();
|
||||
void enableAdminMode();
|
||||
String getApName() const;
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
class SunPositionClass {
|
||||
public:
|
||||
SunPositionClass();
|
||||
void init(Scheduler* scheduler);
|
||||
void init(Scheduler& scheduler);
|
||||
|
||||
bool isDayPeriod() const;
|
||||
bool isSunsetAvailable() const;
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
class WebApiClass {
|
||||
public:
|
||||
WebApiClass();
|
||||
void init(Scheduler* scheduler);
|
||||
void init(Scheduler& scheduler);
|
||||
|
||||
static bool checkCredentials(AsyncWebServerRequest* request);
|
||||
static bool checkCredentialsReadonly(AsyncWebServerRequest* request);
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
|
||||
class WebApiConfigClass {
|
||||
public:
|
||||
void init(AsyncWebServer* server);
|
||||
void init(AsyncWebServer& server);
|
||||
void loop();
|
||||
|
||||
private:
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
|
||||
class WebApiDeviceClass {
|
||||
public:
|
||||
void init(AsyncWebServer* server);
|
||||
void init(AsyncWebServer& server);
|
||||
void loop();
|
||||
|
||||
private:
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
|
||||
class WebApiDevInfoClass {
|
||||
public:
|
||||
void init(AsyncWebServer* server);
|
||||
void init(AsyncWebServer& server);
|
||||
void loop();
|
||||
|
||||
private:
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
|
||||
class WebApiDtuClass {
|
||||
public:
|
||||
void init(AsyncWebServer* server);
|
||||
void init(AsyncWebServer& server);
|
||||
void loop();
|
||||
|
||||
private:
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
|
||||
class WebApiEventlogClass {
|
||||
public:
|
||||
void init(AsyncWebServer* server);
|
||||
void init(AsyncWebServer& server);
|
||||
void loop();
|
||||
|
||||
private:
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
|
||||
class WebApiFirmwareClass {
|
||||
public:
|
||||
void init(AsyncWebServer* server);
|
||||
void init(AsyncWebServer& server);
|
||||
void loop();
|
||||
|
||||
private:
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
|
||||
class WebApiGridProfileClass {
|
||||
public:
|
||||
void init(AsyncWebServer* server);
|
||||
void init(AsyncWebServer& server);
|
||||
void loop();
|
||||
|
||||
private:
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
|
||||
class WebApiInverterClass {
|
||||
public:
|
||||
void init(AsyncWebServer* server);
|
||||
void init(AsyncWebServer& server);
|
||||
void loop();
|
||||
|
||||
private:
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
|
||||
class WebApiLimitClass {
|
||||
public:
|
||||
void init(AsyncWebServer* server);
|
||||
void init(AsyncWebServer& server);
|
||||
void loop();
|
||||
|
||||
private:
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
|
||||
class WebApiMaintenanceClass {
|
||||
public:
|
||||
void init(AsyncWebServer* server);
|
||||
void init(AsyncWebServer& server);
|
||||
void loop();
|
||||
|
||||
private:
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
|
||||
class WebApiMqttClass {
|
||||
public:
|
||||
void init(AsyncWebServer* server);
|
||||
void init(AsyncWebServer& server);
|
||||
void loop();
|
||||
|
||||
private:
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
|
||||
class WebApiNetworkClass {
|
||||
public:
|
||||
void init(AsyncWebServer* server);
|
||||
void init(AsyncWebServer& server);
|
||||
void loop();
|
||||
|
||||
private:
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
|
||||
class WebApiNtpClass {
|
||||
public:
|
||||
void init(AsyncWebServer* server);
|
||||
void init(AsyncWebServer& server);
|
||||
void loop();
|
||||
|
||||
private:
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
|
||||
class WebApiPowerClass {
|
||||
public:
|
||||
void init(AsyncWebServer* server);
|
||||
void init(AsyncWebServer& server);
|
||||
void loop();
|
||||
|
||||
private:
|
||||
|
||||
@ -7,7 +7,7 @@
|
||||
|
||||
class WebApiPrometheusClass {
|
||||
public:
|
||||
void init(AsyncWebServer* server);
|
||||
void init(AsyncWebServer& server);
|
||||
void loop();
|
||||
|
||||
private:
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
|
||||
class WebApiSecurityClass {
|
||||
public:
|
||||
void init(AsyncWebServer* server);
|
||||
void init(AsyncWebServer& server);
|
||||
void loop();
|
||||
|
||||
private:
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
|
||||
class WebApiSysstatusClass {
|
||||
public:
|
||||
void init(AsyncWebServer* server);
|
||||
void init(AsyncWebServer& server);
|
||||
void loop();
|
||||
|
||||
private:
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
|
||||
class WebApiWebappClass {
|
||||
public:
|
||||
void init(AsyncWebServer* server);
|
||||
void init(AsyncWebServer& server);
|
||||
void loop();
|
||||
|
||||
private:
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
class WebApiWsConsoleClass {
|
||||
public:
|
||||
WebApiWsConsoleClass();
|
||||
void init(AsyncWebServer* server);
|
||||
void init(AsyncWebServer& server);
|
||||
void loop();
|
||||
|
||||
private:
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
class WebApiWsLiveClass {
|
||||
public:
|
||||
WebApiWsLiveClass();
|
||||
void init(AsyncWebServer* server);
|
||||
void init(AsyncWebServer& server);
|
||||
void loop();
|
||||
|
||||
private:
|
||||
|
||||
@ -198,9 +198,9 @@ std::shared_ptr<InverterAbstract> HoymilesClass::getInverterBySerial(const uint6
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::shared_ptr<InverterAbstract> HoymilesClass::getInverterByFragment(const fragment_t* fragment)
|
||||
std::shared_ptr<InverterAbstract> HoymilesClass::getInverterByFragment(const fragment_t& fragment)
|
||||
{
|
||||
if (fragment->len <= 4) {
|
||||
if (fragment.len <= 4) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -210,10 +210,10 @@ std::shared_ptr<InverterAbstract> HoymilesClass::getInverterByFragment(const fra
|
||||
serial_u p;
|
||||
p.u64 = inv->serial();
|
||||
|
||||
if ((p.b[3] == fragment->fragment[1])
|
||||
&& (p.b[2] == fragment->fragment[2])
|
||||
&& (p.b[1] == fragment->fragment[3])
|
||||
&& (p.b[0] == fragment->fragment[4])) {
|
||||
if ((p.b[3] == fragment.fragment[1])
|
||||
&& (p.b[2] == fragment.fragment[2])
|
||||
&& (p.b[1] == fragment.fragment[3])
|
||||
&& (p.b[0] == fragment.fragment[4])) {
|
||||
|
||||
return inv;
|
||||
}
|
||||
|
||||
@ -26,7 +26,7 @@ public:
|
||||
std::shared_ptr<InverterAbstract> addInverter(const char* name, const uint64_t serial);
|
||||
std::shared_ptr<InverterAbstract> getInverterByPos(const uint8_t pos);
|
||||
std::shared_ptr<InverterAbstract> getInverterBySerial(const uint64_t serial);
|
||||
std::shared_ptr<InverterAbstract> getInverterByFragment(const fragment_t* fragment);
|
||||
std::shared_ptr<InverterAbstract> getInverterByFragment(const fragment_t& fragment);
|
||||
void removeInverterBySerial(const uint64_t serial);
|
||||
size_t getNumInverters() const;
|
||||
|
||||
|
||||
@ -28,10 +28,10 @@ serial_u HoymilesRadio::convertSerialToRadioId(const serial_u serial)
|
||||
return radioId;
|
||||
}
|
||||
|
||||
bool HoymilesRadio::checkFragmentCrc(const fragment_t* fragment) const
|
||||
bool HoymilesRadio::checkFragmentCrc(const fragment_t& fragment) const
|
||||
{
|
||||
const uint8_t crc = crc8(fragment->fragment, fragment->len - 1);
|
||||
return (crc == fragment->fragment[fragment->len - 1]);
|
||||
const uint8_t crc = crc8(fragment.fragment, fragment.len - 1);
|
||||
return (crc == fragment.fragment[fragment.len - 1]);
|
||||
}
|
||||
|
||||
void HoymilesRadio::sendRetransmitPacket(const uint8_t fragment_id)
|
||||
@ -41,14 +41,14 @@ void HoymilesRadio::sendRetransmitPacket(const uint8_t fragment_id)
|
||||
CommandAbstract* requestCmd = cmd->getRequestFrameCommand(fragment_id);
|
||||
|
||||
if (requestCmd != nullptr) {
|
||||
sendEsbPacket(requestCmd);
|
||||
sendEsbPacket(*requestCmd);
|
||||
}
|
||||
}
|
||||
|
||||
void HoymilesRadio::sendLastPacketAgain()
|
||||
{
|
||||
CommandAbstract* cmd = _commandQueue.front().get();
|
||||
sendEsbPacket(cmd);
|
||||
sendEsbPacket(*cmd);
|
||||
}
|
||||
|
||||
void HoymilesRadio::handleReceivedPackage()
|
||||
@ -59,7 +59,7 @@ void HoymilesRadio::handleReceivedPackage()
|
||||
|
||||
if (nullptr != inv) {
|
||||
CommandAbstract* cmd = _commandQueue.front().get();
|
||||
uint8_t verifyResult = inv->verifyAllFragments(cmd);
|
||||
uint8_t verifyResult = inv->verifyAllFragments(*cmd);
|
||||
if (verifyResult == FRAGMENT_ALL_MISSING_RESEND) {
|
||||
Hoymiles.getMessageOutput()->println("Nothing received, resend whole request");
|
||||
sendLastPacketAgain();
|
||||
@ -105,7 +105,7 @@ void HoymilesRadio::handleReceivedPackage()
|
||||
auto inv = Hoymiles.getInverterBySerial(cmd->getTargetAddress());
|
||||
if (nullptr != inv) {
|
||||
inv->clearRxFragmentBuffer();
|
||||
sendEsbPacket(cmd);
|
||||
sendEsbPacket(*cmd);
|
||||
} else {
|
||||
Hoymiles.getMessageOutput()->println("TX: Invalid inverter found");
|
||||
_commandQueue.pop();
|
||||
|
||||
@ -31,8 +31,8 @@ protected:
|
||||
static serial_u convertSerialToRadioId(const serial_u serial);
|
||||
static void dumpBuf(const uint8_t buf[], const uint8_t len, const bool appendNewline = true);
|
||||
|
||||
bool checkFragmentCrc(const fragment_t* fragment) const;
|
||||
virtual void sendEsbPacket(CommandAbstract* cmd) = 0;
|
||||
bool checkFragmentCrc(const fragment_t& fragment) const;
|
||||
virtual void sendEsbPacket(CommandAbstract& cmd) = 0;
|
||||
void sendRetransmitPacket(const uint8_t fragment_id);
|
||||
void sendLastPacketAgain();
|
||||
void handleReceivedPackage();
|
||||
|
||||
@ -122,7 +122,7 @@ void HoymilesRadio_CMT::loop()
|
||||
// Perform package parsing only if no packages are received
|
||||
if (!_rxBuffer.empty()) {
|
||||
fragment_t f = _rxBuffer.back();
|
||||
if (checkFragmentCrc(&f)) {
|
||||
if (checkFragmentCrc(f)) {
|
||||
|
||||
const serial_u dtuId = convertSerialToRadioId(_dtuSerial);
|
||||
|
||||
@ -130,7 +130,7 @@ void HoymilesRadio_CMT::loop()
|
||||
// Has to be done manually here.
|
||||
if (memcmp(&f.fragment[5], &dtuId.b[1], 4) == 0) {
|
||||
|
||||
std::shared_ptr<InverterAbstract> inv = Hoymiles.getInverterByFragment(&f);
|
||||
std::shared_ptr<InverterAbstract> inv = Hoymiles.getInverterByFragment(f);
|
||||
|
||||
if (nullptr != inv) {
|
||||
// Save packet in inverter rx buffer
|
||||
@ -211,27 +211,27 @@ void ARDUINO_ISR_ATTR HoymilesRadio_CMT::handleInt2()
|
||||
_packetReceived = true;
|
||||
}
|
||||
|
||||
void HoymilesRadio_CMT::sendEsbPacket(CommandAbstract* cmd)
|
||||
void HoymilesRadio_CMT::sendEsbPacket(CommandAbstract& cmd)
|
||||
{
|
||||
cmd->incrementSendCount();
|
||||
cmd.incrementSendCount();
|
||||
|
||||
cmd->setRouterAddress(DtuSerial().u64);
|
||||
cmd.setRouterAddress(DtuSerial().u64);
|
||||
|
||||
_radio->stopListening();
|
||||
|
||||
if (cmd->getDataPayload()[0] == 0x56) { // @todo(tbnobody) Bad hack to identify ChannelChange Command
|
||||
if (cmd.getDataPayload()[0] == 0x56) { // @todo(tbnobody) Bad hack to identify ChannelChange Command
|
||||
cmtSwitchDtuFreq(HOY_BOOT_FREQ / 1000);
|
||||
}
|
||||
|
||||
Hoymiles.getMessageOutput()->printf("TX %s %.2f MHz --> ",
|
||||
cmd->getCommandName().c_str(), getFrequencyFromChannel(_radio->getChannel()));
|
||||
cmd->dumpDataPayload(Hoymiles.getMessageOutput());
|
||||
cmd.getCommandName().c_str(), getFrequencyFromChannel(_radio->getChannel()));
|
||||
cmd.dumpDataPayload(Hoymiles.getMessageOutput());
|
||||
|
||||
if (!_radio->write(cmd->getDataPayload(), cmd->getDataSize())) {
|
||||
if (!_radio->write(cmd.getDataPayload(), cmd.getDataSize())) {
|
||||
Hoymiles.getMessageOutput()->println("TX SPI Timeout");
|
||||
}
|
||||
cmtSwitchDtuFreq(_inverterTargetFrequency);
|
||||
_radio->startListening();
|
||||
_busyFlag = true;
|
||||
_rxTimeout.set(cmd->getTimeout());
|
||||
_rxTimeout.set(cmd.getTimeout());
|
||||
}
|
||||
|
||||
@ -36,7 +36,7 @@ private:
|
||||
void ARDUINO_ISR_ATTR handleInt1();
|
||||
void ARDUINO_ISR_ATTR handleInt2();
|
||||
|
||||
void sendEsbPacket(CommandAbstract* cmd);
|
||||
void sendEsbPacket(CommandAbstract& cmd);
|
||||
|
||||
std::unique_ptr<CMT2300A> _radio;
|
||||
|
||||
|
||||
@ -71,8 +71,8 @@ void HoymilesRadio_NRF::loop()
|
||||
// Perform package parsing only if no packages are received
|
||||
if (!_rxBuffer.empty()) {
|
||||
fragment_t f = _rxBuffer.back();
|
||||
if (checkFragmentCrc(&f)) {
|
||||
std::shared_ptr<InverterAbstract> inv = Hoymiles.getInverterByFragment(&f);
|
||||
if (checkFragmentCrc(f)) {
|
||||
std::shared_ptr<InverterAbstract> inv = Hoymiles.getInverterByFragment(f);
|
||||
|
||||
if (nullptr != inv) {
|
||||
// Save packet in inverter rx buffer
|
||||
@ -169,29 +169,29 @@ void HoymilesRadio_NRF::switchRxCh()
|
||||
_radio->startListening();
|
||||
}
|
||||
|
||||
void HoymilesRadio_NRF::sendEsbPacket(CommandAbstract* cmd)
|
||||
void HoymilesRadio_NRF::sendEsbPacket(CommandAbstract& cmd)
|
||||
{
|
||||
cmd->incrementSendCount();
|
||||
cmd.incrementSendCount();
|
||||
|
||||
cmd->setRouterAddress(DtuSerial().u64);
|
||||
cmd.setRouterAddress(DtuSerial().u64);
|
||||
|
||||
_radio->stopListening();
|
||||
_radio->setChannel(getTxNxtChannel());
|
||||
|
||||
serial_u s;
|
||||
s.u64 = cmd->getTargetAddress();
|
||||
s.u64 = cmd.getTargetAddress();
|
||||
openWritingPipe(s);
|
||||
_radio->setRetries(3, 15);
|
||||
|
||||
Hoymiles.getMessageOutput()->printf("TX %s Channel: %d --> ",
|
||||
cmd->getCommandName().c_str(), _radio->getChannel());
|
||||
cmd->dumpDataPayload(Hoymiles.getMessageOutput());
|
||||
_radio->write(cmd->getDataPayload(), cmd->getDataSize());
|
||||
cmd.getCommandName().c_str(), _radio->getChannel());
|
||||
cmd.dumpDataPayload(Hoymiles.getMessageOutput());
|
||||
_radio->write(cmd.getDataPayload(), cmd.getDataSize());
|
||||
|
||||
_radio->setRetries(0, 0);
|
||||
openReadingPipe();
|
||||
_radio->setChannel(getRxNxtChannel());
|
||||
_radio->startListening();
|
||||
_busyFlag = true;
|
||||
_rxTimeout.set(cmd->getTimeout());
|
||||
_rxTimeout.set(cmd.getTimeout());
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ private:
|
||||
void openReadingPipe();
|
||||
void openWritingPipe(const serial_u serial);
|
||||
|
||||
void sendEsbPacket(CommandAbstract* cmd);
|
||||
void sendEsbPacket(CommandAbstract& cmd);
|
||||
|
||||
std::unique_ptr<SPIClass> _spiPtr;
|
||||
std::unique_ptr<RF24> _radio;
|
||||
|
||||
@ -62,24 +62,24 @@ void ActivePowerControlCommand::setActivePowerLimit(const float limit, const Pow
|
||||
udpateCRC(CRC_SIZE);
|
||||
}
|
||||
|
||||
bool ActivePowerControlCommand::handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
||||
bool ActivePowerControlCommand::handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
||||
{
|
||||
if (!DevControlCommand::handleResponse(inverter, fragment, max_fragment_id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((getType() == PowerLimitControlType::RelativNonPersistent) || (getType() == PowerLimitControlType::RelativPersistent)) {
|
||||
inverter->SystemConfigPara()->setLimitPercent(getLimit());
|
||||
inverter.SystemConfigPara()->setLimitPercent(getLimit());
|
||||
} else {
|
||||
const uint16_t max_power = inverter->DevInfo()->getMaxPower();
|
||||
const uint16_t max_power = inverter.DevInfo()->getMaxPower();
|
||||
if (max_power > 0) {
|
||||
inverter->SystemConfigPara()->setLimitPercent(static_cast<float>(getLimit()) / max_power * 100);
|
||||
inverter.SystemConfigPara()->setLimitPercent(static_cast<float>(getLimit()) / max_power * 100);
|
||||
} else {
|
||||
// TODO(tbnobody): Not implemented yet because we only can publish the percentage value
|
||||
}
|
||||
}
|
||||
inverter->SystemConfigPara()->setLastUpdateCommand(millis());
|
||||
inverter->SystemConfigPara()->setLastLimitCommandSuccess(CMD_OK);
|
||||
inverter.SystemConfigPara()->setLastUpdateCommand(millis());
|
||||
inverter.SystemConfigPara()->setLastLimitCommandSuccess(CMD_OK);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ PowerLimitControlType ActivePowerControlCommand::getType()
|
||||
return (PowerLimitControlType)(((uint16_t)_payload[14] << 8) | _payload[15]);
|
||||
}
|
||||
|
||||
void ActivePowerControlCommand::gotTimeout(InverterAbstract* inverter)
|
||||
void ActivePowerControlCommand::gotTimeout(InverterAbstract& inverter)
|
||||
{
|
||||
inverter->SystemConfigPara()->setLastLimitCommandSuccess(CMD_NOK);
|
||||
inverter.SystemConfigPara()->setLastLimitCommandSuccess(CMD_NOK);
|
||||
}
|
||||
@ -16,8 +16,8 @@ public:
|
||||
|
||||
virtual String getCommandName() const;
|
||||
|
||||
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||
virtual void gotTimeout(InverterAbstract* inverter);
|
||||
virtual bool handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||
virtual void gotTimeout(InverterAbstract& inverter);
|
||||
|
||||
void setActivePowerLimit(const float limit, const PowerLimitControlType type = RelativNonPersistent);
|
||||
float getLimit() const;
|
||||
|
||||
@ -36,7 +36,7 @@ String AlarmDataCommand::getCommandName() const
|
||||
return "AlarmData";
|
||||
}
|
||||
|
||||
bool AlarmDataCommand::handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
||||
bool AlarmDataCommand::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)) {
|
||||
@ -45,19 +45,19 @@ bool AlarmDataCommand::handleResponse(InverterAbstract* inverter, const fragment
|
||||
|
||||
// Move all fragments into target buffer
|
||||
uint8_t offs = 0;
|
||||
inverter->EventLog()->beginAppendFragment();
|
||||
inverter->EventLog()->clearBuffer();
|
||||
inverter.EventLog()->beginAppendFragment();
|
||||
inverter.EventLog()->clearBuffer();
|
||||
for (uint8_t i = 0; i < max_fragment_id; i++) {
|
||||
inverter->EventLog()->appendFragment(offs, fragment[i].fragment, fragment[i].len);
|
||||
inverter.EventLog()->appendFragment(offs, fragment[i].fragment, fragment[i].len);
|
||||
offs += (fragment[i].len);
|
||||
}
|
||||
inverter->EventLog()->endAppendFragment();
|
||||
inverter->EventLog()->setLastAlarmRequestSuccess(CMD_OK);
|
||||
inverter->EventLog()->setLastUpdate(millis());
|
||||
inverter.EventLog()->endAppendFragment();
|
||||
inverter.EventLog()->setLastAlarmRequestSuccess(CMD_OK);
|
||||
inverter.EventLog()->setLastUpdate(millis());
|
||||
return true;
|
||||
}
|
||||
|
||||
void AlarmDataCommand::gotTimeout(InverterAbstract* inverter)
|
||||
void AlarmDataCommand::gotTimeout(InverterAbstract& inverter)
|
||||
{
|
||||
inverter->EventLog()->setLastAlarmRequestSuccess(CMD_NOK);
|
||||
inverter.EventLog()->setLastAlarmRequestSuccess(CMD_NOK);
|
||||
}
|
||||
@ -9,6 +9,6 @@ public:
|
||||
|
||||
virtual String getCommandName() const;
|
||||
|
||||
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||
virtual void gotTimeout(InverterAbstract* inverter);
|
||||
virtual bool handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||
virtual void gotTimeout(InverterAbstract& inverter);
|
||||
};
|
||||
@ -47,7 +47,7 @@ uint8_t ChannelChangeCommand::getChannel() const
|
||||
return _payload[12];
|
||||
}
|
||||
|
||||
bool ChannelChangeCommand::handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
||||
bool ChannelChangeCommand::handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -12,7 +12,7 @@ public:
|
||||
void setChannel(const uint8_t channel);
|
||||
uint8_t getChannel() const;
|
||||
|
||||
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||
virtual bool handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||
|
||||
virtual uint8_t getMaxResendCount();
|
||||
};
|
||||
@ -122,7 +122,7 @@ void CommandAbstract::convertSerialToPacketId(uint8_t buffer[], const uint64_t s
|
||||
buffer[0] = s.b[3];
|
||||
}
|
||||
|
||||
void CommandAbstract::gotTimeout(InverterAbstract* inverter)
|
||||
void CommandAbstract::gotTimeout(InverterAbstract& inverter)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -38,8 +38,8 @@ public:
|
||||
|
||||
virtual CommandAbstract* getRequestFrameCommand(const uint8_t frame_no);
|
||||
|
||||
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id) = 0;
|
||||
virtual void gotTimeout(InverterAbstract* inverter);
|
||||
virtual bool handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id) = 0;
|
||||
virtual void gotTimeout(InverterAbstract& inverter);
|
||||
|
||||
// Sets the amount how often the specific command is resent if all fragments where missing
|
||||
virtual uint8_t getMaxResendCount() const;
|
||||
|
||||
@ -39,7 +39,7 @@ void DevControlCommand::udpateCRC(const uint8_t len)
|
||||
_payload[10 + len + 1] = (uint8_t)(crc);
|
||||
}
|
||||
|
||||
bool DevControlCommand::handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
||||
bool DevControlCommand::handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
||||
{
|
||||
for (uint8_t i = 0; i < max_fragment_id; i++) {
|
||||
if (fragment[i].mainCmd != (_payload[0] | 0x80)) {
|
||||
|
||||
@ -7,7 +7,7 @@ class DevControlCommand : public CommandAbstract {
|
||||
public:
|
||||
explicit DevControlCommand(const uint64_t target_address = 0, const uint64_t router_address = 0);
|
||||
|
||||
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||
virtual bool handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||
|
||||
protected:
|
||||
void udpateCRC(const uint8_t len);
|
||||
|
||||
@ -34,7 +34,7 @@ String DevInfoAllCommand::getCommandName() const
|
||||
return "DevInfoAll";
|
||||
}
|
||||
|
||||
bool DevInfoAllCommand::handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
||||
bool DevInfoAllCommand::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)) {
|
||||
@ -43,13 +43,13 @@ bool DevInfoAllCommand::handleResponse(InverterAbstract* inverter, const fragmen
|
||||
|
||||
// Move all fragments into target buffer
|
||||
uint8_t offs = 0;
|
||||
inverter->DevInfo()->beginAppendFragment();
|
||||
inverter->DevInfo()->clearBufferAll();
|
||||
inverter.DevInfo()->beginAppendFragment();
|
||||
inverter.DevInfo()->clearBufferAll();
|
||||
for (uint8_t i = 0; i < max_fragment_id; i++) {
|
||||
inverter->DevInfo()->appendFragmentAll(offs, fragment[i].fragment, fragment[i].len);
|
||||
inverter.DevInfo()->appendFragmentAll(offs, fragment[i].fragment, fragment[i].len);
|
||||
offs += (fragment[i].len);
|
||||
}
|
||||
inverter->DevInfo()->endAppendFragment();
|
||||
inverter->DevInfo()->setLastUpdateAll(millis());
|
||||
inverter.DevInfo()->endAppendFragment();
|
||||
inverter.DevInfo()->setLastUpdateAll(millis());
|
||||
return true;
|
||||
}
|
||||
@ -9,5 +9,5 @@ public:
|
||||
|
||||
virtual String getCommandName() const;
|
||||
|
||||
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||
virtual bool handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||
};
|
||||
@ -34,7 +34,7 @@ String DevInfoSimpleCommand::getCommandName() const
|
||||
return "DevInfoSimple";
|
||||
}
|
||||
|
||||
bool DevInfoSimpleCommand::handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
||||
bool DevInfoSimpleCommand::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)) {
|
||||
@ -43,13 +43,13 @@ bool DevInfoSimpleCommand::handleResponse(InverterAbstract* inverter, const frag
|
||||
|
||||
// Move all fragments into target buffer
|
||||
uint8_t offs = 0;
|
||||
inverter->DevInfo()->beginAppendFragment();
|
||||
inverter->DevInfo()->clearBufferSimple();
|
||||
inverter.DevInfo()->beginAppendFragment();
|
||||
inverter.DevInfo()->clearBufferSimple();
|
||||
for (uint8_t i = 0; i < max_fragment_id; i++) {
|
||||
inverter->DevInfo()->appendFragmentSimple(offs, fragment[i].fragment, fragment[i].len);
|
||||
inverter.DevInfo()->appendFragmentSimple(offs, fragment[i].fragment, fragment[i].len);
|
||||
offs += (fragment[i].len);
|
||||
}
|
||||
inverter->DevInfo()->endAppendFragment();
|
||||
inverter->DevInfo()->setLastUpdateSimple(millis());
|
||||
inverter.DevInfo()->endAppendFragment();
|
||||
inverter.DevInfo()->setLastUpdateSimple(millis());
|
||||
return true;
|
||||
}
|
||||
@ -9,5 +9,5 @@ public:
|
||||
|
||||
virtual String getCommandName() const;
|
||||
|
||||
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||
virtual bool handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||
};
|
||||
@ -35,7 +35,7 @@ String GridOnProFilePara::getCommandName() const
|
||||
return "GridOnProFilePara";
|
||||
}
|
||||
|
||||
bool GridOnProFilePara::handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
||||
bool GridOnProFilePara::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)) {
|
||||
@ -44,13 +44,13 @@ bool GridOnProFilePara::handleResponse(InverterAbstract* inverter, const fragmen
|
||||
|
||||
// Move all fragments into target buffer
|
||||
uint8_t offs = 0;
|
||||
inverter->GridProfile()->beginAppendFragment();
|
||||
inverter->GridProfile()->clearBuffer();
|
||||
inverter.GridProfile()->beginAppendFragment();
|
||||
inverter.GridProfile()->clearBuffer();
|
||||
for (uint8_t i = 0; i < max_fragment_id; i++) {
|
||||
inverter->GridProfile()->appendFragment(offs, fragment[i].fragment, fragment[i].len);
|
||||
inverter.GridProfile()->appendFragment(offs, fragment[i].fragment, fragment[i].len);
|
||||
offs += (fragment[i].len);
|
||||
}
|
||||
inverter->GridProfile()->endAppendFragment();
|
||||
inverter->GridProfile()->setLastUpdate(millis());
|
||||
inverter.GridProfile()->endAppendFragment();
|
||||
inverter.GridProfile()->setLastUpdate(millis());
|
||||
return true;
|
||||
}
|
||||
@ -9,5 +9,5 @@ public:
|
||||
|
||||
virtual String getCommandName() const;
|
||||
|
||||
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||
virtual bool handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||
};
|
||||
@ -85,7 +85,7 @@ CommandAbstract* MultiDataCommand::getRequestFrameCommand(const uint8_t frame_no
|
||||
return &_cmdRequestFrame;
|
||||
}
|
||||
|
||||
bool MultiDataCommand::handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
||||
bool MultiDataCommand::handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
||||
{
|
||||
// All fragments are available --> Check CRC
|
||||
uint16_t crc = 0xffff, crcRcv = 0;
|
||||
|
||||
@ -14,7 +14,7 @@ public:
|
||||
|
||||
CommandAbstract* getRequestFrameCommand(const uint8_t frame_no);
|
||||
|
||||
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||
virtual bool handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||
|
||||
protected:
|
||||
void setDataType(const uint8_t data_type);
|
||||
|
||||
@ -44,20 +44,20 @@ String PowerControlCommand::getCommandName() const
|
||||
return "PowerControl";
|
||||
}
|
||||
|
||||
bool PowerControlCommand::handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
||||
bool PowerControlCommand::handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
||||
{
|
||||
if (!DevControlCommand::handleResponse(inverter, fragment, max_fragment_id)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
inverter->PowerCommand()->setLastUpdateCommand(millis());
|
||||
inverter->PowerCommand()->setLastPowerCommandSuccess(CMD_OK);
|
||||
inverter.PowerCommand()->setLastUpdateCommand(millis());
|
||||
inverter.PowerCommand()->setLastPowerCommandSuccess(CMD_OK);
|
||||
return true;
|
||||
}
|
||||
|
||||
void PowerControlCommand::gotTimeout(InverterAbstract* inverter)
|
||||
void PowerControlCommand::gotTimeout(InverterAbstract& inverter)
|
||||
{
|
||||
inverter->PowerCommand()->setLastPowerCommandSuccess(CMD_NOK);
|
||||
inverter.PowerCommand()->setLastPowerCommandSuccess(CMD_NOK);
|
||||
}
|
||||
|
||||
void PowerControlCommand::setPowerOn(const bool state)
|
||||
|
||||
@ -9,8 +9,8 @@ public:
|
||||
|
||||
virtual String getCommandName() const;
|
||||
|
||||
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||
virtual void gotTimeout(InverterAbstract* inverter);
|
||||
virtual bool handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||
virtual void gotTimeout(InverterAbstract& inverter);
|
||||
|
||||
void setPowerOn(const bool state);
|
||||
void setRestart();
|
||||
|
||||
@ -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();
|
||||
}
|
||||
@ -9,6 +9,6 @@ public:
|
||||
|
||||
virtual String getCommandName() const;
|
||||
|
||||
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||
virtual void gotTimeout(InverterAbstract* inverter);
|
||||
virtual bool handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||
virtual void gotTimeout(InverterAbstract& inverter);
|
||||
};
|
||||
@ -47,7 +47,7 @@ uint8_t RequestFrameCommand::getFrameNo() const
|
||||
return _payload[9] & (~0x80);
|
||||
}
|
||||
|
||||
bool RequestFrameCommand::handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
||||
bool RequestFrameCommand::handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -12,5 +12,5 @@ public:
|
||||
void setFrameNo(const uint8_t frame_no);
|
||||
uint8_t getFrameNo() const;
|
||||
|
||||
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||
virtual bool handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||
};
|
||||
@ -35,7 +35,7 @@ String SystemConfigParaCommand::getCommandName() const
|
||||
return "SystemConfigPara";
|
||||
}
|
||||
|
||||
bool SystemConfigParaCommand::handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
||||
bool SystemConfigParaCommand::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 SystemConfigParaCommand::handleResponse(InverterAbstract* inverter, const f
|
||||
// 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->SystemConfigPara()->getExpectedByteCount();
|
||||
const uint8_t expectedSize = inverter.SystemConfigPara()->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 SystemConfigParaCommand::handleResponse(InverterAbstract* inverter, const f
|
||||
|
||||
// Move all fragments into target buffer
|
||||
uint8_t offs = 0;
|
||||
inverter->SystemConfigPara()->beginAppendFragment();
|
||||
inverter->SystemConfigPara()->clearBuffer();
|
||||
inverter.SystemConfigPara()->beginAppendFragment();
|
||||
inverter.SystemConfigPara()->clearBuffer();
|
||||
for (uint8_t i = 0; i < max_fragment_id; i++) {
|
||||
inverter->SystemConfigPara()->appendFragment(offs, fragment[i].fragment, fragment[i].len);
|
||||
inverter.SystemConfigPara()->appendFragment(offs, fragment[i].fragment, fragment[i].len);
|
||||
offs += (fragment[i].len);
|
||||
}
|
||||
inverter->SystemConfigPara()->endAppendFragment();
|
||||
inverter->SystemConfigPara()->setLastUpdateRequest(millis());
|
||||
inverter->SystemConfigPara()->setLastLimitRequestSuccess(CMD_OK);
|
||||
inverter.SystemConfigPara()->endAppendFragment();
|
||||
inverter.SystemConfigPara()->setLastUpdateRequest(millis());
|
||||
inverter.SystemConfigPara()->setLastLimitRequestSuccess(CMD_OK);
|
||||
return true;
|
||||
}
|
||||
|
||||
void SystemConfigParaCommand::gotTimeout(InverterAbstract* inverter)
|
||||
void SystemConfigParaCommand::gotTimeout(InverterAbstract& inverter)
|
||||
{
|
||||
inverter->SystemConfigPara()->setLastLimitRequestSuccess(CMD_NOK);
|
||||
inverter.SystemConfigPara()->setLastLimitRequestSuccess(CMD_NOK);
|
||||
}
|
||||
@ -9,6 +9,6 @@ public:
|
||||
|
||||
virtual String getCommandName() const;
|
||||
|
||||
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||
virtual void gotTimeout(InverterAbstract* inverter);
|
||||
virtual bool handleResponse(InverterAbstract& inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||
virtual void gotTimeout(InverterAbstract& inverter);
|
||||
};
|
||||
@ -218,15 +218,15 @@ void InverterAbstract::addRxFragment(const uint8_t fragment[], const uint8_t len
|
||||
}
|
||||
|
||||
// Returns Zero on Success or the Fragment ID for retransmit or error code
|
||||
uint8_t InverterAbstract::verifyAllFragments(CommandAbstract* cmd)
|
||||
uint8_t InverterAbstract::verifyAllFragments(CommandAbstract& cmd)
|
||||
{
|
||||
// All missing
|
||||
if (_rxFragmentLastPacketId == 0) {
|
||||
Hoymiles.getMessageOutput()->println("All missing");
|
||||
if (cmd->getSendCount() <= cmd->getMaxResendCount()) {
|
||||
if (cmd.getSendCount() <= cmd.getMaxResendCount()) {
|
||||
return FRAGMENT_ALL_MISSING_RESEND;
|
||||
} else {
|
||||
cmd->gotTimeout(this);
|
||||
cmd.gotTimeout(*this);
|
||||
return FRAGMENT_ALL_MISSING_TIMEOUT;
|
||||
}
|
||||
}
|
||||
@ -234,10 +234,10 @@ uint8_t InverterAbstract::verifyAllFragments(CommandAbstract* cmd)
|
||||
// Last fragment is missing (the one with 0x80)
|
||||
if (_rxFragmentMaxPacketId == 0) {
|
||||
Hoymiles.getMessageOutput()->println("Last missing");
|
||||
if (_rxFragmentRetransmitCnt++ < cmd->getMaxRetransmitCount()) {
|
||||
if (_rxFragmentRetransmitCnt++ < cmd.getMaxRetransmitCount()) {
|
||||
return _rxFragmentLastPacketId + 1;
|
||||
} else {
|
||||
cmd->gotTimeout(this);
|
||||
cmd.gotTimeout(*this);
|
||||
return FRAGMENT_RETRANSMIT_TIMEOUT;
|
||||
}
|
||||
}
|
||||
@ -246,17 +246,17 @@ uint8_t InverterAbstract::verifyAllFragments(CommandAbstract* cmd)
|
||||
for (uint8_t i = 0; i < _rxFragmentMaxPacketId - 1; i++) {
|
||||
if (!_rxFragmentBuffer[i].wasReceived) {
|
||||
Hoymiles.getMessageOutput()->println("Middle missing");
|
||||
if (_rxFragmentRetransmitCnt++ < cmd->getMaxRetransmitCount()) {
|
||||
if (_rxFragmentRetransmitCnt++ < cmd.getMaxRetransmitCount()) {
|
||||
return i + 1;
|
||||
} else {
|
||||
cmd->gotTimeout(this);
|
||||
cmd.gotTimeout(*this);
|
||||
return FRAGMENT_RETRANSMIT_TIMEOUT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!cmd->handleResponse(this, _rxFragmentBuffer, _rxFragmentMaxPacketId)) {
|
||||
cmd->gotTimeout(this);
|
||||
if (!cmd.handleResponse(*this, _rxFragmentBuffer, _rxFragmentMaxPacketId)) {
|
||||
cmd.gotTimeout(*this);
|
||||
return FRAGMENT_HANDLE_ERROR;
|
||||
}
|
||||
|
||||
|
||||
@ -60,7 +60,7 @@ public:
|
||||
|
||||
void clearRxFragmentBuffer();
|
||||
void addRxFragment(const uint8_t fragment[], const uint8_t len);
|
||||
uint8_t verifyAllFragments(CommandAbstract* cmd);
|
||||
uint8_t verifyAllFragments(CommandAbstract& cmd);
|
||||
|
||||
virtual bool sendStatsRequest() = 0;
|
||||
virtual bool sendAlarmLogRequest(const bool force = false) = 0;
|
||||
|
||||
@ -214,7 +214,7 @@ void AlarmLogParser::setMessageType(const AlarmMessageType_t type)
|
||||
_messageType = type;
|
||||
}
|
||||
|
||||
void AlarmLogParser::getLogEntry(const uint8_t entryId, AlarmLogEntry_t* entry, const AlarmMessageLocale_t locale)
|
||||
void AlarmLogParser::getLogEntry(const uint8_t entryId, AlarmLogEntry_t& entry, const AlarmMessageLocale_t locale)
|
||||
{
|
||||
const uint8_t entryStartOffset = 2 + entryId * ALARM_LOG_ENTRY_SIZE;
|
||||
|
||||
@ -233,34 +233,34 @@ void AlarmLogParser::getLogEntry(const uint8_t entryId, AlarmLogEntry_t* entry,
|
||||
endTimeOffset = 12 * 60 * 60;
|
||||
}
|
||||
|
||||
entry->MessageId = _payloadAlarmLog[entryStartOffset + 1];
|
||||
entry->StartTime = (((uint16_t)_payloadAlarmLog[entryStartOffset + 4] << 8) | ((uint16_t)_payloadAlarmLog[entryStartOffset + 5])) + startTimeOffset + timezoneOffset;
|
||||
entry->EndTime = ((uint16_t)_payloadAlarmLog[entryStartOffset + 6] << 8) | ((uint16_t)_payloadAlarmLog[entryStartOffset + 7]);
|
||||
entry.MessageId = _payloadAlarmLog[entryStartOffset + 1];
|
||||
entry.StartTime = (((uint16_t)_payloadAlarmLog[entryStartOffset + 4] << 8) | ((uint16_t)_payloadAlarmLog[entryStartOffset + 5])) + startTimeOffset + timezoneOffset;
|
||||
entry.EndTime = ((uint16_t)_payloadAlarmLog[entryStartOffset + 6] << 8) | ((uint16_t)_payloadAlarmLog[entryStartOffset + 7]);
|
||||
|
||||
HOY_SEMAPHORE_GIVE();
|
||||
|
||||
if (entry->EndTime > 0) {
|
||||
entry->EndTime += (endTimeOffset + timezoneOffset);
|
||||
if (entry.EndTime > 0) {
|
||||
entry.EndTime += (endTimeOffset + timezoneOffset);
|
||||
}
|
||||
|
||||
switch (locale) {
|
||||
case AlarmMessageLocale_t::DE:
|
||||
entry->Message = "Unbekannt";
|
||||
entry.Message = "Unbekannt";
|
||||
break;
|
||||
case AlarmMessageLocale_t::FR:
|
||||
entry->Message = "Inconnu";
|
||||
entry.Message = "Inconnu";
|
||||
break;
|
||||
default:
|
||||
entry->Message = "Unknown";
|
||||
entry.Message = "Unknown";
|
||||
}
|
||||
|
||||
for (auto& msg : _alarmMessages) {
|
||||
if (msg.MessageId == entry->MessageId) {
|
||||
if (msg.MessageId == entry.MessageId) {
|
||||
if (msg.InverterType == _messageType) {
|
||||
entry->Message = getLocaleMessage(&msg, locale);
|
||||
entry.Message = getLocaleMessage(&msg, locale);
|
||||
break;
|
||||
} else if (msg.InverterType == AlarmMessageType_t::ALL) {
|
||||
entry->Message = getLocaleMessage(&msg, locale);
|
||||
entry.Message = getLocaleMessage(&msg, locale);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -43,7 +43,7 @@ public:
|
||||
void appendFragment(const uint8_t offset, const uint8_t* payload, const uint8_t len);
|
||||
|
||||
uint8_t getEntryCount() const;
|
||||
void getLogEntry(const uint8_t entryId, AlarmLogEntry_t* entry, const AlarmMessageLocale_t locale = AlarmMessageLocale_t::EN);
|
||||
void getLogEntry(const uint8_t entryId, AlarmLogEntry_t& entry, const AlarmMessageLocale_t locale = AlarmMessageLocale_t::EN);
|
||||
|
||||
void setLastAlarmRequestSuccess(const LastCommandSuccess status);
|
||||
LastCommandSuccess getLastAlarmRequestSuccess() const;
|
||||
|
||||
@ -8,9 +8,9 @@
|
||||
|
||||
DatastoreClass Datastore;
|
||||
|
||||
void DatastoreClass::init(Scheduler* scheduler)
|
||||
void DatastoreClass::init(Scheduler& scheduler)
|
||||
{
|
||||
scheduler->addTask(_loopTask);
|
||||
scheduler.addTask(_loopTask);
|
||||
_loopTask.setCallback(std::bind(&DatastoreClass::loop, this));
|
||||
_loopTask.setIterations(TASK_FOREVER);
|
||||
_loopTask.setInterval(1 * TASK_SECOND);
|
||||
|
||||
@ -1,4 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright (C) 2023 Thomas Basler and others
|
||||
*/
|
||||
#include "Display_Graphic.h"
|
||||
#include "Datastore.h"
|
||||
#include <NetworkSettings.h>
|
||||
@ -39,7 +42,7 @@ DisplayGraphicClass::~DisplayGraphicClass()
|
||||
delete _display;
|
||||
}
|
||||
|
||||
void DisplayGraphicClass::init(Scheduler* scheduler, const DisplayType_t type, const uint8_t data, const uint8_t clk, const uint8_t cs, const uint8_t reset)
|
||||
void DisplayGraphicClass::init(Scheduler& scheduler, const DisplayType_t type, const uint8_t data, const uint8_t clk, const uint8_t cs, const uint8_t reset)
|
||||
{
|
||||
_display_type = type;
|
||||
if (_display_type > DisplayType_t::None) {
|
||||
@ -50,7 +53,7 @@ void DisplayGraphicClass::init(Scheduler* scheduler, const DisplayType_t type, c
|
||||
setStatus(true);
|
||||
}
|
||||
|
||||
scheduler->addTask(_loopTask);
|
||||
scheduler.addTask(_loopTask);
|
||||
_loopTask.setCallback(std::bind(&DisplayGraphicClass::loop, this));
|
||||
_loopTask.setIterations(TASK_FOREVER);
|
||||
_loopTask.setInterval(_period);
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
|
||||
InverterSettingsClass InverterSettings;
|
||||
|
||||
void InverterSettingsClass::init(Scheduler* scheduler)
|
||||
void InverterSettingsClass::init(Scheduler& scheduler)
|
||||
{
|
||||
const CONFIG_T& config = Configuration.get();
|
||||
const PinMapping_t& pin = PinMapping.get();
|
||||
@ -88,12 +88,12 @@ void InverterSettingsClass::init(Scheduler* scheduler)
|
||||
MessageOutput.println("Invalid pin config");
|
||||
}
|
||||
|
||||
scheduler->addTask(_hoyTask);
|
||||
scheduler.addTask(_hoyTask);
|
||||
_hoyTask.setCallback(std::bind(&InverterSettingsClass::hoyLoop, this));
|
||||
_hoyTask.setIterations(TASK_FOREVER);
|
||||
_hoyTask.enable();
|
||||
|
||||
scheduler->addTask(_settingsTask);
|
||||
scheduler.addTask(_settingsTask);
|
||||
_settingsTask.setCallback(std::bind(&InverterSettingsClass::settingsLoop, this));
|
||||
_settingsTask.setIterations(TASK_FOREVER);
|
||||
_settingsTask.setInterval(INVERTER_UPDATE_SETTINGS_INTERVAL);
|
||||
|
||||
@ -41,7 +41,7 @@ LedSingleClass::LedSingleClass()
|
||||
{
|
||||
}
|
||||
|
||||
void LedSingleClass::init(Scheduler* scheduler)
|
||||
void LedSingleClass::init(Scheduler& scheduler)
|
||||
{
|
||||
bool ledActive = false;
|
||||
|
||||
@ -61,12 +61,12 @@ void LedSingleClass::init(Scheduler* scheduler)
|
||||
}
|
||||
|
||||
if (ledActive) {
|
||||
scheduler->addTask(_outputTask);
|
||||
scheduler.addTask(_outputTask);
|
||||
_outputTask.setCallback(std::bind(&LedSingleClass::outputLoop, this));
|
||||
_outputTask.setIterations(TASK_FOREVER);
|
||||
_outputTask.enable();
|
||||
|
||||
scheduler->addTask(_setTask);
|
||||
scheduler.addTask(_setTask);
|
||||
_setTask.setCallback(std::bind(&LedSingleClass::setLoop, this));
|
||||
_setTask.setInterval(LEDSINGLE_UPDATE_INTERVAL * TASK_MILLISECOND);
|
||||
_setTask.setIterations(TASK_FOREVER);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright (C) 2022 Thomas Basler and others
|
||||
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||
*/
|
||||
#include "MessageOutput.h"
|
||||
|
||||
@ -8,9 +8,9 @@
|
||||
|
||||
MessageOutputClass MessageOutput;
|
||||
|
||||
void MessageOutputClass::init(Scheduler* scheduler)
|
||||
void MessageOutputClass::init(Scheduler& scheduler)
|
||||
{
|
||||
scheduler->addTask(_loopTask);
|
||||
scheduler.addTask(_loopTask);
|
||||
_loopTask.setCallback(std::bind(&MessageOutputClass::loop, this));
|
||||
_loopTask.setIterations(TASK_FOREVER);
|
||||
_loopTask.enable();
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright (C) 2022 Thomas Basler and others
|
||||
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||
*/
|
||||
#include "MqttHandleDtu.h"
|
||||
#include "Configuration.h"
|
||||
@ -10,9 +10,9 @@
|
||||
|
||||
MqttHandleDtuClass MqttHandleDtu;
|
||||
|
||||
void MqttHandleDtuClass::init(Scheduler* scheduler)
|
||||
void MqttHandleDtuClass::init(Scheduler& scheduler)
|
||||
{
|
||||
scheduler->addTask(_loopTask);
|
||||
scheduler.addTask(_loopTask);
|
||||
_loopTask.setCallback(std::bind(&MqttHandleDtuClass::loop, this));
|
||||
_loopTask.setIterations(TASK_FOREVER);
|
||||
_loopTask.setInterval(Configuration.get().Mqtt.PublishInterval * TASK_SECOND);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright (C) 2022 Thomas Basler and others
|
||||
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||
*/
|
||||
#include "MqttHandleHass.h"
|
||||
#include "MqttHandleInverter.h"
|
||||
@ -9,9 +9,9 @@
|
||||
|
||||
MqttHandleHassClass MqttHandleHass;
|
||||
|
||||
void MqttHandleHassClass::init(Scheduler* scheduler)
|
||||
void MqttHandleHassClass::init(Scheduler& scheduler)
|
||||
{
|
||||
scheduler->addTask(_loopTask);
|
||||
scheduler.addTask(_loopTask);
|
||||
_loopTask.setCallback(std::bind(&MqttHandleHassClass::loop, this));
|
||||
_loopTask.setIterations(TASK_FOREVER);
|
||||
_loopTask.enable();
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright (C) 2022 Thomas Basler and others
|
||||
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||
*/
|
||||
#include "MqttHandleInverter.h"
|
||||
#include "MessageOutput.h"
|
||||
@ -18,7 +18,7 @@
|
||||
|
||||
MqttHandleInverterClass MqttHandleInverter;
|
||||
|
||||
void MqttHandleInverterClass::init(Scheduler* scheduler)
|
||||
void MqttHandleInverterClass::init(Scheduler& scheduler)
|
||||
{
|
||||
using std::placeholders::_1;
|
||||
using std::placeholders::_2;
|
||||
@ -35,7 +35,7 @@ void MqttHandleInverterClass::init(Scheduler* scheduler)
|
||||
MqttSettings.subscribe(String(topic + "+/cmd/" + TOPIC_SUB_POWER).c_str(), 0, std::bind(&MqttHandleInverterClass::onMqttMessage, this, _1, _2, _3, _4, _5, _6));
|
||||
MqttSettings.subscribe(String(topic + "+/cmd/" + TOPIC_SUB_RESTART).c_str(), 0, std::bind(&MqttHandleInverterClass::onMqttMessage, this, _1, _2, _3, _4, _5, _6));
|
||||
|
||||
scheduler->addTask(_loopTask);
|
||||
scheduler.addTask(_loopTask);
|
||||
_loopTask.setCallback(std::bind(&MqttHandleInverterClass::loop, this));
|
||||
_loopTask.setIterations(TASK_FOREVER);
|
||||
_loopTask.setInterval(Configuration.get().Mqtt.PublishInterval * TASK_SECOND);
|
||||
|
||||
@ -10,9 +10,9 @@
|
||||
|
||||
MqttHandleInverterTotalClass MqttHandleInverterTotal;
|
||||
|
||||
void MqttHandleInverterTotalClass::init(Scheduler* scheduler)
|
||||
void MqttHandleInverterTotalClass::init(Scheduler& scheduler)
|
||||
{
|
||||
scheduler->addTask(_loopTask);
|
||||
scheduler.addTask(_loopTask);
|
||||
_loopTask.setCallback(std::bind(&MqttHandleInverterTotalClass::loop, this));
|
||||
_loopTask.setIterations(TASK_FOREVER);
|
||||
_loopTask.setInterval(Configuration.get().Mqtt.PublishInterval * TASK_SECOND);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright (C) 2022 Thomas Basler and others
|
||||
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||
*/
|
||||
#include "NetworkSettings.h"
|
||||
#include "Configuration.h"
|
||||
@ -18,7 +18,7 @@ NetworkSettingsClass::NetworkSettingsClass()
|
||||
dnsServer.reset(new DNSServer());
|
||||
}
|
||||
|
||||
void NetworkSettingsClass::init(Scheduler* scheduler)
|
||||
void NetworkSettingsClass::init(Scheduler& scheduler)
|
||||
{
|
||||
using std::placeholders::_1;
|
||||
|
||||
@ -28,7 +28,7 @@ void NetworkSettingsClass::init(Scheduler* scheduler)
|
||||
WiFi.onEvent(std::bind(&NetworkSettingsClass::NetworkEvent, this, _1));
|
||||
setupMode();
|
||||
|
||||
scheduler->addTask(_loopTask);
|
||||
scheduler.addTask(_loopTask);
|
||||
_loopTask.setCallback(std::bind(&NetworkSettingsClass::loop, this));
|
||||
_loopTask.setIterations(TASK_FOREVER);
|
||||
_loopTask.enable();
|
||||
|
||||
@ -13,9 +13,9 @@ SunPositionClass::SunPositionClass()
|
||||
{
|
||||
}
|
||||
|
||||
void SunPositionClass::init(Scheduler* scheduler)
|
||||
void SunPositionClass::init(Scheduler& scheduler)
|
||||
{
|
||||
scheduler->addTask(_loopTask);
|
||||
scheduler.addTask(_loopTask);
|
||||
_loopTask.setCallback(std::bind(&SunPositionClass::loop, this));
|
||||
_loopTask.setIterations(TASK_FOREVER);
|
||||
_loopTask.setInterval(5 * TASK_SECOND);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright (C) 2022 Thomas Basler and others
|
||||
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||
*/
|
||||
#include "WebApi.h"
|
||||
#include "Configuration.h"
|
||||
@ -12,32 +12,32 @@ WebApiClass::WebApiClass()
|
||||
{
|
||||
}
|
||||
|
||||
void WebApiClass::init(Scheduler* scheduler)
|
||||
void WebApiClass::init(Scheduler& scheduler)
|
||||
{
|
||||
_webApiConfig.init(&_server);
|
||||
_webApiDevice.init(&_server);
|
||||
_webApiDevInfo.init(&_server);
|
||||
_webApiDtu.init(&_server);
|
||||
_webApiEventlog.init(&_server);
|
||||
_webApiFirmware.init(&_server);
|
||||
_webApiGridprofile.init(&_server);
|
||||
_webApiInverter.init(&_server);
|
||||
_webApiLimit.init(&_server);
|
||||
_webApiMaintenance.init(&_server);
|
||||
_webApiMqtt.init(&_server);
|
||||
_webApiNetwork.init(&_server);
|
||||
_webApiNtp.init(&_server);
|
||||
_webApiPower.init(&_server);
|
||||
_webApiPrometheus.init(&_server);
|
||||
_webApiSecurity.init(&_server);
|
||||
_webApiSysstatus.init(&_server);
|
||||
_webApiWebapp.init(&_server);
|
||||
_webApiWsConsole.init(&_server);
|
||||
_webApiWsLive.init(&_server);
|
||||
_webApiConfig.init(_server);
|
||||
_webApiDevice.init(_server);
|
||||
_webApiDevInfo.init(_server);
|
||||
_webApiDtu.init(_server);
|
||||
_webApiEventlog.init(_server);
|
||||
_webApiFirmware.init(_server);
|
||||
_webApiGridprofile.init(_server);
|
||||
_webApiInverter.init(_server);
|
||||
_webApiLimit.init(_server);
|
||||
_webApiMaintenance.init(_server);
|
||||
_webApiMqtt.init(_server);
|
||||
_webApiNetwork.init(_server);
|
||||
_webApiNtp.init(_server);
|
||||
_webApiPower.init(_server);
|
||||
_webApiPrometheus.init(_server);
|
||||
_webApiSecurity.init(_server);
|
||||
_webApiSysstatus.init(_server);
|
||||
_webApiWebapp.init(_server);
|
||||
_webApiWsConsole.init(_server);
|
||||
_webApiWsLive.init(_server);
|
||||
|
||||
_server.begin();
|
||||
|
||||
scheduler->addTask(_loopTask);
|
||||
scheduler.addTask(_loopTask);
|
||||
_loopTask.setCallback(std::bind(&WebApiClass::loop, this));
|
||||
_loopTask.setIterations(TASK_FOREVER);
|
||||
_loopTask.enable();
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright (C) 2022 Thomas Basler and others
|
||||
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||
*/
|
||||
#include "WebApi_config.h"
|
||||
#include "Configuration.h"
|
||||
@ -10,7 +10,7 @@
|
||||
#include <AsyncJson.h>
|
||||
#include <LittleFS.h>
|
||||
|
||||
void WebApiConfigClass::init(AsyncWebServer* server)
|
||||
void WebApiConfigClass::init(AsyncWebServer& server)
|
||||
{
|
||||
using std::placeholders::_1;
|
||||
using std::placeholders::_2;
|
||||
@ -19,7 +19,7 @@ void WebApiConfigClass::init(AsyncWebServer* server)
|
||||
using std::placeholders::_5;
|
||||
using std::placeholders::_6;
|
||||
|
||||
_server = server;
|
||||
_server = &server;
|
||||
|
||||
_server->on("/api/config/get", HTTP_GET, std::bind(&WebApiConfigClass::onConfigGet, this, _1));
|
||||
_server->on("/api/config/delete", HTTP_POST, std::bind(&WebApiConfigClass::onConfigDelete, this, _1));
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright (C) 2022 Thomas Basler and others
|
||||
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||
*/
|
||||
#include "WebApi_device.h"
|
||||
#include "Configuration.h"
|
||||
@ -12,11 +12,11 @@
|
||||
#include "helper.h"
|
||||
#include <AsyncJson.h>
|
||||
|
||||
void WebApiDeviceClass::init(AsyncWebServer* server)
|
||||
void WebApiDeviceClass::init(AsyncWebServer& server)
|
||||
{
|
||||
using std::placeholders::_1;
|
||||
|
||||
_server = server;
|
||||
_server = &server;
|
||||
|
||||
_server->on("/api/device/config", HTTP_GET, std::bind(&WebApiDeviceClass::onDeviceAdminGet, this, _1));
|
||||
_server->on("/api/device/config", HTTP_POST, std::bind(&WebApiDeviceClass::onDeviceAdminPost, this, _1));
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright (C) 2022 Thomas Basler and others
|
||||
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||
*/
|
||||
#include "WebApi_devinfo.h"
|
||||
#include "WebApi.h"
|
||||
@ -8,11 +8,11 @@
|
||||
#include <Hoymiles.h>
|
||||
#include <ctime>
|
||||
|
||||
void WebApiDevInfoClass::init(AsyncWebServer* server)
|
||||
void WebApiDevInfoClass::init(AsyncWebServer& server)
|
||||
{
|
||||
using std::placeholders::_1;
|
||||
|
||||
_server = server;
|
||||
_server = &server;
|
||||
|
||||
_server->on("/api/devinfo/status", HTTP_GET, std::bind(&WebApiDevInfoClass::onDevInfoStatus, this, _1));
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright (C) 2022 Thomas Basler and others
|
||||
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||
*/
|
||||
#include "WebApi_dtu.h"
|
||||
#include "Configuration.h"
|
||||
@ -9,11 +9,11 @@
|
||||
#include <AsyncJson.h>
|
||||
#include <Hoymiles.h>
|
||||
|
||||
void WebApiDtuClass::init(AsyncWebServer* server)
|
||||
void WebApiDtuClass::init(AsyncWebServer& server)
|
||||
{
|
||||
using std::placeholders::_1;
|
||||
|
||||
_server = server;
|
||||
_server = &server;
|
||||
|
||||
_server->on("/api/dtu/config", HTTP_GET, std::bind(&WebApiDtuClass::onDtuAdminGet, this, _1));
|
||||
_server->on("/api/dtu/config", HTTP_POST, std::bind(&WebApiDtuClass::onDtuAdminPost, this, _1));
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright (C) 2022 Thomas Basler and others
|
||||
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||
*/
|
||||
#include "WebApi_eventlog.h"
|
||||
#include "WebApi.h"
|
||||
#include <AsyncJson.h>
|
||||
#include <Hoymiles.h>
|
||||
|
||||
void WebApiEventlogClass::init(AsyncWebServer* server)
|
||||
void WebApiEventlogClass::init(AsyncWebServer& server)
|
||||
{
|
||||
using std::placeholders::_1;
|
||||
|
||||
_server = server;
|
||||
_server = &server;
|
||||
|
||||
_server->on("/api/eventlog/status", HTTP_GET, std::bind(&WebApiEventlogClass::onEventlogStatus, this, _1));
|
||||
}
|
||||
@ -59,7 +59,7 @@ void WebApiEventlogClass::onEventlogStatus(AsyncWebServerRequest* request)
|
||||
JsonObject eventsObject = eventsArray.createNestedObject();
|
||||
|
||||
AlarmLogEntry_t entry;
|
||||
inv->EventLog()->getLogEntry(logEntry, &entry, locale);
|
||||
inv->EventLog()->getLogEntry(logEntry, entry, locale);
|
||||
|
||||
eventsObject["message_id"] = entry.MessageId;
|
||||
eventsObject["message"] = entry.Message;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright (C) 2022 Thomas Basler and others
|
||||
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||
*/
|
||||
#include "WebApi_firmware.h"
|
||||
#include "Configuration.h"
|
||||
@ -10,7 +10,7 @@
|
||||
#include "helper.h"
|
||||
#include <AsyncJson.h>
|
||||
|
||||
void WebApiFirmwareClass::init(AsyncWebServer* server)
|
||||
void WebApiFirmwareClass::init(AsyncWebServer& server)
|
||||
{
|
||||
using std::placeholders::_1;
|
||||
using std::placeholders::_2;
|
||||
@ -19,7 +19,7 @@ void WebApiFirmwareClass::init(AsyncWebServer* server)
|
||||
using std::placeholders::_5;
|
||||
using std::placeholders::_6;
|
||||
|
||||
_server = server;
|
||||
_server = &server;
|
||||
|
||||
_server->on("/api/firmware/update", HTTP_POST,
|
||||
std::bind(&WebApiFirmwareClass::onFirmwareUpdateFinish, this, _1),
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright (C) 2022 Thomas Basler and others
|
||||
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||
*/
|
||||
#include "WebApi_gridprofile.h"
|
||||
#include "WebApi.h"
|
||||
#include <AsyncJson.h>
|
||||
#include <Hoymiles.h>
|
||||
|
||||
void WebApiGridProfileClass::init(AsyncWebServer* server)
|
||||
void WebApiGridProfileClass::init(AsyncWebServer& server)
|
||||
{
|
||||
using std::placeholders::_1;
|
||||
|
||||
_server = server;
|
||||
_server = &server;
|
||||
|
||||
_server->on("/api/gridprofile/status", HTTP_GET, std::bind(&WebApiGridProfileClass::onGridProfileStatus, this, _1));
|
||||
_server->on("/api/gridprofile/rawdata", HTTP_GET, std::bind(&WebApiGridProfileClass::onGridProfileRawdata, this, _1));
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright (C) 2022 Thomas Basler and others
|
||||
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||
*/
|
||||
#include "WebApi_inverter.h"
|
||||
#include "Configuration.h"
|
||||
@ -12,11 +12,11 @@
|
||||
#include <AsyncJson.h>
|
||||
#include <Hoymiles.h>
|
||||
|
||||
void WebApiInverterClass::init(AsyncWebServer* server)
|
||||
void WebApiInverterClass::init(AsyncWebServer& server)
|
||||
{
|
||||
using std::placeholders::_1;
|
||||
|
||||
_server = server;
|
||||
_server = &server;
|
||||
|
||||
_server->on("/api/inverter/list", HTTP_GET, std::bind(&WebApiInverterClass::onInverterList, this, _1));
|
||||
_server->on("/api/inverter/add", HTTP_POST, std::bind(&WebApiInverterClass::onInverterAdd, this, _1));
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright (C) 2022 Thomas Basler and others
|
||||
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||
*/
|
||||
#include "WebApi_limit.h"
|
||||
#include "WebApi.h"
|
||||
@ -8,11 +8,11 @@
|
||||
#include <AsyncJson.h>
|
||||
#include <Hoymiles.h>
|
||||
|
||||
void WebApiLimitClass::init(AsyncWebServer* server)
|
||||
void WebApiLimitClass::init(AsyncWebServer& server)
|
||||
{
|
||||
using std::placeholders::_1;
|
||||
|
||||
_server = server;
|
||||
_server = &server;
|
||||
|
||||
_server->on("/api/limit/status", HTTP_GET, std::bind(&WebApiLimitClass::onLimitStatus, this, _1));
|
||||
_server->on("/api/limit/config", HTTP_POST, std::bind(&WebApiLimitClass::onLimitPost, this, _1));
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright (C) 2022 Thomas Basler and others
|
||||
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||
*/
|
||||
|
||||
#include "WebApi_maintenance.h"
|
||||
@ -9,11 +9,11 @@
|
||||
#include "WebApi_errors.h"
|
||||
#include <AsyncJson.h>
|
||||
|
||||
void WebApiMaintenanceClass::init(AsyncWebServer* server)
|
||||
void WebApiMaintenanceClass::init(AsyncWebServer& server)
|
||||
{
|
||||
using std::placeholders::_1;
|
||||
|
||||
_server = server;
|
||||
_server = &server;
|
||||
|
||||
_server->on("/api/maintenance/reboot", HTTP_POST, std::bind(&WebApiMaintenanceClass::onRebootPost, this, _1));
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright (C) 2022 Thomas Basler and others
|
||||
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||
*/
|
||||
#include "WebApi_mqtt.h"
|
||||
#include "Configuration.h"
|
||||
@ -11,11 +11,11 @@
|
||||
#include "helper.h"
|
||||
#include <AsyncJson.h>
|
||||
|
||||
void WebApiMqttClass::init(AsyncWebServer* server)
|
||||
void WebApiMqttClass::init(AsyncWebServer& server)
|
||||
{
|
||||
using std::placeholders::_1;
|
||||
|
||||
_server = server;
|
||||
_server = &server;
|
||||
|
||||
_server->on("/api/mqtt/status", HTTP_GET, std::bind(&WebApiMqttClass::onMqttStatus, this, _1));
|
||||
_server->on("/api/mqtt/config", HTTP_GET, std::bind(&WebApiMqttClass::onMqttAdminGet, this, _1));
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright (C) 2022 Thomas Basler and others
|
||||
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||
*/
|
||||
#include "WebApi_network.h"
|
||||
#include "Configuration.h"
|
||||
@ -10,11 +10,11 @@
|
||||
#include "helper.h"
|
||||
#include <AsyncJson.h>
|
||||
|
||||
void WebApiNetworkClass::init(AsyncWebServer* server)
|
||||
void WebApiNetworkClass::init(AsyncWebServer& server)
|
||||
{
|
||||
using std::placeholders::_1;
|
||||
|
||||
_server = server;
|
||||
_server = &server;
|
||||
|
||||
_server->on("/api/network/status", HTTP_GET, std::bind(&WebApiNetworkClass::onNetworkStatus, this, _1));
|
||||
_server->on("/api/network/config", HTTP_GET, std::bind(&WebApiNetworkClass::onNetworkAdminGet, this, _1));
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright (C) 2022 Thomas Basler and others
|
||||
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||
*/
|
||||
#include "WebApi_ntp.h"
|
||||
#include "Configuration.h"
|
||||
@ -11,11 +11,11 @@
|
||||
#include "helper.h"
|
||||
#include <AsyncJson.h>
|
||||
|
||||
void WebApiNtpClass::init(AsyncWebServer* server)
|
||||
void WebApiNtpClass::init(AsyncWebServer& server)
|
||||
{
|
||||
using std::placeholders::_1;
|
||||
|
||||
_server = server;
|
||||
_server = &server;
|
||||
|
||||
_server->on("/api/ntp/status", HTTP_GET, std::bind(&WebApiNtpClass::onNtpStatus, this, _1));
|
||||
_server->on("/api/ntp/config", HTTP_GET, std::bind(&WebApiNtpClass::onNtpAdminGet, this, _1));
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright (C) 2022 Thomas Basler and others
|
||||
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||
*/
|
||||
#include "WebApi_power.h"
|
||||
#include "WebApi.h"
|
||||
@ -8,11 +8,11 @@
|
||||
#include <AsyncJson.h>
|
||||
#include <Hoymiles.h>
|
||||
|
||||
void WebApiPowerClass::init(AsyncWebServer* server)
|
||||
void WebApiPowerClass::init(AsyncWebServer& server)
|
||||
{
|
||||
using std::placeholders::_1;
|
||||
|
||||
_server = server;
|
||||
_server = &server;
|
||||
|
||||
_server->on("/api/power/status", HTTP_GET, std::bind(&WebApiPowerClass::onPowerStatus, this, _1));
|
||||
_server->on("/api/power/config", HTTP_POST, std::bind(&WebApiPowerClass::onPowerPost, this, _1));
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright (C) 2022 Thomas Basler and others
|
||||
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||
*/
|
||||
#include "WebApi_prometheus.h"
|
||||
#include "Configuration.h"
|
||||
@ -10,11 +10,11 @@
|
||||
#include "WebApi.h"
|
||||
#include <Hoymiles.h>
|
||||
|
||||
void WebApiPrometheusClass::init(AsyncWebServer* server)
|
||||
void WebApiPrometheusClass::init(AsyncWebServer& server)
|
||||
{
|
||||
using std::placeholders::_1;
|
||||
|
||||
_server = server;
|
||||
_server = &server;
|
||||
|
||||
_server->on("/api/prometheus/metrics", HTTP_GET, std::bind(&WebApiPrometheusClass::onPrometheusMetricsGet, this, _1));
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright (C) 2022 Thomas Basler and others
|
||||
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||
*/
|
||||
#include "WebApi_security.h"
|
||||
#include "Configuration.h"
|
||||
@ -9,11 +9,11 @@
|
||||
#include "helper.h"
|
||||
#include <AsyncJson.h>
|
||||
|
||||
void WebApiSecurityClass::init(AsyncWebServer* server)
|
||||
void WebApiSecurityClass::init(AsyncWebServer& server)
|
||||
{
|
||||
using std::placeholders::_1;
|
||||
|
||||
_server = server;
|
||||
_server = &server;
|
||||
|
||||
_server->on("/api/security/config", HTTP_GET, std::bind(&WebApiSecurityClass::onSecurityGet, this, _1));
|
||||
_server->on("/api/security/config", HTTP_POST, std::bind(&WebApiSecurityClass::onSecurityPost, this, _1));
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
/*
|
||||
* Copyright (C) 2022 Thomas Basler and others
|
||||
* Copyright (C) 2022-2023 Thomas Basler and others
|
||||
*/
|
||||
#include "WebApi_sysstatus.h"
|
||||
#include "Configuration.h"
|
||||
@ -16,11 +16,11 @@
|
||||
#define AUTO_GIT_HASH ""
|
||||
#endif
|
||||
|
||||
void WebApiSysstatusClass::init(AsyncWebServer* server)
|
||||
void WebApiSysstatusClass::init(AsyncWebServer& server)
|
||||
{
|
||||
using std::placeholders::_1;
|
||||
|
||||
_server = server;
|
||||
_server = &server;
|
||||
|
||||
_server->on("/api/system/status", HTTP_GET, std::bind(&WebApiSysstatusClass::onSystemStatus, this, _1));
|
||||
}
|
||||
|
||||
@ -18,9 +18,9 @@ extern const uint8_t file_zones_json_end[] asm("_binary_webapp_dist_zones_json_g
|
||||
extern const uint8_t file_app_js_end[] asm("_binary_webapp_dist_js_app_js_gz_end");
|
||||
extern const uint8_t file_site_webmanifest_end[] asm("_binary_webapp_dist_site_webmanifest_end");
|
||||
|
||||
void WebApiWebappClass::init(AsyncWebServer* server)
|
||||
void WebApiWebappClass::init(AsyncWebServer& server)
|
||||
{
|
||||
_server = server;
|
||||
_server = &server;
|
||||
|
||||
_server->on("/", HTTP_GET, [](AsyncWebServerRequest* request) {
|
||||
AsyncWebServerResponse* response = request->beginResponse_P(200, "text/html", file_index_html_start, file_index_html_end - file_index_html_start);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user