Some inverters seem to transmit too less and incomplete data. These packages will be ignored now.
38 lines
1.2 KiB
C++
38 lines
1.2 KiB
C++
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
#pragma once
|
|
#include "Parser.h"
|
|
|
|
#define SYSTEM_CONFIG_PARA_SIZE 16
|
|
|
|
class SystemConfigParaParser : public Parser {
|
|
public:
|
|
SystemConfigParaParser();
|
|
void clearBuffer();
|
|
void appendFragment(uint8_t offset, uint8_t* payload, uint8_t len);
|
|
|
|
float getLimitPercent();
|
|
void setLimitPercent(float value);
|
|
|
|
void setLastLimitCommandSuccess(LastCommandSuccess status);
|
|
LastCommandSuccess getLastLimitCommandSuccess();
|
|
uint32_t getLastUpdateCommand();
|
|
void setLastUpdateCommand(uint32_t lastUpdate);
|
|
|
|
void setLastLimitRequestSuccess(LastCommandSuccess status);
|
|
LastCommandSuccess getLastLimitRequestSuccess();
|
|
uint32_t getLastUpdateRequest();
|
|
void setLastUpdateRequest(uint32_t lastUpdate);
|
|
|
|
// Returns 1 based amount of expected bytes of data
|
|
uint8_t getExpectedByteCount();
|
|
|
|
private:
|
|
uint8_t _payload[SYSTEM_CONFIG_PARA_SIZE];
|
|
uint8_t _payloadLength;
|
|
|
|
LastCommandSuccess _lastLimitCommandSuccess = CMD_OK; // Set to OK because we have to assume nothing is done at startup
|
|
LastCommandSuccess _lastLimitRequestSuccess = CMD_NOK; // Set to NOK to fetch at startup
|
|
|
|
uint32_t _lastUpdateCommand = 0;
|
|
uint32_t _lastUpdateRequest = 0;
|
|
}; |