Renamed DevInfoSample to DevInfoSimple
This commit is contained in:
parent
a3d9c6ae0f
commit
c8c6b2a978
@ -1,7 +1,7 @@
|
|||||||
#include "DevInfoSampleCommand.h"
|
#include "DevInfoSimpleCommand.h"
|
||||||
#include "inverters/InverterAbstract.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)
|
: MultiDataCommand(target_address, router_address)
|
||||||
{
|
{
|
||||||
setTime(time);
|
setTime(time);
|
||||||
@ -9,7 +9,7 @@ DevInfoSampleCommand::DevInfoSampleCommand(uint64_t target_address, uint64_t rou
|
|||||||
setTimeout(200);
|
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
|
// Check CRC of whole payload
|
||||||
if (!MultiDataCommand::handleResponse(inverter, fragment, max_fragment_id)) {
|
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
|
// Move all fragments into target buffer
|
||||||
uint8_t offs = 0;
|
uint8_t offs = 0;
|
||||||
inverter->DevInfo()->clearBufferSample();
|
inverter->DevInfo()->clearBufferSimple();
|
||||||
for (uint8_t i = 0; i < max_fragment_id; i++) {
|
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);
|
offs += (fragment[i].len);
|
||||||
}
|
}
|
||||||
inverter->DevInfo()->setLastUpdateSample(millis());
|
inverter->DevInfo()->setLastUpdateSample(millis());
|
||||||
@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
#include "MultiDataCommand.h"
|
#include "MultiDataCommand.h"
|
||||||
|
|
||||||
class DevInfoSampleCommand : public MultiDataCommand {
|
class DevInfoSimpleCommand : public MultiDataCommand {
|
||||||
public:
|
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);
|
virtual bool handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id);
|
||||||
};
|
};
|
||||||
@ -6,7 +6,7 @@
|
|||||||
* MultiDataCommand
|
* MultiDataCommand
|
||||||
* AlarmDataCommand
|
* AlarmDataCommand
|
||||||
* DevInfoAllCommand
|
* DevInfoAllCommand
|
||||||
* DevInfoSampleCommand
|
* DevInfoSimpleCommand
|
||||||
* RealTimeRunDataCommand
|
* RealTimeRunDataCommand
|
||||||
* SystemConfigParaCommand
|
* SystemConfigParaCommand
|
||||||
* ParaSetCommand
|
* ParaSetCommand
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
#include "commands/ActivePowerControlCommand.h"
|
#include "commands/ActivePowerControlCommand.h"
|
||||||
#include "commands/AlarmDataCommand.h"
|
#include "commands/AlarmDataCommand.h"
|
||||||
#include "commands/DevInfoAllCommand.h"
|
#include "commands/DevInfoAllCommand.h"
|
||||||
#include "commands/DevInfoSampleCommand.h"
|
#include "commands/DevInfoSimpleCommand.h"
|
||||||
#include "commands/RealTimeRunDataCommand.h"
|
#include "commands/RealTimeRunDataCommand.h"
|
||||||
#include "commands/SystemConfigParaCommand.h"
|
#include "commands/SystemConfigParaCommand.h"
|
||||||
|
|
||||||
@ -69,7 +69,7 @@ bool HM_Abstract::sendDevInfoRequest(HoymilesRadio* radio)
|
|||||||
cmdAll->setTime(now);
|
cmdAll->setTime(now);
|
||||||
cmdAll->setTargetAddress(serial());
|
cmdAll->setTargetAddress(serial());
|
||||||
|
|
||||||
DevInfoSampleCommand* cmdSample = radio->enqueCommand<DevInfoSampleCommand>();
|
DevInfoSimpleCommand* cmdSample = radio->enqueCommand<DevInfoSimpleCommand>();
|
||||||
cmdSample->setTime(now);
|
cmdSample->setTime(now);
|
||||||
cmdSample->setTargetAddress(serial());
|
cmdSample->setTargetAddress(serial());
|
||||||
|
|
||||||
|
|||||||
@ -17,20 +17,20 @@ void DevInfoParser::appendFragmentAll(uint8_t offset, uint8_t* payload, uint8_t
|
|||||||
_devInfoAllLength += len;
|
_devInfoAllLength += len;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DevInfoParser::clearBufferSample()
|
void DevInfoParser::clearBufferSimple()
|
||||||
{
|
{
|
||||||
memset(_payloadDevInfoSample, 0, DEV_INFO_SIZE);
|
memset(_payloadDevInfoSimple, 0, DEV_INFO_SIZE);
|
||||||
_devInfoSampleLength = 0;
|
_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) {
|
if (offset + len > DEV_INFO_SIZE) {
|
||||||
Serial.printf("FATAL: (%s, %d) dev info Sample packet too large for buffer\n", __FILE__, __LINE__);
|
Serial.printf("FATAL: (%s, %d) dev info Sample packet too large for buffer\n", __FILE__, __LINE__);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
memcpy(&_payloadDevInfoSample[offset], payload, len);
|
memcpy(&_payloadDevInfoSimple[offset], payload, len);
|
||||||
_devInfoSampleLength += len;
|
_devInfoSimpleLength += len;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t DevInfoParser::getLastUpdateAll()
|
uint32_t DevInfoParser::getLastUpdateAll()
|
||||||
@ -84,15 +84,15 @@ uint32_t DevInfoParser::getHwPartNumber()
|
|||||||
uint16_t hwpn_h;
|
uint16_t hwpn_h;
|
||||||
uint16_t hwpn_l;
|
uint16_t hwpn_l;
|
||||||
|
|
||||||
hwpn_h = (((uint16_t)_payloadDevInfoSample[2]) << 8) | _payloadDevInfoSample[3];
|
hwpn_h = (((uint16_t)_payloadDevInfoSimple[2]) << 8) | _payloadDevInfoSimple[3];
|
||||||
hwpn_l = (((uint16_t)_payloadDevInfoSample[4]) << 8) | _payloadDevInfoSample[5];
|
hwpn_l = (((uint16_t)_payloadDevInfoSimple[4]) << 8) | _payloadDevInfoSimple[5];
|
||||||
|
|
||||||
return ((uint32_t)hwpn_h << 16) | ((uint32_t)hwpn_l);
|
return ((uint32_t)hwpn_h << 16) | ((uint32_t)hwpn_l);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t DevInfoParser::getHwVersion()
|
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 */
|
/* struct tm to seconds since Unix epoch */
|
||||||
|
|||||||
@ -9,8 +9,8 @@ public:
|
|||||||
void clearBufferAll();
|
void clearBufferAll();
|
||||||
void appendFragmentAll(uint8_t offset, uint8_t* payload, uint8_t len);
|
void appendFragmentAll(uint8_t offset, uint8_t* payload, uint8_t len);
|
||||||
|
|
||||||
void clearBufferSample();
|
void clearBufferSimple();
|
||||||
void appendFragmentSample(uint8_t offset, uint8_t* payload, uint8_t len);
|
void appendFragmentSimple(uint8_t offset, uint8_t* payload, uint8_t len);
|
||||||
|
|
||||||
uint32_t getLastUpdateAll();
|
uint32_t getLastUpdateAll();
|
||||||
void setLastUpdateAll(uint32_t lastUpdate);
|
void setLastUpdateAll(uint32_t lastUpdate);
|
||||||
@ -34,6 +34,6 @@ private:
|
|||||||
uint8_t _payloadDevInfoAll[DEV_INFO_SIZE] = {};
|
uint8_t _payloadDevInfoAll[DEV_INFO_SIZE] = {};
|
||||||
uint8_t _devInfoAllLength = 0;
|
uint8_t _devInfoAllLength = 0;
|
||||||
|
|
||||||
uint8_t _payloadDevInfoSample[DEV_INFO_SIZE] = {};
|
uint8_t _payloadDevInfoSimple[DEV_INFO_SIZE] = {};
|
||||||
uint8_t _devInfoSampleLength = 0;
|
uint8_t _devInfoSimpleLength = 0;
|
||||||
};
|
};
|
||||||
Loading…
Reference in New Issue
Block a user