From c8c6b2a978d684a14a8a00f62a2c7ed606385953 Mon Sep 17 00:00:00 2001 From: Thomas Basler Date: Sun, 2 Oct 2022 16:36:25 +0200 Subject: [PATCH] Renamed DevInfoSample to DevInfoSimple --- ...pleCommand.cpp => DevInfoSimpleCommand.cpp} | 10 +++++----- ...oSampleCommand.h => DevInfoSimpleCommand.h} | 4 ++-- lib/Hoymiles/src/commands/README.md | 2 +- lib/Hoymiles/src/inverters/HM_Abstract.cpp | 4 ++-- lib/Hoymiles/src/parser/DevInfoParser.cpp | 18 +++++++++--------- lib/Hoymiles/src/parser/DevInfoParser.h | 8 ++++---- 6 files changed, 23 insertions(+), 23 deletions(-) rename lib/Hoymiles/src/commands/{DevInfoSampleCommand.cpp => DevInfoSimpleCommand.cpp} (71%) rename lib/Hoymiles/src/commands/{DevInfoSampleCommand.h => DevInfoSimpleCommand.h} (63%) diff --git a/lib/Hoymiles/src/commands/DevInfoSampleCommand.cpp b/lib/Hoymiles/src/commands/DevInfoSimpleCommand.cpp similarity index 71% rename from lib/Hoymiles/src/commands/DevInfoSampleCommand.cpp rename to lib/Hoymiles/src/commands/DevInfoSimpleCommand.cpp index 58bec8c9..ef232e2b 100644 --- a/lib/Hoymiles/src/commands/DevInfoSampleCommand.cpp +++ b/lib/Hoymiles/src/commands/DevInfoSimpleCommand.cpp @@ -1,7 +1,7 @@ -#include "DevInfoSampleCommand.h" +#include "DevInfoSimpleCommand.h" #include "inverters/InverterAbstract.h" -DevInfoSampleCommand::DevInfoSampleCommand(uint64_t target_address, uint64_t router_address, time_t time) +DevInfoSimpleCommand::DevInfoSimpleCommand(uint64_t target_address, uint64_t router_address, time_t time) : MultiDataCommand(target_address, router_address) { setTime(time); @@ -9,7 +9,7 @@ DevInfoSampleCommand::DevInfoSampleCommand(uint64_t target_address, uint64_t rou setTimeout(200); } -bool DevInfoSampleCommand::handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id) +bool DevInfoSimpleCommand::handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id) { // Check CRC of whole payload if (!MultiDataCommand::handleResponse(inverter, fragment, max_fragment_id)) { @@ -18,9 +18,9 @@ bool DevInfoSampleCommand::handleResponse(InverterAbstract* inverter, fragment_t // Move all fragments into target buffer uint8_t offs = 0; - inverter->DevInfo()->clearBufferSample(); + inverter->DevInfo()->clearBufferSimple(); for (uint8_t i = 0; i < max_fragment_id; i++) { - inverter->DevInfo()->appendFragmentSample(offs, fragment[i].fragment, fragment[i].len); + inverter->DevInfo()->appendFragmentSimple(offs, fragment[i].fragment, fragment[i].len); offs += (fragment[i].len); } inverter->DevInfo()->setLastUpdateSample(millis()); diff --git a/lib/Hoymiles/src/commands/DevInfoSampleCommand.h b/lib/Hoymiles/src/commands/DevInfoSimpleCommand.h similarity index 63% rename from lib/Hoymiles/src/commands/DevInfoSampleCommand.h rename to lib/Hoymiles/src/commands/DevInfoSimpleCommand.h index 4bc7aaf9..cd0dd952 100644 --- a/lib/Hoymiles/src/commands/DevInfoSampleCommand.h +++ b/lib/Hoymiles/src/commands/DevInfoSimpleCommand.h @@ -2,9 +2,9 @@ #include "MultiDataCommand.h" -class DevInfoSampleCommand : public MultiDataCommand { +class DevInfoSimpleCommand : public MultiDataCommand { public: - explicit DevInfoSampleCommand(uint64_t target_address = 0, uint64_t router_address = 0, time_t time = 0); + explicit DevInfoSimpleCommand(uint64_t target_address = 0, uint64_t router_address = 0, time_t time = 0); virtual bool handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id); }; \ No newline at end of file diff --git a/lib/Hoymiles/src/commands/README.md b/lib/Hoymiles/src/commands/README.md index c55e8cb0..6f5f1d45 100644 --- a/lib/Hoymiles/src/commands/README.md +++ b/lib/Hoymiles/src/commands/README.md @@ -6,7 +6,7 @@ * MultiDataCommand * AlarmDataCommand * DevInfoAllCommand - * DevInfoSampleCommand + * DevInfoSimpleCommand * RealTimeRunDataCommand * SystemConfigParaCommand * ParaSetCommand diff --git a/lib/Hoymiles/src/inverters/HM_Abstract.cpp b/lib/Hoymiles/src/inverters/HM_Abstract.cpp index 31a68952..a4636bff 100644 --- a/lib/Hoymiles/src/inverters/HM_Abstract.cpp +++ b/lib/Hoymiles/src/inverters/HM_Abstract.cpp @@ -3,7 +3,7 @@ #include "commands/ActivePowerControlCommand.h" #include "commands/AlarmDataCommand.h" #include "commands/DevInfoAllCommand.h" -#include "commands/DevInfoSampleCommand.h" +#include "commands/DevInfoSimpleCommand.h" #include "commands/RealTimeRunDataCommand.h" #include "commands/SystemConfigParaCommand.h" @@ -69,7 +69,7 @@ bool HM_Abstract::sendDevInfoRequest(HoymilesRadio* radio) cmdAll->setTime(now); cmdAll->setTargetAddress(serial()); - DevInfoSampleCommand* cmdSample = radio->enqueCommand(); + DevInfoSimpleCommand* cmdSample = radio->enqueCommand(); cmdSample->setTime(now); cmdSample->setTargetAddress(serial()); diff --git a/lib/Hoymiles/src/parser/DevInfoParser.cpp b/lib/Hoymiles/src/parser/DevInfoParser.cpp index d1773c93..419dab03 100644 --- a/lib/Hoymiles/src/parser/DevInfoParser.cpp +++ b/lib/Hoymiles/src/parser/DevInfoParser.cpp @@ -17,20 +17,20 @@ void DevInfoParser::appendFragmentAll(uint8_t offset, uint8_t* payload, uint8_t _devInfoAllLength += len; } -void DevInfoParser::clearBufferSample() +void DevInfoParser::clearBufferSimple() { - memset(_payloadDevInfoSample, 0, DEV_INFO_SIZE); - _devInfoSampleLength = 0; + memset(_payloadDevInfoSimple, 0, DEV_INFO_SIZE); + _devInfoSimpleLength = 0; } -void DevInfoParser::appendFragmentSample(uint8_t offset, uint8_t* payload, uint8_t len) +void DevInfoParser::appendFragmentSimple(uint8_t offset, uint8_t* payload, uint8_t len) { if (offset + len > DEV_INFO_SIZE) { Serial.printf("FATAL: (%s, %d) dev info Sample packet too large for buffer\n", __FILE__, __LINE__); return; } - memcpy(&_payloadDevInfoSample[offset], payload, len); - _devInfoSampleLength += len; + memcpy(&_payloadDevInfoSimple[offset], payload, len); + _devInfoSimpleLength += len; } uint32_t DevInfoParser::getLastUpdateAll() @@ -84,15 +84,15 @@ uint32_t DevInfoParser::getHwPartNumber() uint16_t hwpn_h; uint16_t hwpn_l; - hwpn_h = (((uint16_t)_payloadDevInfoSample[2]) << 8) | _payloadDevInfoSample[3]; - hwpn_l = (((uint16_t)_payloadDevInfoSample[4]) << 8) | _payloadDevInfoSample[5]; + hwpn_h = (((uint16_t)_payloadDevInfoSimple[2]) << 8) | _payloadDevInfoSimple[3]; + hwpn_l = (((uint16_t)_payloadDevInfoSimple[4]) << 8) | _payloadDevInfoSimple[5]; return ((uint32_t)hwpn_h << 16) | ((uint32_t)hwpn_l); } uint16_t DevInfoParser::getHwVersion() { - return (((uint16_t)_payloadDevInfoSample[6]) << 8) | _payloadDevInfoSample[7]; + return (((uint16_t)_payloadDevInfoSimple[6]) << 8) | _payloadDevInfoSimple[7]; } /* struct tm to seconds since Unix epoch */ diff --git a/lib/Hoymiles/src/parser/DevInfoParser.h b/lib/Hoymiles/src/parser/DevInfoParser.h index 9cc878d0..de0c1773 100644 --- a/lib/Hoymiles/src/parser/DevInfoParser.h +++ b/lib/Hoymiles/src/parser/DevInfoParser.h @@ -9,8 +9,8 @@ public: void clearBufferAll(); void appendFragmentAll(uint8_t offset, uint8_t* payload, uint8_t len); - void clearBufferSample(); - void appendFragmentSample(uint8_t offset, uint8_t* payload, uint8_t len); + void clearBufferSimple(); + void appendFragmentSimple(uint8_t offset, uint8_t* payload, uint8_t len); uint32_t getLastUpdateAll(); void setLastUpdateAll(uint32_t lastUpdate); @@ -34,6 +34,6 @@ private: uint8_t _payloadDevInfoAll[DEV_INFO_SIZE] = {}; uint8_t _devInfoAllLength = 0; - uint8_t _payloadDevInfoSample[DEV_INFO_SIZE] = {}; - uint8_t _devInfoSampleLength = 0; + uint8_t _payloadDevInfoSimple[DEV_INFO_SIZE] = {}; + uint8_t _devInfoSimpleLength = 0; }; \ No newline at end of file