Add const keyword to method parameters
This commit is contained in:
parent
a0c47e97fb
commit
d6494fa791
@ -162,7 +162,7 @@ public:
|
|||||||
CONFIG_T& get();
|
CONFIG_T& get();
|
||||||
|
|
||||||
INVERTER_CONFIG_T* getFreeInverterSlot();
|
INVERTER_CONFIG_T* getFreeInverterSlot();
|
||||||
INVERTER_CONFIG_T* getInverterConfig(uint64_t serial);
|
INVERTER_CONFIG_T* getInverterConfig(const uint64_t serial);
|
||||||
};
|
};
|
||||||
|
|
||||||
extern ConfigurationClass Configuration;
|
extern ConfigurationClass Configuration;
|
||||||
@ -17,11 +17,11 @@ public:
|
|||||||
DisplayGraphicClass();
|
DisplayGraphicClass();
|
||||||
~DisplayGraphicClass();
|
~DisplayGraphicClass();
|
||||||
|
|
||||||
void init(Scheduler* scheduler, DisplayType_t type, uint8_t data, uint8_t clk, uint8_t cs, 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(uint8_t contrast);
|
void setContrast(const uint8_t contrast);
|
||||||
void setStatus(bool turnOn);
|
void setStatus(const bool turnOn);
|
||||||
void setOrientation(uint8_t rotation = DISPLAY_ROTATION);
|
void setOrientation(const uint8_t rotation = DISPLAY_ROTATION);
|
||||||
void setLanguage(uint8_t language);
|
void setLanguage(const uint8_t language);
|
||||||
void setStartupDisplay();
|
void setStartupDisplay();
|
||||||
|
|
||||||
bool enablePowerSafe = true;
|
bool enablePowerSafe = true;
|
||||||
@ -29,9 +29,9 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void loop();
|
void loop();
|
||||||
void printText(const char* text, uint8_t line);
|
void printText(const char* text, const uint8_t line);
|
||||||
void calcLineHeights();
|
void calcLineHeights();
|
||||||
void setFont(uint8_t line);
|
void setFont(const uint8_t line);
|
||||||
|
|
||||||
Task _loopTask;
|
Task _loopTask;
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,7 @@ private:
|
|||||||
void setLoop();
|
void setLoop();
|
||||||
void outputLoop();
|
void outputLoop();
|
||||||
|
|
||||||
void setLed(uint8_t ledNo, bool ledState);
|
void setLed(const uint8_t ledNo, const bool ledState);
|
||||||
|
|
||||||
Task _setTask;
|
Task _setTask;
|
||||||
Task _outputTask;
|
Task _outputTask;
|
||||||
|
|||||||
@ -58,9 +58,9 @@ public:
|
|||||||
private:
|
private:
|
||||||
void loop();
|
void loop();
|
||||||
void publish(const String& subtopic, const String& payload);
|
void publish(const String& subtopic, const String& payload);
|
||||||
void publishField(std::shared_ptr<InverterAbstract> inv, ChannelType_t type, ChannelNum_t channel, byteAssign_fieldDeviceClass_t fieldType, bool clear = false);
|
void publishField(std::shared_ptr<InverterAbstract> inv, const ChannelType_t type, const ChannelNum_t channel, const byteAssign_fieldDeviceClass_t fieldType, const bool clear = false);
|
||||||
void publishInverterButton(std::shared_ptr<InverterAbstract> inv, const char* caption, const char* icon, const char* category, const char* deviceClass, const char* subTopic, const char* payload);
|
void publishInverterButton(std::shared_ptr<InverterAbstract> inv, const char* caption, const char* icon, const char* category, const char* deviceClass, const char* subTopic, const char* payload);
|
||||||
void publishInverterNumber(std::shared_ptr<InverterAbstract> inv, const char* caption, const char* icon, const char* category, const char* commandTopic, const char* stateTopic, const char* unitOfMeasure, int16_t min = 1, int16_t max = 100);
|
void publishInverterNumber(std::shared_ptr<InverterAbstract> inv, const char* caption, const char* icon, const char* category, const char* commandTopic, const char* stateTopic, const char* unitOfMeasure, const int16_t min = 1, const int16_t max = 100);
|
||||||
void publishInverterBinarySensor(std::shared_ptr<InverterAbstract> inv, const char* caption, const char* subTopic, const char* payload_on, const char* payload_off);
|
void publishInverterBinarySensor(std::shared_ptr<InverterAbstract> inv, const char* caption, const char* subTopic, const char* payload_on, const char* payload_off);
|
||||||
void createDeviceInfo(JsonObject& object, std::shared_ptr<InverterAbstract> inv);
|
void createDeviceInfo(JsonObject& object, std::shared_ptr<InverterAbstract> inv);
|
||||||
|
|
||||||
|
|||||||
@ -10,12 +10,12 @@ class MqttHandleInverterClass {
|
|||||||
public:
|
public:
|
||||||
void init(Scheduler* scheduler);
|
void init(Scheduler* scheduler);
|
||||||
|
|
||||||
static String getTopic(std::shared_ptr<InverterAbstract> inv, ChannelType_t type, ChannelNum_t channel, FieldId_t fieldId);
|
static String getTopic(std::shared_ptr<InverterAbstract> inv, const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loop();
|
void loop();
|
||||||
void publishField(std::shared_ptr<InverterAbstract> inv, ChannelType_t type, ChannelNum_t channel, FieldId_t fieldId);
|
void publishField(std::shared_ptr<InverterAbstract> inv, const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId);
|
||||||
void onMqttMessage(const espMqttClientTypes::MessageProperties& properties, const char* topic, const uint8_t* payload, size_t len, size_t index, size_t total);
|
void onMqttMessage(const espMqttClientTypes::MessageProperties& properties, const char* topic, const uint8_t* payload, const size_t len, const size_t index, const size_t total);
|
||||||
|
|
||||||
Task _loopTask;
|
Task _loopTask;
|
||||||
|
|
||||||
|
|||||||
@ -14,9 +14,9 @@ public:
|
|||||||
void performReconnect();
|
void performReconnect();
|
||||||
bool getConnected();
|
bool getConnected();
|
||||||
void publish(const String& subtopic, const String& payload);
|
void publish(const String& subtopic, const String& payload);
|
||||||
void publishGeneric(const String& topic, const String& payload, bool retain, uint8_t qos = 0);
|
void publishGeneric(const String& topic, const String& payload, const bool retain, const uint8_t qos = 0);
|
||||||
|
|
||||||
void subscribe(const String& topic, uint8_t qos, const espMqttClientTypes::OnMessageCallback& cb);
|
void subscribe(const String& topic, const uint8_t qos, const espMqttClientTypes::OnMessageCallback& cb);
|
||||||
void unsubscribe(const String& topic);
|
void unsubscribe(const String& topic);
|
||||||
|
|
||||||
String getPrefix();
|
String getPrefix();
|
||||||
@ -25,8 +25,8 @@ private:
|
|||||||
void NetworkEvent(network_event event);
|
void NetworkEvent(network_event event);
|
||||||
|
|
||||||
void onMqttDisconnect(espMqttClientTypes::DisconnectReason reason);
|
void onMqttDisconnect(espMqttClientTypes::DisconnectReason reason);
|
||||||
void onMqttConnect(bool sessionPresent);
|
void onMqttConnect(const bool sessionPresent);
|
||||||
void onMqttMessage(const espMqttClientTypes::MessageProperties& properties, const char* topic, const uint8_t* payload, size_t len, size_t index, size_t total);
|
void onMqttMessage(const espMqttClientTypes::MessageProperties& properties, const char* topic, const uint8_t* payload, const size_t len, const size_t index, const size_t total);
|
||||||
|
|
||||||
void performConnect();
|
void performConnect();
|
||||||
void performDisconnect();
|
void performDisconnect();
|
||||||
|
|||||||
@ -47,14 +47,14 @@ public:
|
|||||||
IPAddress localIP();
|
IPAddress localIP();
|
||||||
IPAddress subnetMask();
|
IPAddress subnetMask();
|
||||||
IPAddress gatewayIP();
|
IPAddress gatewayIP();
|
||||||
IPAddress dnsIP(uint8_t dns_no = 0);
|
IPAddress dnsIP(const uint8_t dns_no = 0);
|
||||||
String macAddress();
|
String macAddress();
|
||||||
static String getHostname();
|
static String getHostname();
|
||||||
bool isConnected();
|
bool isConnected();
|
||||||
network_mode NetworkMode();
|
network_mode NetworkMode();
|
||||||
|
|
||||||
bool onEvent(NetworkEventCb cbEvent, network_event event = network_event::NETWORK_EVENT_MAX);
|
bool onEvent(NetworkEventCb cbEvent, const network_event event = network_event::NETWORK_EVENT_MAX);
|
||||||
void raiseEvent(network_event event);
|
void raiseEvent(const network_event event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loop();
|
void loop();
|
||||||
@ -62,7 +62,7 @@ private:
|
|||||||
void setStaticIp();
|
void setStaticIp();
|
||||||
void handleMDNS();
|
void handleMDNS();
|
||||||
void setupMode();
|
void setupMode();
|
||||||
void NetworkEvent(WiFiEvent_t event);
|
void NetworkEvent(const WiFiEvent_t event);
|
||||||
|
|
||||||
Task _loopTask;
|
Task _loopTask;
|
||||||
|
|
||||||
|
|||||||
@ -14,13 +14,13 @@ public:
|
|||||||
bool isSunsetAvailable();
|
bool isSunsetAvailable();
|
||||||
bool sunsetTime(struct tm* info);
|
bool sunsetTime(struct tm* info);
|
||||||
bool sunriseTime(struct tm* info);
|
bool sunriseTime(struct tm* info);
|
||||||
void setDoRecalc(bool doRecalc);
|
void setDoRecalc(const bool doRecalc);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loop();
|
void loop();
|
||||||
void updateSunData();
|
void updateSunData();
|
||||||
bool checkRecalcDayChanged();
|
bool checkRecalcDayChanged();
|
||||||
bool getSunTime(struct tm* info, uint32_t offset);
|
bool getSunTime(struct tm* info, const uint32_t offset);
|
||||||
|
|
||||||
Task _loopTask;
|
Task _loopTask;
|
||||||
|
|
||||||
|
|||||||
@ -13,9 +13,9 @@ public:
|
|||||||
private:
|
private:
|
||||||
void onPrometheusMetricsGet(AsyncWebServerRequest* request);
|
void onPrometheusMetricsGet(AsyncWebServerRequest* request);
|
||||||
|
|
||||||
void addField(AsyncResponseStream* stream, String& serial, uint8_t idx, std::shared_ptr<InverterAbstract> inv, ChannelType_t type, ChannelNum_t channel, FieldId_t fieldId, const char* metricName, const char* channelName = nullptr);
|
void addField(AsyncResponseStream* stream, const String& serial, const uint8_t idx, std::shared_ptr<InverterAbstract> inv, const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId, const char* metricName, const char* channelName = nullptr);
|
||||||
|
|
||||||
void addPanelInfo(AsyncResponseStream* stream, String& serial, uint8_t idx, std::shared_ptr<InverterAbstract> inv, ChannelType_t type, ChannelNum_t channel);
|
void addPanelInfo(AsyncResponseStream* stream, const String& serial, const uint8_t idx, std::shared_ptr<InverterAbstract> inv, const ChannelType_t type, const ChannelNum_t channel);
|
||||||
|
|
||||||
AsyncWebServer* _server;
|
AsyncWebServer* _server;
|
||||||
|
|
||||||
|
|||||||
@ -13,8 +13,8 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void generateJsonResponse(JsonVariant& root);
|
void generateJsonResponse(JsonVariant& root);
|
||||||
void addField(JsonObject& root, uint8_t idx, std::shared_ptr<InverterAbstract> inv, ChannelType_t type, ChannelNum_t channel, FieldId_t fieldId, String topic = "");
|
void addField(JsonObject& root, uint8_t idx, std::shared_ptr<InverterAbstract> inv, const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId, String topic = "");
|
||||||
void addTotalField(JsonObject& root, const String& name, float value, const String& unit, uint8_t digits);
|
void addTotalField(JsonObject& root, const String& name, const float value, const String& unit, const uint8_t digits);
|
||||||
void onLivedataStatus(AsyncWebServerRequest* request);
|
void onLivedataStatus(AsyncWebServerRequest* request);
|
||||||
void onWebsocketEvent(AsyncWebSocket* server, AsyncWebSocketClient* client, AwsEventType type, void* arg, uint8_t* data, size_t len);
|
void onWebsocketEvent(AsyncWebSocket* server, AsyncWebSocketClient* client, AwsEventType type, void* arg, uint8_t* data, size_t len);
|
||||||
|
|
||||||
|
|||||||
@ -24,12 +24,12 @@ void HoymilesClass::init()
|
|||||||
_radioCmt.reset(new HoymilesRadio_CMT());
|
_radioCmt.reset(new HoymilesRadio_CMT());
|
||||||
}
|
}
|
||||||
|
|
||||||
void HoymilesClass::initNRF(SPIClass* initialisedSpiBus, uint8_t pinCE, uint8_t pinIRQ)
|
void HoymilesClass::initNRF(SPIClass* initialisedSpiBus, const uint8_t pinCE, const uint8_t pinIRQ)
|
||||||
{
|
{
|
||||||
_radioNrf->init(initialisedSpiBus, pinCE, pinIRQ);
|
_radioNrf->init(initialisedSpiBus, pinCE, pinIRQ);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HoymilesClass::initCMT(int8_t pin_sdio, int8_t pin_clk, int8_t pin_cs, int8_t pin_fcs, int8_t pin_gpio2, int8_t pin_gpio3)
|
void HoymilesClass::initCMT(const int8_t pin_sdio, const int8_t pin_clk, const int8_t pin_cs, const int8_t pin_fcs, const int8_t pin_gpio2, const int8_t pin_gpio3)
|
||||||
{
|
{
|
||||||
_radioCmt->init(pin_sdio, pin_clk, pin_cs, pin_fcs, pin_gpio2, pin_gpio3);
|
_radioCmt->init(pin_sdio, pin_clk, pin_cs, pin_fcs, pin_gpio2, pin_gpio3);
|
||||||
}
|
}
|
||||||
@ -146,7 +146,7 @@ void HoymilesClass::loop()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<InverterAbstract> HoymilesClass::addInverter(const char* name, uint64_t serial)
|
std::shared_ptr<InverterAbstract> HoymilesClass::addInverter(const char* name, const uint64_t serial)
|
||||||
{
|
{
|
||||||
std::shared_ptr<InverterAbstract> i = nullptr;
|
std::shared_ptr<InverterAbstract> i = nullptr;
|
||||||
if (HMT_4CH::isValidSerial(serial)) {
|
if (HMT_4CH::isValidSerial(serial)) {
|
||||||
@ -179,7 +179,7 @@ std::shared_ptr<InverterAbstract> HoymilesClass::addInverter(const char* name, u
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<InverterAbstract> HoymilesClass::getInverterByPos(uint8_t pos)
|
std::shared_ptr<InverterAbstract> HoymilesClass::getInverterByPos(const uint8_t pos)
|
||||||
{
|
{
|
||||||
if (pos >= _inverters.size()) {
|
if (pos >= _inverters.size()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -188,7 +188,7 @@ std::shared_ptr<InverterAbstract> HoymilesClass::getInverterByPos(uint8_t pos)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<InverterAbstract> HoymilesClass::getInverterBySerial(uint64_t serial)
|
std::shared_ptr<InverterAbstract> HoymilesClass::getInverterBySerial(const uint64_t serial)
|
||||||
{
|
{
|
||||||
for (uint8_t i = 0; i < _inverters.size(); i++) {
|
for (uint8_t i = 0; i < _inverters.size(); i++) {
|
||||||
if (_inverters[i]->serial() == serial) {
|
if (_inverters[i]->serial() == serial) {
|
||||||
@ -221,7 +221,7 @@ std::shared_ptr<InverterAbstract> HoymilesClass::getInverterByFragment(const fra
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HoymilesClass::removeInverterBySerial(uint64_t serial)
|
void HoymilesClass::removeInverterBySerial(const uint64_t serial)
|
||||||
{
|
{
|
||||||
for (uint8_t i = 0; i < _inverters.size(); i++) {
|
for (uint8_t i = 0; i < _inverters.size(); i++) {
|
||||||
if (_inverters[i]->serial() == serial) {
|
if (_inverters[i]->serial() == serial) {
|
||||||
@ -257,7 +257,7 @@ uint32_t HoymilesClass::PollInterval()
|
|||||||
return _pollInterval;
|
return _pollInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HoymilesClass::setPollInterval(uint32_t interval)
|
void HoymilesClass::setPollInterval(const uint32_t interval)
|
||||||
{
|
{
|
||||||
_pollInterval = interval;
|
_pollInterval = interval;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,25 +16,25 @@
|
|||||||
class HoymilesClass {
|
class HoymilesClass {
|
||||||
public:
|
public:
|
||||||
void init();
|
void init();
|
||||||
void initNRF(SPIClass* initialisedSpiBus, uint8_t pinCE, uint8_t pinIRQ);
|
void initNRF(SPIClass* initialisedSpiBus, const uint8_t pinCE, const uint8_t pinIRQ);
|
||||||
void initCMT(int8_t pin_sdio, int8_t pin_clk, int8_t pin_cs, int8_t pin_fcs, int8_t pin_gpio2, int8_t pin_gpio3);
|
void initCMT(const int8_t pin_sdio, const int8_t pin_clk, const int8_t pin_cs, const int8_t pin_fcs, const int8_t pin_gpio2, const int8_t pin_gpio3);
|
||||||
void loop();
|
void loop();
|
||||||
|
|
||||||
void setMessageOutput(Print* output);
|
void setMessageOutput(Print* output);
|
||||||
Print* getMessageOutput();
|
Print* getMessageOutput();
|
||||||
|
|
||||||
std::shared_ptr<InverterAbstract> addInverter(const char* name, uint64_t serial);
|
std::shared_ptr<InverterAbstract> addInverter(const char* name, const uint64_t serial);
|
||||||
std::shared_ptr<InverterAbstract> getInverterByPos(uint8_t pos);
|
std::shared_ptr<InverterAbstract> getInverterByPos(const uint8_t pos);
|
||||||
std::shared_ptr<InverterAbstract> getInverterBySerial(uint64_t serial);
|
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(uint64_t serial);
|
void removeInverterBySerial(const uint64_t serial);
|
||||||
size_t getNumInverters();
|
size_t getNumInverters();
|
||||||
|
|
||||||
HoymilesRadio_NRF* getRadioNrf();
|
HoymilesRadio_NRF* getRadioNrf();
|
||||||
HoymilesRadio_CMT* getRadioCmt();
|
HoymilesRadio_CMT* getRadioCmt();
|
||||||
|
|
||||||
uint32_t PollInterval();
|
uint32_t PollInterval();
|
||||||
void setPollInterval(uint32_t interval);
|
void setPollInterval(const uint32_t interval);
|
||||||
|
|
||||||
bool isAllRadioIdle();
|
bool isAllRadioIdle();
|
||||||
|
|
||||||
|
|||||||
@ -11,12 +11,12 @@ serial_u HoymilesRadio::DtuSerial()
|
|||||||
return _dtuSerial;
|
return _dtuSerial;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HoymilesRadio::setDtuSerial(uint64_t serial)
|
void HoymilesRadio::setDtuSerial(const uint64_t serial)
|
||||||
{
|
{
|
||||||
_dtuSerial.u64 = serial;
|
_dtuSerial.u64 = serial;
|
||||||
}
|
}
|
||||||
|
|
||||||
serial_u HoymilesRadio::convertSerialToRadioId(serial_u serial)
|
serial_u HoymilesRadio::convertSerialToRadioId(const serial_u serial)
|
||||||
{
|
{
|
||||||
serial_u radioId;
|
serial_u radioId;
|
||||||
radioId.u64 = 0;
|
radioId.u64 = 0;
|
||||||
@ -34,7 +34,7 @@ bool HoymilesRadio::checkFragmentCrc(const fragment_t* fragment)
|
|||||||
return (crc == fragment->fragment[fragment->len - 1]);
|
return (crc == fragment->fragment[fragment->len - 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HoymilesRadio::sendRetransmitPacket(uint8_t fragment_id)
|
void HoymilesRadio::sendRetransmitPacket(const uint8_t fragment_id)
|
||||||
{
|
{
|
||||||
CommandAbstract* cmd = _commandQueue.front().get();
|
CommandAbstract* cmd = _commandQueue.front().get();
|
||||||
|
|
||||||
@ -114,7 +114,7 @@ void HoymilesRadio::handleReceivedPackage()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HoymilesRadio::dumpBuf(const uint8_t buf[], uint8_t len, bool appendNewline)
|
void HoymilesRadio::dumpBuf(const uint8_t buf[], const uint8_t len, const bool appendNewline)
|
||||||
{
|
{
|
||||||
for (uint8_t i = 0; i < len; i++) {
|
for (uint8_t i = 0; i < len; i++) {
|
||||||
Hoymiles.getMessageOutput()->printf("%02X ", buf[i]);
|
Hoymiles.getMessageOutput()->printf("%02X ", buf[i]);
|
||||||
|
|||||||
@ -10,7 +10,7 @@
|
|||||||
class HoymilesRadio {
|
class HoymilesRadio {
|
||||||
public:
|
public:
|
||||||
serial_u DtuSerial();
|
serial_u DtuSerial();
|
||||||
virtual void setDtuSerial(uint64_t serial);
|
virtual void setDtuSerial(const uint64_t serial);
|
||||||
|
|
||||||
bool isIdle();
|
bool isIdle();
|
||||||
bool isQueueEmpty();
|
bool isQueueEmpty();
|
||||||
@ -28,12 +28,12 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static serial_u convertSerialToRadioId(serial_u serial);
|
static serial_u convertSerialToRadioId(const serial_u serial);
|
||||||
void dumpBuf(const uint8_t buf[], uint8_t len, bool appendNewline = true);
|
static void dumpBuf(const uint8_t buf[], const uint8_t len, const bool appendNewline = true);
|
||||||
|
|
||||||
bool checkFragmentCrc(const fragment_t* fragment);
|
bool checkFragmentCrc(const fragment_t* fragment);
|
||||||
virtual void sendEsbPacket(CommandAbstract* cmd) = 0;
|
virtual void sendEsbPacket(CommandAbstract* cmd) = 0;
|
||||||
void sendRetransmitPacket(uint8_t fragment_id);
|
void sendRetransmitPacket(const uint8_t fragment_id);
|
||||||
void sendLastPacketAgain();
|
void sendLastPacketAgain();
|
||||||
void handleReceivedPackage();
|
void handleReceivedPackage();
|
||||||
|
|
||||||
|
|||||||
@ -53,7 +53,7 @@ bool HoymilesRadio_CMT::cmtSwitchDtuFreq(const uint32_t to_freq_kHz)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HoymilesRadio_CMT::init(int8_t pin_sdio, int8_t pin_clk, int8_t pin_cs, int8_t pin_fcs, int8_t pin_gpio2, int8_t pin_gpio3)
|
void HoymilesRadio_CMT::init(const int8_t pin_sdio, const int8_t pin_clk, const int8_t pin_cs, const int8_t pin_fcs, const int8_t pin_gpio2, const int8_t pin_gpio3)
|
||||||
{
|
{
|
||||||
_dtuSerial.u64 = 0;
|
_dtuSerial.u64 = 0;
|
||||||
|
|
||||||
@ -156,7 +156,7 @@ void HoymilesRadio_CMT::loop()
|
|||||||
handleReceivedPackage();
|
handleReceivedPackage();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HoymilesRadio_CMT::setPALevel(int8_t paLevel)
|
void HoymilesRadio_CMT::setPALevel(const int8_t paLevel)
|
||||||
{
|
{
|
||||||
if (!_isInitialized) {
|
if (!_isInitialized) {
|
||||||
return;
|
return;
|
||||||
@ -169,7 +169,7 @@ void HoymilesRadio_CMT::setPALevel(int8_t paLevel)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HoymilesRadio_CMT::setInverterTargetFrequency(uint32_t frequency)
|
void HoymilesRadio_CMT::setInverterTargetFrequency(const uint32_t frequency)
|
||||||
{
|
{
|
||||||
_inverterTargetFrequency = frequency;
|
_inverterTargetFrequency = frequency;
|
||||||
if (!_isInitialized) {
|
if (!_isInitialized) {
|
||||||
|
|||||||
@ -18,10 +18,10 @@
|
|||||||
|
|
||||||
class HoymilesRadio_CMT : public HoymilesRadio {
|
class HoymilesRadio_CMT : public HoymilesRadio {
|
||||||
public:
|
public:
|
||||||
void init(int8_t pin_sdio, int8_t pin_clk, int8_t pin_cs, int8_t pin_fcs, int8_t pin_gpio2, int8_t pin_gpio3);
|
void init(const int8_t pin_sdio, const int8_t pin_clk, const int8_t pin_cs, const int8_t pin_fcs, const int8_t pin_gpio2, const int8_t pin_gpio3);
|
||||||
void loop();
|
void loop();
|
||||||
void setPALevel(int8_t paLevel);
|
void setPALevel(const int8_t paLevel);
|
||||||
void setInverterTargetFrequency(uint32_t frequency);
|
void setInverterTargetFrequency(const uint32_t frequency);
|
||||||
uint32_t getInverterTargetFrequency();
|
uint32_t getInverterTargetFrequency();
|
||||||
|
|
||||||
bool isConnected();
|
bool isConnected();
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
#include <Every.h>
|
#include <Every.h>
|
||||||
#include <FunctionalInterrupt.h>
|
#include <FunctionalInterrupt.h>
|
||||||
|
|
||||||
void HoymilesRadio_NRF::init(SPIClass* initialisedSpiBus, uint8_t pinCE, uint8_t pinIRQ)
|
void HoymilesRadio_NRF::init(SPIClass* initialisedSpiBus, const uint8_t pinCE, const uint8_t pinIRQ)
|
||||||
{
|
{
|
||||||
_dtuSerial.u64 = 0;
|
_dtuSerial.u64 = 0;
|
||||||
|
|
||||||
@ -97,7 +97,7 @@ void HoymilesRadio_NRF::loop()
|
|||||||
handleReceivedPackage();
|
handleReceivedPackage();
|
||||||
}
|
}
|
||||||
|
|
||||||
void HoymilesRadio_NRF::setPALevel(rf24_pa_dbm_e paLevel)
|
void HoymilesRadio_NRF::setPALevel(const rf24_pa_dbm_e paLevel)
|
||||||
{
|
{
|
||||||
if (!_isInitialized) {
|
if (!_isInitialized) {
|
||||||
return;
|
return;
|
||||||
@ -105,7 +105,7 @@ void HoymilesRadio_NRF::setPALevel(rf24_pa_dbm_e paLevel)
|
|||||||
_radio->setPALevel(paLevel);
|
_radio->setPALevel(paLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HoymilesRadio_NRF::setDtuSerial(uint64_t serial)
|
void HoymilesRadio_NRF::setDtuSerial(const uint64_t serial)
|
||||||
{
|
{
|
||||||
HoymilesRadio::setDtuSerial(serial);
|
HoymilesRadio::setDtuSerial(serial);
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ void HoymilesRadio_NRF::openReadingPipe()
|
|||||||
_radio->openReadingPipe(1, s.u64);
|
_radio->openReadingPipe(1, s.u64);
|
||||||
}
|
}
|
||||||
|
|
||||||
void HoymilesRadio_NRF::openWritingPipe(serial_u serial)
|
void HoymilesRadio_NRF::openWritingPipe(const serial_u serial)
|
||||||
{
|
{
|
||||||
const serial_u s = convertSerialToRadioId(serial);
|
const serial_u s = convertSerialToRadioId(serial);
|
||||||
_radio->openWritingPipe(s.u64);
|
_radio->openWritingPipe(s.u64);
|
||||||
|
|||||||
@ -13,11 +13,11 @@
|
|||||||
|
|
||||||
class HoymilesRadio_NRF : public HoymilesRadio {
|
class HoymilesRadio_NRF : public HoymilesRadio {
|
||||||
public:
|
public:
|
||||||
void init(SPIClass* initialisedSpiBus, uint8_t pinCE, uint8_t pinIRQ);
|
void init(SPIClass* initialisedSpiBus, const uint8_t pinCE, const uint8_t pinIRQ);
|
||||||
void loop();
|
void loop();
|
||||||
void setPALevel(rf24_pa_dbm_e paLevel);
|
void setPALevel(const rf24_pa_dbm_e paLevel);
|
||||||
|
|
||||||
virtual void setDtuSerial(uint64_t serial);
|
virtual void setDtuSerial(const uint64_t serial);
|
||||||
|
|
||||||
bool isConnected();
|
bool isConnected();
|
||||||
bool isPVariant();
|
bool isPVariant();
|
||||||
@ -28,7 +28,7 @@ private:
|
|||||||
uint8_t getTxNxtChannel();
|
uint8_t getTxNxtChannel();
|
||||||
void switchRxCh();
|
void switchRxCh();
|
||||||
void openReadingPipe();
|
void openReadingPipe();
|
||||||
void openWritingPipe(serial_u serial);
|
void openWritingPipe(const serial_u serial);
|
||||||
|
|
||||||
void sendEsbPacket(CommandAbstract* cmd);
|
void sendEsbPacket(CommandAbstract* cmd);
|
||||||
|
|
||||||
|
|||||||
@ -25,7 +25,7 @@ ID Target Addr Source Addr Cmd SCmd ? Limit Type CRC16 CRC8
|
|||||||
|
|
||||||
#define CRC_SIZE 6
|
#define CRC_SIZE 6
|
||||||
|
|
||||||
ActivePowerControlCommand::ActivePowerControlCommand(uint64_t target_address, uint64_t router_address)
|
ActivePowerControlCommand::ActivePowerControlCommand(const uint64_t target_address, const uint64_t router_address)
|
||||||
: DevControlCommand(target_address, router_address)
|
: DevControlCommand(target_address, router_address)
|
||||||
{
|
{
|
||||||
_payload[10] = 0x0b;
|
_payload[10] = 0x0b;
|
||||||
@ -47,7 +47,7 @@ String ActivePowerControlCommand::getCommandName()
|
|||||||
return "ActivePowerControl";
|
return "ActivePowerControl";
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActivePowerControlCommand::setActivePowerLimit(float limit, PowerLimitControlType type)
|
void ActivePowerControlCommand::setActivePowerLimit(const float limit, const PowerLimitControlType type)
|
||||||
{
|
{
|
||||||
const uint16_t l = limit * 10;
|
const uint16_t l = limit * 10;
|
||||||
|
|
||||||
@ -62,7 +62,7 @@ void ActivePowerControlCommand::setActivePowerLimit(float limit, PowerLimitContr
|
|||||||
udpateCRC(CRC_SIZE);
|
udpateCRC(CRC_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ActivePowerControlCommand::handleResponse(InverterAbstract* inverter, fragment_t fragment[], 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)) {
|
if (!DevControlCommand::handleResponse(inverter, fragment, max_fragment_id)) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -12,14 +12,14 @@ typedef enum { // ToDo: to be verified by field tests
|
|||||||
|
|
||||||
class ActivePowerControlCommand : public DevControlCommand {
|
class ActivePowerControlCommand : public DevControlCommand {
|
||||||
public:
|
public:
|
||||||
explicit ActivePowerControlCommand(uint64_t target_address = 0, uint64_t router_address = 0);
|
explicit ActivePowerControlCommand(const uint64_t target_address = 0, const uint64_t router_address = 0);
|
||||||
|
|
||||||
virtual String getCommandName();
|
virtual String getCommandName();
|
||||||
|
|
||||||
virtual bool handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id);
|
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||||
virtual void gotTimeout(InverterAbstract* inverter);
|
virtual void gotTimeout(InverterAbstract* inverter);
|
||||||
|
|
||||||
void setActivePowerLimit(float limit, PowerLimitControlType type = RelativNonPersistent);
|
void setActivePowerLimit(const float limit, const PowerLimitControlType type = RelativNonPersistent);
|
||||||
float getLimit();
|
float getLimit();
|
||||||
PowerLimitControlType getType();
|
PowerLimitControlType getType();
|
||||||
};
|
};
|
||||||
@ -23,7 +23,7 @@ ID Target Addr Source Addr Idx DT ? Time Gap AlarmId Pa
|
|||||||
#include "AlarmDataCommand.h"
|
#include "AlarmDataCommand.h"
|
||||||
#include "inverters/InverterAbstract.h"
|
#include "inverters/InverterAbstract.h"
|
||||||
|
|
||||||
AlarmDataCommand::AlarmDataCommand(uint64_t target_address, uint64_t router_address, time_t time)
|
AlarmDataCommand::AlarmDataCommand(const uint64_t target_address, const uint64_t router_address, const time_t time)
|
||||||
: MultiDataCommand(target_address, router_address)
|
: MultiDataCommand(target_address, router_address)
|
||||||
{
|
{
|
||||||
setTime(time);
|
setTime(time);
|
||||||
@ -36,7 +36,7 @@ String AlarmDataCommand::getCommandName()
|
|||||||
return "AlarmData";
|
return "AlarmData";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AlarmDataCommand::handleResponse(InverterAbstract* inverter, fragment_t fragment[], 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
|
// Check CRC of whole payload
|
||||||
if (!MultiDataCommand::handleResponse(inverter, fragment, max_fragment_id)) {
|
if (!MultiDataCommand::handleResponse(inverter, fragment, max_fragment_id)) {
|
||||||
|
|||||||
@ -5,10 +5,10 @@
|
|||||||
|
|
||||||
class AlarmDataCommand : public MultiDataCommand {
|
class AlarmDataCommand : public MultiDataCommand {
|
||||||
public:
|
public:
|
||||||
explicit AlarmDataCommand(uint64_t target_address = 0, uint64_t router_address = 0, time_t time = 0);
|
explicit AlarmDataCommand(const uint64_t target_address = 0, const uint64_t router_address = 0, const time_t time = 0);
|
||||||
|
|
||||||
virtual String getCommandName();
|
virtual String getCommandName();
|
||||||
|
|
||||||
virtual bool handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id);
|
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||||
virtual void gotTimeout(InverterAbstract* inverter);
|
virtual void gotTimeout(InverterAbstract* inverter);
|
||||||
};
|
};
|
||||||
@ -18,7 +18,7 @@ ID Target Addr Source Addr ? ? ? CH ? CRC8
|
|||||||
*/
|
*/
|
||||||
#include "ChannelChangeCommand.h"
|
#include "ChannelChangeCommand.h"
|
||||||
|
|
||||||
ChannelChangeCommand::ChannelChangeCommand(uint64_t target_address, uint64_t router_address, uint8_t channel)
|
ChannelChangeCommand::ChannelChangeCommand(const uint64_t target_address, const uint64_t router_address, const uint8_t channel)
|
||||||
: CommandAbstract(target_address, router_address)
|
: CommandAbstract(target_address, router_address)
|
||||||
{
|
{
|
||||||
_payload[0] = 0x56;
|
_payload[0] = 0x56;
|
||||||
@ -37,7 +37,7 @@ String ChannelChangeCommand::getCommandName()
|
|||||||
return "ChannelChangeCommand";
|
return "ChannelChangeCommand";
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChannelChangeCommand::setChannel(uint8_t channel)
|
void ChannelChangeCommand::setChannel(const uint8_t channel)
|
||||||
{
|
{
|
||||||
_payload[12] = channel;
|
_payload[12] = channel;
|
||||||
}
|
}
|
||||||
@ -47,7 +47,7 @@ uint8_t ChannelChangeCommand::getChannel()
|
|||||||
return _payload[12];
|
return _payload[12];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChannelChangeCommand::handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id)
|
bool ChannelChangeCommand::handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,14 +5,14 @@
|
|||||||
|
|
||||||
class ChannelChangeCommand : public CommandAbstract {
|
class ChannelChangeCommand : public CommandAbstract {
|
||||||
public:
|
public:
|
||||||
explicit ChannelChangeCommand(uint64_t target_address = 0, uint64_t router_address = 0, uint8_t channel = 0);
|
explicit ChannelChangeCommand(const uint64_t target_address = 0, const uint64_t router_address = 0, const uint8_t channel = 0);
|
||||||
|
|
||||||
virtual String getCommandName();
|
virtual String getCommandName();
|
||||||
|
|
||||||
void setChannel(uint8_t channel);
|
void setChannel(const uint8_t channel);
|
||||||
uint8_t getChannel();
|
uint8_t getChannel();
|
||||||
|
|
||||||
virtual bool handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id);
|
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||||
|
|
||||||
virtual uint8_t getMaxResendCount();
|
virtual uint8_t getMaxResendCount();
|
||||||
};
|
};
|
||||||
@ -30,7 +30,7 @@ Source Address: 80 12 23 04
|
|||||||
#include "crc.h"
|
#include "crc.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
CommandAbstract::CommandAbstract(uint64_t target_address, uint64_t router_address)
|
CommandAbstract::CommandAbstract(const uint64_t target_address, const uint64_t router_address)
|
||||||
{
|
{
|
||||||
memset(_payload, 0, RF_LEN);
|
memset(_payload, 0, RF_LEN);
|
||||||
_payload_size = 0;
|
_payload_size = 0;
|
||||||
@ -61,7 +61,7 @@ uint8_t CommandAbstract::getDataSize()
|
|||||||
return _payload_size + 1; // Original payload plus crc8
|
return _payload_size + 1; // Original payload plus crc8
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandAbstract::setTargetAddress(uint64_t address)
|
void CommandAbstract::setTargetAddress(const uint64_t address)
|
||||||
{
|
{
|
||||||
convertSerialToPacketId(&_payload[1], address);
|
convertSerialToPacketId(&_payload[1], address);
|
||||||
_targetAddress = address;
|
_targetAddress = address;
|
||||||
@ -71,7 +71,7 @@ uint64_t CommandAbstract::getTargetAddress()
|
|||||||
return _targetAddress;
|
return _targetAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandAbstract::setRouterAddress(uint64_t address)
|
void CommandAbstract::setRouterAddress(const uint64_t address)
|
||||||
{
|
{
|
||||||
convertSerialToPacketId(&_payload[5], address);
|
convertSerialToPacketId(&_payload[5], address);
|
||||||
_routerAddress = address;
|
_routerAddress = address;
|
||||||
@ -82,7 +82,7 @@ uint64_t CommandAbstract::getRouterAddress()
|
|||||||
return _routerAddress;
|
return _routerAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandAbstract::setTimeout(uint32_t timeout)
|
void CommandAbstract::setTimeout(const uint32_t timeout)
|
||||||
{
|
{
|
||||||
_timeout = timeout;
|
_timeout = timeout;
|
||||||
}
|
}
|
||||||
@ -92,7 +92,7 @@ uint32_t CommandAbstract::getTimeout()
|
|||||||
return _timeout;
|
return _timeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandAbstract::setSendCount(uint8_t count)
|
void CommandAbstract::setSendCount(const uint8_t count)
|
||||||
{
|
{
|
||||||
_sendCount = count;
|
_sendCount = count;
|
||||||
}
|
}
|
||||||
@ -107,12 +107,12 @@ uint8_t CommandAbstract::incrementSendCount()
|
|||||||
return _sendCount++;
|
return _sendCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandAbstract* CommandAbstract::getRequestFrameCommand(uint8_t frame_no)
|
CommandAbstract* CommandAbstract::getRequestFrameCommand(const uint8_t frame_no)
|
||||||
{
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandAbstract::convertSerialToPacketId(uint8_t buffer[], uint64_t serial)
|
void CommandAbstract::convertSerialToPacketId(uint8_t buffer[], const uint64_t serial)
|
||||||
{
|
{
|
||||||
serial_u s;
|
serial_u s;
|
||||||
s.u64 = serial;
|
s.u64 = serial;
|
||||||
|
|||||||
@ -13,7 +13,7 @@ class InverterAbstract;
|
|||||||
|
|
||||||
class CommandAbstract {
|
class CommandAbstract {
|
||||||
public:
|
public:
|
||||||
explicit CommandAbstract(uint64_t target_address = 0, uint64_t router_address = 0);
|
explicit CommandAbstract(const uint64_t target_address = 0, const uint64_t router_address = 0);
|
||||||
virtual ~CommandAbstract() {};
|
virtual ~CommandAbstract() {};
|
||||||
|
|
||||||
const uint8_t* getDataPayload();
|
const uint8_t* getDataPayload();
|
||||||
@ -21,24 +21,24 @@ public:
|
|||||||
|
|
||||||
uint8_t getDataSize();
|
uint8_t getDataSize();
|
||||||
|
|
||||||
void setTargetAddress(uint64_t address);
|
void setTargetAddress(const uint64_t address);
|
||||||
uint64_t getTargetAddress();
|
uint64_t getTargetAddress();
|
||||||
|
|
||||||
void setRouterAddress(uint64_t address);
|
void setRouterAddress(const uint64_t address);
|
||||||
uint64_t getRouterAddress();
|
uint64_t getRouterAddress();
|
||||||
|
|
||||||
void setTimeout(uint32_t timeout);
|
void setTimeout(const uint32_t timeout);
|
||||||
uint32_t getTimeout();
|
uint32_t getTimeout();
|
||||||
|
|
||||||
virtual String getCommandName() = 0;
|
virtual String getCommandName() = 0;
|
||||||
|
|
||||||
void setSendCount(uint8_t count);
|
void setSendCount(const uint8_t count);
|
||||||
uint8_t getSendCount();
|
uint8_t getSendCount();
|
||||||
uint8_t incrementSendCount();
|
uint8_t incrementSendCount();
|
||||||
|
|
||||||
virtual CommandAbstract* getRequestFrameCommand(uint8_t frame_no);
|
virtual CommandAbstract* getRequestFrameCommand(const uint8_t frame_no);
|
||||||
|
|
||||||
virtual bool handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id) = 0;
|
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id) = 0;
|
||||||
virtual void gotTimeout(InverterAbstract* inverter);
|
virtual void gotTimeout(InverterAbstract* inverter);
|
||||||
|
|
||||||
// Sets the amount how often the specific command is resent if all fragments where missing
|
// Sets the amount how often the specific command is resent if all fragments where missing
|
||||||
@ -57,5 +57,5 @@ protected:
|
|||||||
uint64_t _routerAddress;
|
uint64_t _routerAddress;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void convertSerialToPacketId(uint8_t buffer[], uint64_t serial);
|
static void convertSerialToPacketId(uint8_t buffer[], const uint64_t serial);
|
||||||
};
|
};
|
||||||
@ -23,7 +23,7 @@ ID Target Addr Source Addr Cmd Payload CRC16 CRC8
|
|||||||
#include "DevControlCommand.h"
|
#include "DevControlCommand.h"
|
||||||
#include "crc.h"
|
#include "crc.h"
|
||||||
|
|
||||||
DevControlCommand::DevControlCommand(uint64_t target_address, uint64_t router_address)
|
DevControlCommand::DevControlCommand(const uint64_t target_address, const uint64_t router_address)
|
||||||
: CommandAbstract(target_address, router_address)
|
: CommandAbstract(target_address, router_address)
|
||||||
{
|
{
|
||||||
_payload[0] = 0x51;
|
_payload[0] = 0x51;
|
||||||
@ -32,14 +32,14 @@ DevControlCommand::DevControlCommand(uint64_t target_address, uint64_t router_ad
|
|||||||
setTimeout(1000);
|
setTimeout(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DevControlCommand::udpateCRC(uint8_t len)
|
void DevControlCommand::udpateCRC(const uint8_t len)
|
||||||
{
|
{
|
||||||
const uint16_t crc = crc16(&_payload[10], len);
|
const uint16_t crc = crc16(&_payload[10], len);
|
||||||
_payload[10 + len] = (uint8_t)(crc >> 8);
|
_payload[10 + len] = (uint8_t)(crc >> 8);
|
||||||
_payload[10 + len + 1] = (uint8_t)(crc);
|
_payload[10 + len + 1] = (uint8_t)(crc);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DevControlCommand::handleResponse(InverterAbstract* inverter, fragment_t fragment[], 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++) {
|
for (uint8_t i = 0; i < max_fragment_id; i++) {
|
||||||
if (fragment[i].mainCmd != (_payload[0] | 0x80)) {
|
if (fragment[i].mainCmd != (_payload[0] | 0x80)) {
|
||||||
|
|||||||
@ -5,10 +5,10 @@
|
|||||||
|
|
||||||
class DevControlCommand : public CommandAbstract {
|
class DevControlCommand : public CommandAbstract {
|
||||||
public:
|
public:
|
||||||
explicit DevControlCommand(uint64_t target_address = 0, uint64_t router_address = 0);
|
explicit DevControlCommand(const uint64_t target_address = 0, const uint64_t router_address = 0);
|
||||||
|
|
||||||
virtual bool handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id);
|
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void udpateCRC(uint8_t len);
|
void udpateCRC(const uint8_t len);
|
||||||
};
|
};
|
||||||
@ -21,7 +21,7 @@ ID Target Addr Source Addr Idx DT ? Time Gap Pa
|
|||||||
#include "DevInfoAllCommand.h"
|
#include "DevInfoAllCommand.h"
|
||||||
#include "inverters/InverterAbstract.h"
|
#include "inverters/InverterAbstract.h"
|
||||||
|
|
||||||
DevInfoAllCommand::DevInfoAllCommand(uint64_t target_address, uint64_t router_address, time_t time)
|
DevInfoAllCommand::DevInfoAllCommand(const uint64_t target_address, const uint64_t router_address, const time_t time)
|
||||||
: MultiDataCommand(target_address, router_address)
|
: MultiDataCommand(target_address, router_address)
|
||||||
{
|
{
|
||||||
setTime(time);
|
setTime(time);
|
||||||
@ -34,7 +34,7 @@ String DevInfoAllCommand::getCommandName()
|
|||||||
return "DevInfoAll";
|
return "DevInfoAll";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DevInfoAllCommand::handleResponse(InverterAbstract* inverter, fragment_t fragment[], 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
|
// Check CRC of whole payload
|
||||||
if (!MultiDataCommand::handleResponse(inverter, fragment, max_fragment_id)) {
|
if (!MultiDataCommand::handleResponse(inverter, fragment, max_fragment_id)) {
|
||||||
|
|||||||
@ -5,9 +5,9 @@
|
|||||||
|
|
||||||
class DevInfoAllCommand : public MultiDataCommand {
|
class DevInfoAllCommand : public MultiDataCommand {
|
||||||
public:
|
public:
|
||||||
explicit DevInfoAllCommand(uint64_t target_address = 0, uint64_t router_address = 0, time_t time = 0);
|
explicit DevInfoAllCommand(const uint64_t target_address = 0, const uint64_t router_address = 0, const time_t time = 0);
|
||||||
|
|
||||||
virtual String getCommandName();
|
virtual String getCommandName();
|
||||||
|
|
||||||
virtual bool handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id);
|
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||||
};
|
};
|
||||||
@ -21,7 +21,7 @@ ID Target Addr Source Addr Idx DT ? Time Gap Pa
|
|||||||
#include "DevInfoSimpleCommand.h"
|
#include "DevInfoSimpleCommand.h"
|
||||||
#include "inverters/InverterAbstract.h"
|
#include "inverters/InverterAbstract.h"
|
||||||
|
|
||||||
DevInfoSimpleCommand::DevInfoSimpleCommand(uint64_t target_address, uint64_t router_address, time_t time)
|
DevInfoSimpleCommand::DevInfoSimpleCommand(const uint64_t target_address, const uint64_t router_address, const time_t time)
|
||||||
: MultiDataCommand(target_address, router_address)
|
: MultiDataCommand(target_address, router_address)
|
||||||
{
|
{
|
||||||
setTime(time);
|
setTime(time);
|
||||||
@ -34,7 +34,7 @@ String DevInfoSimpleCommand::getCommandName()
|
|||||||
return "DevInfoSimple";
|
return "DevInfoSimple";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DevInfoSimpleCommand::handleResponse(InverterAbstract* inverter, fragment_t fragment[], 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
|
// Check CRC of whole payload
|
||||||
if (!MultiDataCommand::handleResponse(inverter, fragment, max_fragment_id)) {
|
if (!MultiDataCommand::handleResponse(inverter, fragment, max_fragment_id)) {
|
||||||
|
|||||||
@ -5,9 +5,9 @@
|
|||||||
|
|
||||||
class DevInfoSimpleCommand : public MultiDataCommand {
|
class DevInfoSimpleCommand : public MultiDataCommand {
|
||||||
public:
|
public:
|
||||||
explicit DevInfoSimpleCommand(uint64_t target_address = 0, uint64_t router_address = 0, time_t time = 0);
|
explicit DevInfoSimpleCommand(const uint64_t target_address = 0, const uint64_t router_address = 0, const time_t time = 0);
|
||||||
|
|
||||||
virtual String getCommandName();
|
virtual String getCommandName();
|
||||||
|
|
||||||
virtual bool handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id);
|
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||||
};
|
};
|
||||||
@ -22,7 +22,7 @@ ID Target Addr Source Addr Idx DT ? Time Gap Pa
|
|||||||
#include "Hoymiles.h"
|
#include "Hoymiles.h"
|
||||||
#include "inverters/InverterAbstract.h"
|
#include "inverters/InverterAbstract.h"
|
||||||
|
|
||||||
GridOnProFilePara::GridOnProFilePara(uint64_t target_address, uint64_t router_address, time_t time)
|
GridOnProFilePara::GridOnProFilePara(const uint64_t target_address, const uint64_t router_address, const time_t time)
|
||||||
: MultiDataCommand(target_address, router_address)
|
: MultiDataCommand(target_address, router_address)
|
||||||
{
|
{
|
||||||
setTime(time);
|
setTime(time);
|
||||||
@ -35,7 +35,7 @@ String GridOnProFilePara::getCommandName()
|
|||||||
return "GridOnProFilePara";
|
return "GridOnProFilePara";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GridOnProFilePara::handleResponse(InverterAbstract* inverter, fragment_t fragment[], 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
|
// Check CRC of whole payload
|
||||||
if (!MultiDataCommand::handleResponse(inverter, fragment, max_fragment_id)) {
|
if (!MultiDataCommand::handleResponse(inverter, fragment, max_fragment_id)) {
|
||||||
|
|||||||
@ -5,9 +5,9 @@
|
|||||||
|
|
||||||
class GridOnProFilePara : public MultiDataCommand {
|
class GridOnProFilePara : public MultiDataCommand {
|
||||||
public:
|
public:
|
||||||
explicit GridOnProFilePara(uint64_t target_address = 0, uint64_t router_address = 0, time_t time = 0);
|
explicit GridOnProFilePara(const uint64_t target_address = 0, const uint64_t router_address = 0, const time_t time = 0);
|
||||||
|
|
||||||
virtual String getCommandName();
|
virtual String getCommandName();
|
||||||
|
|
||||||
virtual bool handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id);
|
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||||
};
|
};
|
||||||
@ -28,7 +28,7 @@ ID Target Addr Source Addr Idx DT ? Time Gap Pa
|
|||||||
#include "MultiDataCommand.h"
|
#include "MultiDataCommand.h"
|
||||||
#include "crc.h"
|
#include "crc.h"
|
||||||
|
|
||||||
MultiDataCommand::MultiDataCommand(uint64_t target_address, uint64_t router_address, uint8_t data_type, time_t time)
|
MultiDataCommand::MultiDataCommand(const uint64_t target_address, const uint64_t router_address, const uint8_t data_type, const time_t time)
|
||||||
: CommandAbstract(target_address, router_address)
|
: CommandAbstract(target_address, router_address)
|
||||||
{
|
{
|
||||||
_payload[0] = 0x15;
|
_payload[0] = 0x15;
|
||||||
@ -50,7 +50,7 @@ MultiDataCommand::MultiDataCommand(uint64_t target_address, uint64_t router_addr
|
|||||||
_payload_size = 26;
|
_payload_size = 26;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiDataCommand::setDataType(uint8_t data_type)
|
void MultiDataCommand::setDataType(const uint8_t data_type)
|
||||||
{
|
{
|
||||||
_payload[10] = data_type;
|
_payload[10] = data_type;
|
||||||
udpateCRC();
|
udpateCRC();
|
||||||
@ -60,7 +60,7 @@ uint8_t MultiDataCommand::getDataType()
|
|||||||
return _payload[10];
|
return _payload[10];
|
||||||
}
|
}
|
||||||
|
|
||||||
void MultiDataCommand::setTime(time_t time)
|
void MultiDataCommand::setTime(const time_t time)
|
||||||
{
|
{
|
||||||
_payload[12] = (uint8_t)(time >> 24);
|
_payload[12] = (uint8_t)(time >> 24);
|
||||||
_payload[13] = (uint8_t)(time >> 16);
|
_payload[13] = (uint8_t)(time >> 16);
|
||||||
@ -77,7 +77,7 @@ time_t MultiDataCommand::getTime()
|
|||||||
| (time_t)(_payload[15]);
|
| (time_t)(_payload[15]);
|
||||||
}
|
}
|
||||||
|
|
||||||
CommandAbstract* MultiDataCommand::getRequestFrameCommand(uint8_t frame_no)
|
CommandAbstract* MultiDataCommand::getRequestFrameCommand(const uint8_t frame_no)
|
||||||
{
|
{
|
||||||
_cmdRequestFrame.setTargetAddress(getTargetAddress());
|
_cmdRequestFrame.setTargetAddress(getTargetAddress());
|
||||||
_cmdRequestFrame.setFrameNo(frame_no);
|
_cmdRequestFrame.setFrameNo(frame_no);
|
||||||
@ -85,7 +85,7 @@ CommandAbstract* MultiDataCommand::getRequestFrameCommand(uint8_t frame_no)
|
|||||||
return &_cmdRequestFrame;
|
return &_cmdRequestFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MultiDataCommand::handleResponse(InverterAbstract* inverter, fragment_t fragment[], 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
|
// All fragments are available --> Check CRC
|
||||||
uint16_t crc = 0xffff, crcRcv = 0;
|
uint16_t crc = 0xffff, crcRcv = 0;
|
||||||
@ -116,7 +116,7 @@ void MultiDataCommand::udpateCRC()
|
|||||||
_payload[25] = (uint8_t)(crc);
|
_payload[25] = (uint8_t)(crc);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t MultiDataCommand::getTotalFragmentSize(fragment_t fragment[], uint8_t max_fragment_id)
|
uint8_t MultiDataCommand::getTotalFragmentSize(const fragment_t fragment[], const uint8_t max_fragment_id)
|
||||||
{
|
{
|
||||||
uint8_t fragmentSize = 0;
|
uint8_t fragmentSize = 0;
|
||||||
for (uint8_t i = 0; i < max_fragment_id; i++) {
|
for (uint8_t i = 0; i < max_fragment_id; i++) {
|
||||||
|
|||||||
@ -7,20 +7,20 @@
|
|||||||
|
|
||||||
class MultiDataCommand : public CommandAbstract {
|
class MultiDataCommand : public CommandAbstract {
|
||||||
public:
|
public:
|
||||||
explicit MultiDataCommand(uint64_t target_address = 0, uint64_t router_address = 0, uint8_t data_type = 0, time_t time = 0);
|
explicit MultiDataCommand(const uint64_t target_address = 0, const uint64_t router_address = 0, const uint8_t data_type = 0, const time_t time = 0);
|
||||||
|
|
||||||
void setTime(time_t time);
|
void setTime(const time_t time);
|
||||||
time_t getTime();
|
time_t getTime();
|
||||||
|
|
||||||
CommandAbstract* getRequestFrameCommand(uint8_t frame_no);
|
CommandAbstract* getRequestFrameCommand(const uint8_t frame_no);
|
||||||
|
|
||||||
virtual bool handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id);
|
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void setDataType(uint8_t data_type);
|
void setDataType(const uint8_t data_type);
|
||||||
uint8_t getDataType();
|
uint8_t getDataType();
|
||||||
void udpateCRC();
|
void udpateCRC();
|
||||||
static uint8_t getTotalFragmentSize(fragment_t fragment[], uint8_t max_fragment_id);
|
static uint8_t getTotalFragmentSize(const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||||
|
|
||||||
RequestFrameCommand _cmdRequestFrame;
|
RequestFrameCommand _cmdRequestFrame;
|
||||||
};
|
};
|
||||||
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "ParaSetCommand.h"
|
#include "ParaSetCommand.h"
|
||||||
|
|
||||||
ParaSetCommand::ParaSetCommand(uint64_t target_address, uint64_t router_address)
|
ParaSetCommand::ParaSetCommand(const uint64_t target_address, const uint64_t router_address)
|
||||||
: CommandAbstract(target_address, router_address)
|
: CommandAbstract(target_address, router_address)
|
||||||
{
|
{
|
||||||
_payload[0] = 0x52;
|
_payload[0] = 0x52;
|
||||||
|
|||||||
@ -5,5 +5,5 @@
|
|||||||
|
|
||||||
class ParaSetCommand : public CommandAbstract {
|
class ParaSetCommand : public CommandAbstract {
|
||||||
public:
|
public:
|
||||||
explicit ParaSetCommand(uint64_t target_address = 0, uint64_t router_address = 0);
|
explicit ParaSetCommand(const uint64_t target_address = 0, const uint64_t router_address = 0);
|
||||||
};
|
};
|
||||||
@ -26,7 +26,7 @@ ID Target Addr Source Addr Cmd SCmd ? CRC16 CRC8
|
|||||||
|
|
||||||
#define CRC_SIZE 2
|
#define CRC_SIZE 2
|
||||||
|
|
||||||
PowerControlCommand::PowerControlCommand(uint64_t target_address, uint64_t router_address)
|
PowerControlCommand::PowerControlCommand(const uint64_t target_address, const uint64_t router_address)
|
||||||
: DevControlCommand(target_address, router_address)
|
: DevControlCommand(target_address, router_address)
|
||||||
{
|
{
|
||||||
_payload[10] = 0x00; // TurnOn
|
_payload[10] = 0x00; // TurnOn
|
||||||
@ -44,7 +44,7 @@ String PowerControlCommand::getCommandName()
|
|||||||
return "PowerControl";
|
return "PowerControl";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PowerControlCommand::handleResponse(InverterAbstract* inverter, fragment_t fragment[], 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)) {
|
if (!DevControlCommand::handleResponse(inverter, fragment, max_fragment_id)) {
|
||||||
return false;
|
return false;
|
||||||
@ -60,7 +60,7 @@ void PowerControlCommand::gotTimeout(InverterAbstract* inverter)
|
|||||||
inverter->PowerCommand()->setLastPowerCommandSuccess(CMD_NOK);
|
inverter->PowerCommand()->setLastPowerCommandSuccess(CMD_NOK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PowerControlCommand::setPowerOn(bool state)
|
void PowerControlCommand::setPowerOn(const bool state)
|
||||||
{
|
{
|
||||||
if (state) {
|
if (state) {
|
||||||
_payload[10] = 0x00; // TurnOn
|
_payload[10] = 0x00; // TurnOn
|
||||||
|
|||||||
@ -5,13 +5,13 @@
|
|||||||
|
|
||||||
class PowerControlCommand : public DevControlCommand {
|
class PowerControlCommand : public DevControlCommand {
|
||||||
public:
|
public:
|
||||||
explicit PowerControlCommand(uint64_t target_address = 0, uint64_t router_address = 0);
|
explicit PowerControlCommand(const uint64_t target_address = 0, const uint64_t router_address = 0);
|
||||||
|
|
||||||
virtual String getCommandName();
|
virtual String getCommandName();
|
||||||
|
|
||||||
virtual bool handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id);
|
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||||
virtual void gotTimeout(InverterAbstract* inverter);
|
virtual void gotTimeout(InverterAbstract* inverter);
|
||||||
|
|
||||||
void setPowerOn(bool state);
|
void setPowerOn(const bool state);
|
||||||
void setRestart();
|
void setRestart();
|
||||||
};
|
};
|
||||||
@ -22,7 +22,7 @@ ID Target Addr Source Addr Idx DT ? Time Gap Pa
|
|||||||
#include "Hoymiles.h"
|
#include "Hoymiles.h"
|
||||||
#include "inverters/InverterAbstract.h"
|
#include "inverters/InverterAbstract.h"
|
||||||
|
|
||||||
RealTimeRunDataCommand::RealTimeRunDataCommand(uint64_t target_address, uint64_t router_address, time_t time)
|
RealTimeRunDataCommand::RealTimeRunDataCommand(const uint64_t target_address, const uint64_t router_address, const time_t time)
|
||||||
: MultiDataCommand(target_address, router_address)
|
: MultiDataCommand(target_address, router_address)
|
||||||
{
|
{
|
||||||
setTime(time);
|
setTime(time);
|
||||||
@ -35,7 +35,7 @@ String RealTimeRunDataCommand::getCommandName()
|
|||||||
return "RealTimeRunData";
|
return "RealTimeRunData";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RealTimeRunDataCommand::handleResponse(InverterAbstract* inverter, fragment_t fragment[], 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
|
// Check CRC of whole payload
|
||||||
if (!MultiDataCommand::handleResponse(inverter, fragment, max_fragment_id)) {
|
if (!MultiDataCommand::handleResponse(inverter, fragment, max_fragment_id)) {
|
||||||
|
|||||||
@ -5,10 +5,10 @@
|
|||||||
|
|
||||||
class RealTimeRunDataCommand : public MultiDataCommand {
|
class RealTimeRunDataCommand : public MultiDataCommand {
|
||||||
public:
|
public:
|
||||||
explicit RealTimeRunDataCommand(uint64_t target_address = 0, uint64_t router_address = 0, time_t time = 0);
|
explicit RealTimeRunDataCommand(const uint64_t target_address = 0, const uint64_t router_address = 0, const time_t time = 0);
|
||||||
|
|
||||||
virtual String getCommandName();
|
virtual String getCommandName();
|
||||||
|
|
||||||
virtual bool handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id);
|
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||||
virtual void gotTimeout(InverterAbstract* inverter);
|
virtual void gotTimeout(InverterAbstract* inverter);
|
||||||
};
|
};
|
||||||
@ -22,7 +22,7 @@ ID Target Addr Source Addr Frm CRC8
|
|||||||
*/
|
*/
|
||||||
#include "RequestFrameCommand.h"
|
#include "RequestFrameCommand.h"
|
||||||
|
|
||||||
RequestFrameCommand::RequestFrameCommand(uint64_t target_address, uint64_t router_address, uint8_t frame_no)
|
RequestFrameCommand::RequestFrameCommand(const uint64_t target_address, const uint64_t router_address, uint8_t frame_no)
|
||||||
: SingleDataCommand(target_address, router_address)
|
: SingleDataCommand(target_address, router_address)
|
||||||
{
|
{
|
||||||
if (frame_no > 127) {
|
if (frame_no > 127) {
|
||||||
@ -37,7 +37,7 @@ String RequestFrameCommand::getCommandName()
|
|||||||
return "RequestFrame";
|
return "RequestFrame";
|
||||||
}
|
}
|
||||||
|
|
||||||
void RequestFrameCommand::setFrameNo(uint8_t frame_no)
|
void RequestFrameCommand::setFrameNo(const uint8_t frame_no)
|
||||||
{
|
{
|
||||||
_payload[9] = frame_no | 0x80;
|
_payload[9] = frame_no | 0x80;
|
||||||
}
|
}
|
||||||
@ -47,7 +47,7 @@ uint8_t RequestFrameCommand::getFrameNo()
|
|||||||
return _payload[9] & (~0x80);
|
return _payload[9] & (~0x80);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RequestFrameCommand::handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id)
|
bool RequestFrameCommand::handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -5,12 +5,12 @@
|
|||||||
|
|
||||||
class RequestFrameCommand : public SingleDataCommand {
|
class RequestFrameCommand : public SingleDataCommand {
|
||||||
public:
|
public:
|
||||||
explicit RequestFrameCommand(uint64_t target_address = 0, uint64_t router_address = 0, uint8_t frame_no = 0);
|
explicit RequestFrameCommand(const uint64_t target_address = 0, const uint64_t router_address = 0, uint8_t frame_no = 0);
|
||||||
|
|
||||||
virtual String getCommandName();
|
virtual String getCommandName();
|
||||||
|
|
||||||
void setFrameNo(uint8_t frame_no);
|
void setFrameNo(const uint8_t frame_no);
|
||||||
uint8_t getFrameNo();
|
uint8_t getFrameNo();
|
||||||
|
|
||||||
virtual bool handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id);
|
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||||
};
|
};
|
||||||
@ -19,7 +19,7 @@ ID Target Addr Source Addr CRC8
|
|||||||
*/
|
*/
|
||||||
#include "SingleDataCommand.h"
|
#include "SingleDataCommand.h"
|
||||||
|
|
||||||
SingleDataCommand::SingleDataCommand(uint64_t target_address, uint64_t router_address)
|
SingleDataCommand::SingleDataCommand(const uint64_t target_address, const uint64_t router_address)
|
||||||
: CommandAbstract(target_address, router_address)
|
: CommandAbstract(target_address, router_address)
|
||||||
{
|
{
|
||||||
_payload[0] = 0x15;
|
_payload[0] = 0x15;
|
||||||
|
|||||||
@ -5,5 +5,5 @@
|
|||||||
|
|
||||||
class SingleDataCommand : public CommandAbstract {
|
class SingleDataCommand : public CommandAbstract {
|
||||||
public:
|
public:
|
||||||
explicit SingleDataCommand(uint64_t target_address = 0, uint64_t router_address = 0);
|
explicit SingleDataCommand(const uint64_t target_address = 0, const uint64_t router_address = 0);
|
||||||
};
|
};
|
||||||
@ -22,7 +22,7 @@ ID Target Addr Source Addr Idx DT ? Time Gap Pa
|
|||||||
#include "Hoymiles.h"
|
#include "Hoymiles.h"
|
||||||
#include "inverters/InverterAbstract.h"
|
#include "inverters/InverterAbstract.h"
|
||||||
|
|
||||||
SystemConfigParaCommand::SystemConfigParaCommand(uint64_t target_address, uint64_t router_address, time_t time)
|
SystemConfigParaCommand::SystemConfigParaCommand(const uint64_t target_address, const uint64_t router_address, const time_t time)
|
||||||
: MultiDataCommand(target_address, router_address)
|
: MultiDataCommand(target_address, router_address)
|
||||||
{
|
{
|
||||||
setTime(time);
|
setTime(time);
|
||||||
@ -35,7 +35,7 @@ String SystemConfigParaCommand::getCommandName()
|
|||||||
return "SystemConfigPara";
|
return "SystemConfigPara";
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SystemConfigParaCommand::handleResponse(InverterAbstract* inverter, fragment_t fragment[], 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
|
// Check CRC of whole payload
|
||||||
if (!MultiDataCommand::handleResponse(inverter, fragment, max_fragment_id)) {
|
if (!MultiDataCommand::handleResponse(inverter, fragment, max_fragment_id)) {
|
||||||
|
|||||||
@ -5,10 +5,10 @@
|
|||||||
|
|
||||||
class SystemConfigParaCommand : public MultiDataCommand {
|
class SystemConfigParaCommand : public MultiDataCommand {
|
||||||
public:
|
public:
|
||||||
explicit SystemConfigParaCommand(uint64_t target_address = 0, uint64_t router_address = 0, time_t time = 0);
|
explicit SystemConfigParaCommand(const uint64_t target_address = 0, const uint64_t router_address = 0, const time_t time = 0);
|
||||||
|
|
||||||
virtual String getCommandName();
|
virtual String getCommandName();
|
||||||
|
|
||||||
virtual bool handleResponse(InverterAbstract* inverter, fragment_t fragment[], uint8_t max_fragment_id);
|
virtual bool handleResponse(InverterAbstract* inverter, const fragment_t fragment[], const uint8_t max_fragment_id);
|
||||||
virtual void gotTimeout(InverterAbstract* inverter);
|
virtual void gotTimeout(InverterAbstract* inverter);
|
||||||
};
|
};
|
||||||
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "crc.h"
|
#include "crc.h"
|
||||||
|
|
||||||
uint8_t crc8(const uint8_t buf[], uint8_t len)
|
uint8_t crc8(const uint8_t buf[], const uint8_t len)
|
||||||
{
|
{
|
||||||
uint8_t crc = CRC8_INIT;
|
uint8_t crc = CRC8_INIT;
|
||||||
for (uint8_t i = 0; i < len; i++) {
|
for (uint8_t i = 0; i < len; i++) {
|
||||||
@ -16,7 +16,7 @@ uint8_t crc8(const uint8_t buf[], uint8_t len)
|
|||||||
return crc;
|
return crc;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t crc16(const uint8_t buf[], uint8_t len, uint16_t start)
|
uint16_t crc16(const uint8_t buf[], const uint8_t len, const uint16_t start)
|
||||||
{
|
{
|
||||||
uint16_t crc = start;
|
uint16_t crc = start;
|
||||||
uint8_t shift = 0;
|
uint8_t shift = 0;
|
||||||
@ -33,7 +33,7 @@ uint16_t crc16(const uint8_t buf[], uint8_t len, uint16_t start)
|
|||||||
return crc;
|
return crc;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t crc16nrf24(const uint8_t buf[], uint16_t lenBits, uint16_t startBit, uint16_t crcIn)
|
uint16_t crc16nrf24(const uint8_t buf[], const uint16_t lenBits, const uint16_t startBit, const uint16_t crcIn)
|
||||||
{
|
{
|
||||||
uint16_t crc = crcIn;
|
uint16_t crc = crcIn;
|
||||||
uint8_t idx, val = buf[(startBit >> 3)];
|
uint8_t idx, val = buf[(startBit >> 3)];
|
||||||
|
|||||||
@ -9,6 +9,6 @@
|
|||||||
#define CRC16_MODBUS_POLYNOM 0xA001
|
#define CRC16_MODBUS_POLYNOM 0xA001
|
||||||
#define CRC16_NRF24_POLYNOM 0x1021
|
#define CRC16_NRF24_POLYNOM 0x1021
|
||||||
|
|
||||||
uint8_t crc8(const uint8_t buf[], uint8_t len);
|
uint8_t crc8(const uint8_t buf[], const uint8_t len);
|
||||||
uint16_t crc16(const uint8_t buf[], uint8_t len, uint16_t start = 0xffff);
|
uint16_t crc16(const uint8_t buf[], const uint8_t len, const uint16_t start = 0xffff);
|
||||||
uint16_t crc16nrf24(const uint8_t buf[], uint16_t lenBits, uint16_t startBit = 0, uint16_t crcIn = 0xffff);
|
uint16_t crc16nrf24(const uint8_t buf[], const uint16_t lenBits, const uint16_t startBit = 0, const uint16_t crcIn = 0xffff);
|
||||||
|
|||||||
@ -28,10 +28,10 @@ static const byteAssign_t byteAssignment[] = {
|
|||||||
{ TYPE_AC, CH0, FLD_EFF, UNIT_PCT, CALC_EFF_CH0, 0, CMD_CALC, false, 3 }
|
{ TYPE_AC, CH0, FLD_EFF, UNIT_PCT, CALC_EFF_CH0, 0, CMD_CALC, false, 3 }
|
||||||
};
|
};
|
||||||
|
|
||||||
HMS_1CH::HMS_1CH(HoymilesRadio* radio, uint64_t serial)
|
HMS_1CH::HMS_1CH(HoymilesRadio* radio, const uint64_t serial)
|
||||||
: HMS_Abstract(radio, serial) {};
|
: HMS_Abstract(radio, serial) {};
|
||||||
|
|
||||||
bool HMS_1CH::isValidSerial(uint64_t serial)
|
bool HMS_1CH::isValidSerial(const uint64_t serial)
|
||||||
{
|
{
|
||||||
// serial >= 0x112400000000 && serial <= 0x112499999999
|
// serial >= 0x112400000000 && serial <= 0x112499999999
|
||||||
uint16_t preSerial = (serial >> 32) & 0xffff;
|
uint16_t preSerial = (serial >> 32) & 0xffff;
|
||||||
|
|||||||
@ -6,8 +6,8 @@
|
|||||||
|
|
||||||
class HMS_1CH : public HMS_Abstract {
|
class HMS_1CH : public HMS_Abstract {
|
||||||
public:
|
public:
|
||||||
explicit HMS_1CH(HoymilesRadio* radio, uint64_t serial);
|
explicit HMS_1CH(HoymilesRadio* radio, const uint64_t serial);
|
||||||
static bool isValidSerial(uint64_t serial);
|
static bool isValidSerial(const uint64_t serial);
|
||||||
String typeName();
|
String typeName();
|
||||||
const byteAssign_t* getByteAssignment();
|
const byteAssign_t* getByteAssignment();
|
||||||
uint8_t getByteAssignmentSize();
|
uint8_t getByteAssignmentSize();
|
||||||
|
|||||||
@ -28,10 +28,10 @@ static const byteAssign_t byteAssignment[] = {
|
|||||||
{ TYPE_AC, CH0, FLD_EFF, UNIT_PCT, CALC_EFF_CH0, 0, CMD_CALC, false, 3 }
|
{ TYPE_AC, CH0, FLD_EFF, UNIT_PCT, CALC_EFF_CH0, 0, CMD_CALC, false, 3 }
|
||||||
};
|
};
|
||||||
|
|
||||||
HMS_1CHv2::HMS_1CHv2(HoymilesRadio* radio, uint64_t serial)
|
HMS_1CHv2::HMS_1CHv2(HoymilesRadio* radio, const uint64_t serial)
|
||||||
: HMS_Abstract(radio, serial) {};
|
: HMS_Abstract(radio, serial) {};
|
||||||
|
|
||||||
bool HMS_1CHv2::isValidSerial(uint64_t serial)
|
bool HMS_1CHv2::isValidSerial(const uint64_t serial)
|
||||||
{
|
{
|
||||||
// serial >= 0x112500000000 && serial <= 0x112599999999
|
// serial >= 0x112500000000 && serial <= 0x112599999999
|
||||||
uint16_t preSerial = (serial >> 32) & 0xffff;
|
uint16_t preSerial = (serial >> 32) & 0xffff;
|
||||||
|
|||||||
@ -6,8 +6,8 @@
|
|||||||
|
|
||||||
class HMS_1CHv2 : public HMS_Abstract {
|
class HMS_1CHv2 : public HMS_Abstract {
|
||||||
public:
|
public:
|
||||||
explicit HMS_1CHv2(HoymilesRadio* radio, uint64_t serial);
|
explicit HMS_1CHv2(HoymilesRadio* radio, const uint64_t serial);
|
||||||
static bool isValidSerial(uint64_t serial);
|
static bool isValidSerial(const uint64_t serial);
|
||||||
String typeName();
|
String typeName();
|
||||||
const byteAssign_t* getByteAssignment();
|
const byteAssign_t* getByteAssignment();
|
||||||
uint8_t getByteAssignmentSize();
|
uint8_t getByteAssignmentSize();
|
||||||
|
|||||||
@ -35,10 +35,10 @@ static const byteAssign_t byteAssignment[] = {
|
|||||||
{ TYPE_AC, CH0, FLD_EFF, UNIT_PCT, CALC_EFF_CH0, 0, CMD_CALC, false, 3 }
|
{ TYPE_AC, CH0, FLD_EFF, UNIT_PCT, CALC_EFF_CH0, 0, CMD_CALC, false, 3 }
|
||||||
};
|
};
|
||||||
|
|
||||||
HMS_2CH::HMS_2CH(HoymilesRadio* radio, uint64_t serial)
|
HMS_2CH::HMS_2CH(HoymilesRadio* radio, const uint64_t serial)
|
||||||
: HMS_Abstract(radio, serial) {};
|
: HMS_Abstract(radio, serial) {};
|
||||||
|
|
||||||
bool HMS_2CH::isValidSerial(uint64_t serial)
|
bool HMS_2CH::isValidSerial(const uint64_t serial)
|
||||||
{
|
{
|
||||||
// serial >= 0x114400000000 && serial <= 0x114499999999
|
// serial >= 0x114400000000 && serial <= 0x114499999999
|
||||||
uint16_t preSerial = (serial >> 32) & 0xffff;
|
uint16_t preSerial = (serial >> 32) & 0xffff;
|
||||||
|
|||||||
@ -6,8 +6,8 @@
|
|||||||
|
|
||||||
class HMS_2CH : public HMS_Abstract {
|
class HMS_2CH : public HMS_Abstract {
|
||||||
public:
|
public:
|
||||||
explicit HMS_2CH(HoymilesRadio* radio, uint64_t serial);
|
explicit HMS_2CH(HoymilesRadio* radio, const uint64_t serial);
|
||||||
static bool isValidSerial(uint64_t serial);
|
static bool isValidSerial(const uint64_t serial);
|
||||||
String typeName();
|
String typeName();
|
||||||
const byteAssign_t* getByteAssignment();
|
const byteAssign_t* getByteAssignment();
|
||||||
uint8_t getByteAssignmentSize();
|
uint8_t getByteAssignmentSize();
|
||||||
|
|||||||
@ -49,10 +49,10 @@ static const byteAssign_t byteAssignment[] = {
|
|||||||
{ TYPE_AC, CH0, FLD_EFF, UNIT_PCT, CALC_EFF_CH0, 0, CMD_CALC, false, 3 }
|
{ TYPE_AC, CH0, FLD_EFF, UNIT_PCT, CALC_EFF_CH0, 0, CMD_CALC, false, 3 }
|
||||||
};
|
};
|
||||||
|
|
||||||
HMS_4CH::HMS_4CH(HoymilesRadio* radio, uint64_t serial)
|
HMS_4CH::HMS_4CH(HoymilesRadio* radio, const uint64_t serial)
|
||||||
: HMS_Abstract(radio, serial) {};
|
: HMS_Abstract(radio, serial) {};
|
||||||
|
|
||||||
bool HMS_4CH::isValidSerial(uint64_t serial)
|
bool HMS_4CH::isValidSerial(const uint64_t serial)
|
||||||
{
|
{
|
||||||
// serial >= 0x116400000000 && serial <= 0x116499999999
|
// serial >= 0x116400000000 && serial <= 0x116499999999
|
||||||
uint16_t preSerial = (serial >> 32) & 0xffff;
|
uint16_t preSerial = (serial >> 32) & 0xffff;
|
||||||
|
|||||||
@ -5,8 +5,8 @@
|
|||||||
|
|
||||||
class HMS_4CH : public HMS_Abstract {
|
class HMS_4CH : public HMS_Abstract {
|
||||||
public:
|
public:
|
||||||
explicit HMS_4CH(HoymilesRadio* radio, uint64_t serial);
|
explicit HMS_4CH(HoymilesRadio* radio, const uint64_t serial);
|
||||||
static bool isValidSerial(uint64_t serial);
|
static bool isValidSerial(const uint64_t serial);
|
||||||
String typeName();
|
String typeName();
|
||||||
const byteAssign_t* getByteAssignment();
|
const byteAssign_t* getByteAssignment();
|
||||||
uint8_t getByteAssignmentSize();
|
uint8_t getByteAssignmentSize();
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
#include "HoymilesRadio_CMT.h"
|
#include "HoymilesRadio_CMT.h"
|
||||||
#include "commands/ChannelChangeCommand.h"
|
#include "commands/ChannelChangeCommand.h"
|
||||||
|
|
||||||
HMS_Abstract::HMS_Abstract(HoymilesRadio* radio, uint64_t serial)
|
HMS_Abstract::HMS_Abstract(HoymilesRadio* radio, const uint64_t serial)
|
||||||
: HM_Abstract(radio, serial)
|
: HM_Abstract(radio, serial)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
class HMS_Abstract : public HM_Abstract {
|
class HMS_Abstract : public HM_Abstract {
|
||||||
public:
|
public:
|
||||||
explicit HMS_Abstract(HoymilesRadio* radio, uint64_t serial);
|
explicit HMS_Abstract(HoymilesRadio* radio, const uint64_t serial);
|
||||||
|
|
||||||
virtual bool sendChangeChannelRequest();
|
virtual bool sendChangeChannelRequest();
|
||||||
};
|
};
|
||||||
@ -58,10 +58,10 @@ static const byteAssign_t byteAssignment[] = {
|
|||||||
{ TYPE_AC, CH0, FLD_EFF, UNIT_PCT, CALC_EFF_CH0, 0, CMD_CALC, false, 3 }
|
{ TYPE_AC, CH0, FLD_EFF, UNIT_PCT, CALC_EFF_CH0, 0, CMD_CALC, false, 3 }
|
||||||
};
|
};
|
||||||
|
|
||||||
HMT_4CH::HMT_4CH(HoymilesRadio* radio, uint64_t serial)
|
HMT_4CH::HMT_4CH(HoymilesRadio* radio, const uint64_t serial)
|
||||||
: HMT_Abstract(radio, serial) {};
|
: HMT_Abstract(radio, serial) {};
|
||||||
|
|
||||||
bool HMT_4CH::isValidSerial(uint64_t serial)
|
bool HMT_4CH::isValidSerial(const uint64_t serial)
|
||||||
{
|
{
|
||||||
// serial >= 0x136100000000 && serial <= 0x136199999999
|
// serial >= 0x136100000000 && serial <= 0x136199999999
|
||||||
uint16_t preSerial = (serial >> 32) & 0xffff;
|
uint16_t preSerial = (serial >> 32) & 0xffff;
|
||||||
|
|||||||
@ -5,8 +5,8 @@
|
|||||||
|
|
||||||
class HMT_4CH : public HMT_Abstract {
|
class HMT_4CH : public HMT_Abstract {
|
||||||
public:
|
public:
|
||||||
explicit HMT_4CH(HoymilesRadio* radio, uint64_t serial);
|
explicit HMT_4CH(HoymilesRadio* radio, const uint64_t serial);
|
||||||
static bool isValidSerial(uint64_t serial);
|
static bool isValidSerial(const uint64_t serial);
|
||||||
String typeName();
|
String typeName();
|
||||||
const byteAssign_t* getByteAssignment();
|
const byteAssign_t* getByteAssignment();
|
||||||
uint8_t getByteAssignmentSize();
|
uint8_t getByteAssignmentSize();
|
||||||
|
|||||||
@ -72,10 +72,10 @@ static const byteAssign_t byteAssignment[] = {
|
|||||||
{ TYPE_AC, CH0, FLD_EFF, UNIT_PCT, CALC_EFF_CH0, 0, CMD_CALC, false, 3 }
|
{ TYPE_AC, CH0, FLD_EFF, UNIT_PCT, CALC_EFF_CH0, 0, CMD_CALC, false, 3 }
|
||||||
};
|
};
|
||||||
|
|
||||||
HMT_6CH::HMT_6CH(HoymilesRadio* radio, uint64_t serial)
|
HMT_6CH::HMT_6CH(HoymilesRadio* radio, const uint64_t serial)
|
||||||
: HMT_Abstract(radio, serial) {};
|
: HMT_Abstract(radio, serial) {};
|
||||||
|
|
||||||
bool HMT_6CH::isValidSerial(uint64_t serial)
|
bool HMT_6CH::isValidSerial(const uint64_t serial)
|
||||||
{
|
{
|
||||||
// serial >= 0x138200000000 && serial <= 0x138299999999
|
// serial >= 0x138200000000 && serial <= 0x138299999999
|
||||||
uint16_t preSerial = (serial >> 32) & 0xffff;
|
uint16_t preSerial = (serial >> 32) & 0xffff;
|
||||||
|
|||||||
@ -5,8 +5,8 @@
|
|||||||
|
|
||||||
class HMT_6CH : public HMT_Abstract {
|
class HMT_6CH : public HMT_Abstract {
|
||||||
public:
|
public:
|
||||||
explicit HMT_6CH(HoymilesRadio* radio, uint64_t serial);
|
explicit HMT_6CH(HoymilesRadio* radio, const uint64_t serial);
|
||||||
static bool isValidSerial(uint64_t serial);
|
static bool isValidSerial(const uint64_t serial);
|
||||||
String typeName();
|
String typeName();
|
||||||
const byteAssign_t* getByteAssignment();
|
const byteAssign_t* getByteAssignment();
|
||||||
uint8_t getByteAssignmentSize();
|
uint8_t getByteAssignmentSize();
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
#include "commands/ChannelChangeCommand.h"
|
#include "commands/ChannelChangeCommand.h"
|
||||||
#include "parser/AlarmLogParser.h"
|
#include "parser/AlarmLogParser.h"
|
||||||
|
|
||||||
HMT_Abstract::HMT_Abstract(HoymilesRadio* radio, uint64_t serial)
|
HMT_Abstract::HMT_Abstract(HoymilesRadio* radio, const uint64_t serial)
|
||||||
: HM_Abstract(radio, serial)
|
: HM_Abstract(radio, serial)
|
||||||
{
|
{
|
||||||
EventLog()->setMessageType(AlarmMessageType_t::HMT);
|
EventLog()->setMessageType(AlarmMessageType_t::HMT);
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
class HMT_Abstract : public HM_Abstract {
|
class HMT_Abstract : public HM_Abstract {
|
||||||
public:
|
public:
|
||||||
explicit HMT_Abstract(HoymilesRadio* radio, uint64_t serial);
|
explicit HMT_Abstract(HoymilesRadio* radio, const uint64_t serial);
|
||||||
|
|
||||||
virtual bool sendChangeChannelRequest();
|
virtual bool sendChangeChannelRequest();
|
||||||
};
|
};
|
||||||
@ -28,10 +28,10 @@ static const byteAssign_t byteAssignment[] = {
|
|||||||
{ TYPE_AC, CH0, FLD_EFF, UNIT_PCT, CALC_EFF_CH0, 0, CMD_CALC, false, 3 }
|
{ TYPE_AC, CH0, FLD_EFF, UNIT_PCT, CALC_EFF_CH0, 0, CMD_CALC, false, 3 }
|
||||||
};
|
};
|
||||||
|
|
||||||
HM_1CH::HM_1CH(HoymilesRadio* radio, uint64_t serial)
|
HM_1CH::HM_1CH(HoymilesRadio* radio, const uint64_t serial)
|
||||||
: HM_Abstract(radio, serial) {};
|
: HM_Abstract(radio, serial) {};
|
||||||
|
|
||||||
bool HM_1CH::isValidSerial(uint64_t serial)
|
bool HM_1CH::isValidSerial(const uint64_t serial)
|
||||||
{
|
{
|
||||||
// serial >= 0x112100000000 && serial <= 0x112199999999
|
// serial >= 0x112100000000 && serial <= 0x112199999999
|
||||||
|
|
||||||
|
|||||||
@ -6,8 +6,8 @@
|
|||||||
|
|
||||||
class HM_1CH : public HM_Abstract {
|
class HM_1CH : public HM_Abstract {
|
||||||
public:
|
public:
|
||||||
explicit HM_1CH(HoymilesRadio* radio, uint64_t serial);
|
explicit HM_1CH(HoymilesRadio* radio, const uint64_t serial);
|
||||||
static bool isValidSerial(uint64_t serial);
|
static bool isValidSerial(const uint64_t serial);
|
||||||
String typeName();
|
String typeName();
|
||||||
const byteAssign_t* getByteAssignment();
|
const byteAssign_t* getByteAssignment();
|
||||||
uint8_t getByteAssignmentSize();
|
uint8_t getByteAssignmentSize();
|
||||||
|
|||||||
@ -36,10 +36,10 @@ static const byteAssign_t byteAssignment[] = {
|
|||||||
{ TYPE_AC, CH0, FLD_EFF, UNIT_PCT, CALC_EFF_CH0, 0, CMD_CALC, false, 3 }
|
{ TYPE_AC, CH0, FLD_EFF, UNIT_PCT, CALC_EFF_CH0, 0, CMD_CALC, false, 3 }
|
||||||
};
|
};
|
||||||
|
|
||||||
HM_2CH::HM_2CH(HoymilesRadio* radio, uint64_t serial)
|
HM_2CH::HM_2CH(HoymilesRadio* radio, const uint64_t serial)
|
||||||
: HM_Abstract(radio, serial) {};
|
: HM_Abstract(radio, serial) {};
|
||||||
|
|
||||||
bool HM_2CH::isValidSerial(uint64_t serial)
|
bool HM_2CH::isValidSerial(const uint64_t serial)
|
||||||
{
|
{
|
||||||
// serial >= 0x114100000000 && serial <= 0x114199999999
|
// serial >= 0x114100000000 && serial <= 0x114199999999
|
||||||
|
|
||||||
|
|||||||
@ -5,8 +5,8 @@
|
|||||||
|
|
||||||
class HM_2CH : public HM_Abstract {
|
class HM_2CH : public HM_Abstract {
|
||||||
public:
|
public:
|
||||||
explicit HM_2CH(HoymilesRadio* radio, uint64_t serial);
|
explicit HM_2CH(HoymilesRadio* radio, const uint64_t serial);
|
||||||
static bool isValidSerial(uint64_t serial);
|
static bool isValidSerial(const uint64_t serial);
|
||||||
String typeName();
|
String typeName();
|
||||||
const byteAssign_t* getByteAssignment();
|
const byteAssign_t* getByteAssignment();
|
||||||
uint8_t getByteAssignmentSize();
|
uint8_t getByteAssignmentSize();
|
||||||
|
|||||||
@ -49,10 +49,10 @@ static const byteAssign_t byteAssignment[] = {
|
|||||||
{ TYPE_AC, CH0, FLD_EFF, UNIT_PCT, CALC_EFF_CH0, 0, CMD_CALC, false, 3 }
|
{ TYPE_AC, CH0, FLD_EFF, UNIT_PCT, CALC_EFF_CH0, 0, CMD_CALC, false, 3 }
|
||||||
};
|
};
|
||||||
|
|
||||||
HM_4CH::HM_4CH(HoymilesRadio* radio, uint64_t serial)
|
HM_4CH::HM_4CH(HoymilesRadio* radio, const uint64_t serial)
|
||||||
: HM_Abstract(radio, serial) {};
|
: HM_Abstract(radio, serial) {};
|
||||||
|
|
||||||
bool HM_4CH::isValidSerial(uint64_t serial)
|
bool HM_4CH::isValidSerial(const uint64_t serial)
|
||||||
{
|
{
|
||||||
// serial >= 0x116100000000 && serial <= 0x116199999999
|
// serial >= 0x116100000000 && serial <= 0x116199999999
|
||||||
|
|
||||||
|
|||||||
@ -5,8 +5,8 @@
|
|||||||
|
|
||||||
class HM_4CH : public HM_Abstract {
|
class HM_4CH : public HM_Abstract {
|
||||||
public:
|
public:
|
||||||
explicit HM_4CH(HoymilesRadio* radio, uint64_t serial);
|
explicit HM_4CH(HoymilesRadio* radio, const uint64_t serial);
|
||||||
static bool isValidSerial(uint64_t serial);
|
static bool isValidSerial(const uint64_t serial);
|
||||||
String typeName();
|
String typeName();
|
||||||
const byteAssign_t* getByteAssignment();
|
const byteAssign_t* getByteAssignment();
|
||||||
uint8_t getByteAssignmentSize();
|
uint8_t getByteAssignmentSize();
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
#include "commands/RealTimeRunDataCommand.h"
|
#include "commands/RealTimeRunDataCommand.h"
|
||||||
#include "commands/SystemConfigParaCommand.h"
|
#include "commands/SystemConfigParaCommand.h"
|
||||||
|
|
||||||
HM_Abstract::HM_Abstract(HoymilesRadio* radio, uint64_t serial)
|
HM_Abstract::HM_Abstract(HoymilesRadio* radio, const uint64_t serial)
|
||||||
: InverterAbstract(radio, serial) {};
|
: InverterAbstract(radio, serial) {};
|
||||||
|
|
||||||
bool HM_Abstract::sendStatsRequest()
|
bool HM_Abstract::sendStatsRequest()
|
||||||
@ -38,7 +38,7 @@ bool HM_Abstract::sendStatsRequest()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HM_Abstract::sendAlarmLogRequest(bool force)
|
bool HM_Abstract::sendAlarmLogRequest(const bool force)
|
||||||
{
|
{
|
||||||
if (!getEnablePolling()) {
|
if (!getEnablePolling()) {
|
||||||
return false;
|
return false;
|
||||||
@ -121,7 +121,7 @@ bool HM_Abstract::sendSystemConfigParaRequest()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HM_Abstract::sendActivePowerControlRequest(float limit, PowerLimitControlType type)
|
bool HM_Abstract::sendActivePowerControlRequest(float limit, const PowerLimitControlType type)
|
||||||
{
|
{
|
||||||
if (!getEnableCommands()) {
|
if (!getEnableCommands()) {
|
||||||
return false;
|
return false;
|
||||||
@ -148,7 +148,7 @@ bool HM_Abstract::resendActivePowerControlRequest()
|
|||||||
return sendActivePowerControlRequest(_activePowerControlLimit, _activePowerControlType);
|
return sendActivePowerControlRequest(_activePowerControlLimit, _activePowerControlType);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HM_Abstract::sendPowerControlRequest(bool turnOn)
|
bool HM_Abstract::sendPowerControlRequest(const bool turnOn)
|
||||||
{
|
{
|
||||||
if (!getEnableCommands()) {
|
if (!getEnableCommands()) {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@ -5,14 +5,14 @@
|
|||||||
|
|
||||||
class HM_Abstract : public InverterAbstract {
|
class HM_Abstract : public InverterAbstract {
|
||||||
public:
|
public:
|
||||||
explicit HM_Abstract(HoymilesRadio* radio, uint64_t serial);
|
explicit HM_Abstract(HoymilesRadio* radio, const uint64_t serial);
|
||||||
bool sendStatsRequest();
|
bool sendStatsRequest();
|
||||||
bool sendAlarmLogRequest(bool force = false);
|
bool sendAlarmLogRequest(const bool force = false);
|
||||||
bool sendDevInfoRequest();
|
bool sendDevInfoRequest();
|
||||||
bool sendSystemConfigParaRequest();
|
bool sendSystemConfigParaRequest();
|
||||||
bool sendActivePowerControlRequest(float limit, PowerLimitControlType type);
|
bool sendActivePowerControlRequest(float limit, const PowerLimitControlType type);
|
||||||
bool resendActivePowerControlRequest();
|
bool resendActivePowerControlRequest();
|
||||||
bool sendPowerControlRequest(bool turnOn);
|
bool sendPowerControlRequest(const bool turnOn);
|
||||||
bool sendRestartControlRequest();
|
bool sendRestartControlRequest();
|
||||||
bool resendPowerControlRequest();
|
bool resendPowerControlRequest();
|
||||||
bool sendGridOnProFileParaRequest();
|
bool sendGridOnProFileParaRequest();
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
#include "crc.h"
|
#include "crc.h"
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
InverterAbstract::InverterAbstract(HoymilesRadio* radio, uint64_t serial)
|
InverterAbstract::InverterAbstract(HoymilesRadio* radio, const uint64_t serial)
|
||||||
{
|
{
|
||||||
_serial.u64 = serial;
|
_serial.u64 = serial;
|
||||||
_radio = radio;
|
_radio = radio;
|
||||||
@ -77,7 +77,7 @@ bool InverterAbstract::isReachable()
|
|||||||
return _enablePolling && Statistics()->getRxFailureCount() <= _reachableThreshold;
|
return _enablePolling && Statistics()->getRxFailureCount() <= _reachableThreshold;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InverterAbstract::setEnablePolling(bool enabled)
|
void InverterAbstract::setEnablePolling(const bool enabled)
|
||||||
{
|
{
|
||||||
_enablePolling = enabled;
|
_enablePolling = enabled;
|
||||||
}
|
}
|
||||||
@ -87,7 +87,7 @@ bool InverterAbstract::getEnablePolling()
|
|||||||
return _enablePolling;
|
return _enablePolling;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InverterAbstract::setEnableCommands(bool enabled)
|
void InverterAbstract::setEnableCommands(const bool enabled)
|
||||||
{
|
{
|
||||||
_enableCommands = enabled;
|
_enableCommands = enabled;
|
||||||
}
|
}
|
||||||
@ -97,7 +97,7 @@ bool InverterAbstract::getEnableCommands()
|
|||||||
return _enableCommands;
|
return _enableCommands;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InverterAbstract::setReachableThreshold(uint8_t threshold)
|
void InverterAbstract::setReachableThreshold(const uint8_t threshold)
|
||||||
{
|
{
|
||||||
_reachableThreshold = threshold;
|
_reachableThreshold = threshold;
|
||||||
}
|
}
|
||||||
@ -107,7 +107,7 @@ uint8_t InverterAbstract::getReachableThreshold()
|
|||||||
return _reachableThreshold;
|
return _reachableThreshold;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InverterAbstract::setZeroValuesIfUnreachable(bool enabled)
|
void InverterAbstract::setZeroValuesIfUnreachable(const bool enabled)
|
||||||
{
|
{
|
||||||
_zeroValuesIfUnreachable = enabled;
|
_zeroValuesIfUnreachable = enabled;
|
||||||
}
|
}
|
||||||
@ -117,7 +117,7 @@ bool InverterAbstract::getZeroValuesIfUnreachable()
|
|||||||
return _zeroValuesIfUnreachable;
|
return _zeroValuesIfUnreachable;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InverterAbstract::setZeroYieldDayOnMidnight(bool enabled)
|
void InverterAbstract::setZeroYieldDayOnMidnight(const bool enabled)
|
||||||
{
|
{
|
||||||
_zeroYieldDayOnMidnight = enabled;
|
_zeroYieldDayOnMidnight = enabled;
|
||||||
}
|
}
|
||||||
@ -175,7 +175,7 @@ void InverterAbstract::clearRxFragmentBuffer()
|
|||||||
_rxFragmentRetransmitCnt = 0;
|
_rxFragmentRetransmitCnt = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InverterAbstract::addRxFragment(uint8_t fragment[], uint8_t len)
|
void InverterAbstract::addRxFragment(const uint8_t fragment[], const uint8_t len)
|
||||||
{
|
{
|
||||||
if (len < 11) {
|
if (len < 11) {
|
||||||
Hoymiles.getMessageOutput()->printf("FATAL: (%s, %d) fragment too short\r\n", __FILE__, __LINE__);
|
Hoymiles.getMessageOutput()->printf("FATAL: (%s, %d) fragment too short\r\n", __FILE__, __LINE__);
|
||||||
|
|||||||
@ -30,7 +30,7 @@ class CommandAbstract;
|
|||||||
|
|
||||||
class InverterAbstract {
|
class InverterAbstract {
|
||||||
public:
|
public:
|
||||||
explicit InverterAbstract(HoymilesRadio* radio, uint64_t serial);
|
explicit InverterAbstract(HoymilesRadio* radio, const uint64_t serial);
|
||||||
void init();
|
void init();
|
||||||
uint64_t serial();
|
uint64_t serial();
|
||||||
const String& serialString();
|
const String& serialString();
|
||||||
@ -43,32 +43,32 @@ public:
|
|||||||
bool isProducing();
|
bool isProducing();
|
||||||
bool isReachable();
|
bool isReachable();
|
||||||
|
|
||||||
void setEnablePolling(bool enabled);
|
void setEnablePolling(const bool enabled);
|
||||||
bool getEnablePolling();
|
bool getEnablePolling();
|
||||||
|
|
||||||
void setEnableCommands(bool enabled);
|
void setEnableCommands(const bool enabled);
|
||||||
bool getEnableCommands();
|
bool getEnableCommands();
|
||||||
|
|
||||||
void setReachableThreshold(uint8_t threshold);
|
void setReachableThreshold(const uint8_t threshold);
|
||||||
uint8_t getReachableThreshold();
|
uint8_t getReachableThreshold();
|
||||||
|
|
||||||
void setZeroValuesIfUnreachable(bool enabled);
|
void setZeroValuesIfUnreachable(const bool enabled);
|
||||||
bool getZeroValuesIfUnreachable();
|
bool getZeroValuesIfUnreachable();
|
||||||
|
|
||||||
void setZeroYieldDayOnMidnight(bool enabled);
|
void setZeroYieldDayOnMidnight(const bool enabled);
|
||||||
bool getZeroYieldDayOnMidnight();
|
bool getZeroYieldDayOnMidnight();
|
||||||
|
|
||||||
void clearRxFragmentBuffer();
|
void clearRxFragmentBuffer();
|
||||||
void addRxFragment(uint8_t fragment[], uint8_t len);
|
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 sendStatsRequest() = 0;
|
||||||
virtual bool sendAlarmLogRequest(bool force = false) = 0;
|
virtual bool sendAlarmLogRequest(const bool force = false) = 0;
|
||||||
virtual bool sendDevInfoRequest() = 0;
|
virtual bool sendDevInfoRequest() = 0;
|
||||||
virtual bool sendSystemConfigParaRequest() = 0;
|
virtual bool sendSystemConfigParaRequest() = 0;
|
||||||
virtual bool sendActivePowerControlRequest(float limit, PowerLimitControlType type) = 0;
|
virtual bool sendActivePowerControlRequest(float limit, const PowerLimitControlType type) = 0;
|
||||||
virtual bool resendActivePowerControlRequest() = 0;
|
virtual bool resendActivePowerControlRequest() = 0;
|
||||||
virtual bool sendPowerControlRequest(bool turnOn) = 0;
|
virtual bool sendPowerControlRequest(const bool turnOn) = 0;
|
||||||
virtual bool sendRestartControlRequest() = 0;
|
virtual bool sendRestartControlRequest() = 0;
|
||||||
virtual bool resendPowerControlRequest() = 0;
|
virtual bool resendPowerControlRequest() = 0;
|
||||||
virtual bool sendChangeChannelRequest();
|
virtual bool sendChangeChannelRequest();
|
||||||
|
|||||||
@ -181,7 +181,7 @@ void AlarmLogParser::clearBuffer()
|
|||||||
_alarmLogLength = 0;
|
_alarmLogLength = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlarmLogParser::appendFragment(uint8_t offset, uint8_t* payload, uint8_t len)
|
void AlarmLogParser::appendFragment(const uint8_t offset, const uint8_t* payload, const uint8_t len)
|
||||||
{
|
{
|
||||||
if (offset + len > ALARM_LOG_PAYLOAD_SIZE) {
|
if (offset + len > ALARM_LOG_PAYLOAD_SIZE) {
|
||||||
Hoymiles.getMessageOutput()->printf("FATAL: (%s, %d) stats packet too large for buffer (%d > %d)\r\n", __FILE__, __LINE__, offset + len, ALARM_LOG_PAYLOAD_SIZE);
|
Hoymiles.getMessageOutput()->printf("FATAL: (%s, %d) stats packet too large for buffer (%d > %d)\r\n", __FILE__, __LINE__, offset + len, ALARM_LOG_PAYLOAD_SIZE);
|
||||||
@ -199,7 +199,7 @@ uint8_t AlarmLogParser::getEntryCount()
|
|||||||
return (_alarmLogLength - 2) / ALARM_LOG_ENTRY_SIZE;
|
return (_alarmLogLength - 2) / ALARM_LOG_ENTRY_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlarmLogParser::setLastAlarmRequestSuccess(LastCommandSuccess status)
|
void AlarmLogParser::setLastAlarmRequestSuccess(const LastCommandSuccess status)
|
||||||
{
|
{
|
||||||
_lastAlarmRequestSuccess = status;
|
_lastAlarmRequestSuccess = status;
|
||||||
}
|
}
|
||||||
@ -209,12 +209,12 @@ LastCommandSuccess AlarmLogParser::getLastAlarmRequestSuccess()
|
|||||||
return _lastAlarmRequestSuccess;
|
return _lastAlarmRequestSuccess;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlarmLogParser::setMessageType(AlarmMessageType_t type)
|
void AlarmLogParser::setMessageType(const AlarmMessageType_t type)
|
||||||
{
|
{
|
||||||
_messageType = type;
|
_messageType = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AlarmLogParser::getLogEntry(uint8_t entryId, AlarmLogEntry_t* entry, 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;
|
const uint8_t entryStartOffset = 2 + entryId * ALARM_LOG_ENTRY_SIZE;
|
||||||
|
|
||||||
@ -266,7 +266,7 @@ void AlarmLogParser::getLogEntry(uint8_t entryId, AlarmLogEntry_t* entry, AlarmM
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String AlarmLogParser::getLocaleMessage(const AlarmMessage_t* msg, AlarmMessageLocale_t locale)
|
String AlarmLogParser::getLocaleMessage(const AlarmMessage_t* msg, const AlarmMessageLocale_t locale)
|
||||||
{
|
{
|
||||||
if (locale == AlarmMessageLocale_t::DE) {
|
if (locale == AlarmMessageLocale_t::DE) {
|
||||||
return msg->Message_de[0] != '\0' ? msg->Message_de : msg->Message_en;
|
return msg->Message_de[0] != '\0' ? msg->Message_de : msg->Message_en;
|
||||||
|
|||||||
@ -40,19 +40,19 @@ class AlarmLogParser : public Parser {
|
|||||||
public:
|
public:
|
||||||
AlarmLogParser();
|
AlarmLogParser();
|
||||||
void clearBuffer();
|
void clearBuffer();
|
||||||
void appendFragment(uint8_t offset, uint8_t* payload, uint8_t len);
|
void appendFragment(const uint8_t offset, const uint8_t* payload, const uint8_t len);
|
||||||
|
|
||||||
uint8_t getEntryCount();
|
uint8_t getEntryCount();
|
||||||
void getLogEntry(uint8_t entryId, AlarmLogEntry_t* entry, AlarmMessageLocale_t locale = AlarmMessageLocale_t::EN);
|
void getLogEntry(const uint8_t entryId, AlarmLogEntry_t* entry, const AlarmMessageLocale_t locale = AlarmMessageLocale_t::EN);
|
||||||
|
|
||||||
void setLastAlarmRequestSuccess(LastCommandSuccess status);
|
void setLastAlarmRequestSuccess(const LastCommandSuccess status);
|
||||||
LastCommandSuccess getLastAlarmRequestSuccess();
|
LastCommandSuccess getLastAlarmRequestSuccess();
|
||||||
|
|
||||||
void setMessageType(AlarmMessageType_t type);
|
void setMessageType(const AlarmMessageType_t type);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static int getTimezoneOffset();
|
static int getTimezoneOffset();
|
||||||
String getLocaleMessage(const AlarmMessage_t* msg, AlarmMessageLocale_t locale);
|
String getLocaleMessage(const AlarmMessage_t* msg, const AlarmMessageLocale_t locale);
|
||||||
|
|
||||||
uint8_t _payloadAlarmLog[ALARM_LOG_PAYLOAD_SIZE];
|
uint8_t _payloadAlarmLog[ALARM_LOG_PAYLOAD_SIZE];
|
||||||
uint8_t _alarmLogLength = 0;
|
uint8_t _alarmLogLength = 0;
|
||||||
|
|||||||
@ -65,7 +65,7 @@ void DevInfoParser::clearBufferAll()
|
|||||||
_devInfoAllLength = 0;
|
_devInfoAllLength = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DevInfoParser::appendFragmentAll(uint8_t offset, uint8_t* payload, uint8_t len)
|
void DevInfoParser::appendFragmentAll(const uint8_t offset, const uint8_t* payload, const uint8_t len)
|
||||||
{
|
{
|
||||||
if (offset + len > DEV_INFO_SIZE) {
|
if (offset + len > DEV_INFO_SIZE) {
|
||||||
Hoymiles.getMessageOutput()->printf("FATAL: (%s, %d) dev info all packet too large for buffer\r\n", __FILE__, __LINE__);
|
Hoymiles.getMessageOutput()->printf("FATAL: (%s, %d) dev info all packet too large for buffer\r\n", __FILE__, __LINE__);
|
||||||
@ -81,7 +81,7 @@ void DevInfoParser::clearBufferSimple()
|
|||||||
_devInfoSimpleLength = 0;
|
_devInfoSimpleLength = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DevInfoParser::appendFragmentSimple(uint8_t offset, uint8_t* payload, uint8_t len)
|
void DevInfoParser::appendFragmentSimple(const uint8_t offset, const uint8_t* payload, const uint8_t len)
|
||||||
{
|
{
|
||||||
if (offset + len > DEV_INFO_SIZE) {
|
if (offset + len > DEV_INFO_SIZE) {
|
||||||
Hoymiles.getMessageOutput()->printf("FATAL: (%s, %d) dev info Simple packet too large for buffer\r\n", __FILE__, __LINE__);
|
Hoymiles.getMessageOutput()->printf("FATAL: (%s, %d) dev info Simple packet too large for buffer\r\n", __FILE__, __LINE__);
|
||||||
@ -96,7 +96,7 @@ uint32_t DevInfoParser::getLastUpdateAll()
|
|||||||
return _lastUpdateAll;
|
return _lastUpdateAll;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DevInfoParser::setLastUpdateAll(uint32_t lastUpdate)
|
void DevInfoParser::setLastUpdateAll(const uint32_t lastUpdate)
|
||||||
{
|
{
|
||||||
_lastUpdateAll = lastUpdate;
|
_lastUpdateAll = lastUpdate;
|
||||||
setLastUpdate(lastUpdate);
|
setLastUpdate(lastUpdate);
|
||||||
@ -107,7 +107,7 @@ uint32_t DevInfoParser::getLastUpdateSimple()
|
|||||||
return _lastUpdateSimple;
|
return _lastUpdateSimple;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DevInfoParser::setLastUpdateSimple(uint32_t lastUpdate)
|
void DevInfoParser::setLastUpdateSimple(const uint32_t lastUpdate)
|
||||||
{
|
{
|
||||||
_lastUpdateSimple = lastUpdate;
|
_lastUpdateSimple = lastUpdate;
|
||||||
setLastUpdate(lastUpdate);
|
setLastUpdate(lastUpdate);
|
||||||
@ -228,7 +228,7 @@ uint8_t DevInfoParser::getDevIdx()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* struct tm to seconds since Unix epoch */
|
/* struct tm to seconds since Unix epoch */
|
||||||
time_t DevInfoParser::timegm(struct tm* t)
|
time_t DevInfoParser::timegm(const struct tm* t)
|
||||||
{
|
{
|
||||||
uint32_t year;
|
uint32_t year;
|
||||||
time_t result;
|
time_t result;
|
||||||
|
|||||||
@ -8,16 +8,16 @@ class DevInfoParser : public Parser {
|
|||||||
public:
|
public:
|
||||||
DevInfoParser();
|
DevInfoParser();
|
||||||
void clearBufferAll();
|
void clearBufferAll();
|
||||||
void appendFragmentAll(uint8_t offset, uint8_t* payload, uint8_t len);
|
void appendFragmentAll(const uint8_t offset, const uint8_t* payload, const uint8_t len);
|
||||||
|
|
||||||
void clearBufferSimple();
|
void clearBufferSimple();
|
||||||
void appendFragmentSimple(uint8_t offset, uint8_t* payload, uint8_t len);
|
void appendFragmentSimple(const uint8_t offset, const uint8_t* payload, const uint8_t len);
|
||||||
|
|
||||||
uint32_t getLastUpdateAll();
|
uint32_t getLastUpdateAll();
|
||||||
void setLastUpdateAll(uint32_t lastUpdate);
|
void setLastUpdateAll(const uint32_t lastUpdate);
|
||||||
|
|
||||||
uint32_t getLastUpdateSimple();
|
uint32_t getLastUpdateSimple();
|
||||||
void setLastUpdateSimple(uint32_t lastUpdate);
|
void setLastUpdateSimple(const uint32_t lastUpdate);
|
||||||
|
|
||||||
uint16_t getFwBuildVersion();
|
uint16_t getFwBuildVersion();
|
||||||
time_t getFwBuildDateTime();
|
time_t getFwBuildDateTime();
|
||||||
@ -32,7 +32,7 @@ public:
|
|||||||
bool containsValidData();
|
bool containsValidData();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
time_t timegm(struct tm* tm);
|
time_t timegm(const struct tm* tm);
|
||||||
uint8_t getDevIdx();
|
uint8_t getDevIdx();
|
||||||
|
|
||||||
uint32_t _lastUpdateAll = 0;
|
uint32_t _lastUpdateAll = 0;
|
||||||
|
|||||||
@ -287,7 +287,7 @@ void GridProfileParser::clearBuffer()
|
|||||||
_gridProfileLength = 0;
|
_gridProfileLength = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GridProfileParser::appendFragment(uint8_t offset, uint8_t* payload, uint8_t len)
|
void GridProfileParser::appendFragment(const uint8_t offset, const uint8_t* payload, const uint8_t len)
|
||||||
{
|
{
|
||||||
if (offset + len > GRID_PROFILE_SIZE) {
|
if (offset + len > GRID_PROFILE_SIZE) {
|
||||||
Hoymiles.getMessageOutput()->printf("FATAL: (%s, %d) grid profile packet too large for buffer\r\n", __FILE__, __LINE__);
|
Hoymiles.getMessageOutput()->printf("FATAL: (%s, %d) grid profile packet too large for buffer\r\n", __FILE__, __LINE__);
|
||||||
@ -371,7 +371,7 @@ std::list<GridProfileSection_t> GridProfileParser::getProfile()
|
|||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t GridProfileParser::getSectionSize(uint8_t section_id, uint8_t section_version)
|
uint8_t GridProfileParser::getSectionSize(const uint8_t section_id, const uint8_t section_version)
|
||||||
{
|
{
|
||||||
uint8_t count = 0;
|
uint8_t count = 0;
|
||||||
for (auto& values : _profileValues) {
|
for (auto& values : _profileValues) {
|
||||||
@ -382,7 +382,7 @@ uint8_t GridProfileParser::getSectionSize(uint8_t section_id, uint8_t section_ve
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
int8_t GridProfileParser::getSectionStart(uint8_t section_id, uint8_t section_version)
|
int8_t GridProfileParser::getSectionStart(const uint8_t section_id, const uint8_t section_version)
|
||||||
{
|
{
|
||||||
uint8_t count = -1;
|
uint8_t count = -1;
|
||||||
for (auto& values : _profileValues) {
|
for (auto& values : _profileValues) {
|
||||||
|
|||||||
@ -34,7 +34,7 @@ class GridProfileParser : public Parser {
|
|||||||
public:
|
public:
|
||||||
GridProfileParser();
|
GridProfileParser();
|
||||||
void clearBuffer();
|
void clearBuffer();
|
||||||
void appendFragment(uint8_t offset, uint8_t* payload, uint8_t len);
|
void appendFragment(const uint8_t offset, const uint8_t* payload, const uint8_t len);
|
||||||
|
|
||||||
String getProfileName();
|
String getProfileName();
|
||||||
String getProfileVersion();
|
String getProfileVersion();
|
||||||
@ -44,8 +44,8 @@ public:
|
|||||||
std::list<GridProfileSection_t> getProfile();
|
std::list<GridProfileSection_t> getProfile();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static uint8_t getSectionSize(uint8_t section_id, uint8_t section_version);
|
static uint8_t getSectionSize(const uint8_t section_id, const uint8_t section_version);
|
||||||
static int8_t getSectionStart(uint8_t section_id, uint8_t section_version);
|
static int8_t getSectionStart(const uint8_t section_id, const uint8_t section_version);
|
||||||
|
|
||||||
uint8_t _payloadGridProfile[GRID_PROFILE_SIZE] = {};
|
uint8_t _payloadGridProfile[GRID_PROFILE_SIZE] = {};
|
||||||
uint8_t _gridProfileLength = 0;
|
uint8_t _gridProfileLength = 0;
|
||||||
|
|||||||
@ -15,7 +15,7 @@ uint32_t Parser::getLastUpdate()
|
|||||||
return _lastUpdate;
|
return _lastUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Parser::setLastUpdate(uint32_t lastUpdate)
|
void Parser::setLastUpdate(const uint32_t lastUpdate)
|
||||||
{
|
{
|
||||||
_lastUpdate = lastUpdate;
|
_lastUpdate = lastUpdate;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,7 +18,7 @@ class Parser {
|
|||||||
public:
|
public:
|
||||||
Parser();
|
Parser();
|
||||||
uint32_t getLastUpdate();
|
uint32_t getLastUpdate();
|
||||||
void setLastUpdate(uint32_t lastUpdate);
|
void setLastUpdate(const uint32_t lastUpdate);
|
||||||
|
|
||||||
void beginAppendFragment();
|
void beginAppendFragment();
|
||||||
void endAppendFragment();
|
void endAppendFragment();
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "PowerCommandParser.h"
|
#include "PowerCommandParser.h"
|
||||||
|
|
||||||
void PowerCommandParser::setLastPowerCommandSuccess(LastCommandSuccess status)
|
void PowerCommandParser::setLastPowerCommandSuccess(const LastCommandSuccess status)
|
||||||
{
|
{
|
||||||
_lastLimitCommandSuccess = status;
|
_lastLimitCommandSuccess = status;
|
||||||
}
|
}
|
||||||
@ -19,7 +19,7 @@ uint32_t PowerCommandParser::getLastUpdateCommand()
|
|||||||
return _lastUpdateCommand;
|
return _lastUpdateCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PowerCommandParser::setLastUpdateCommand(uint32_t lastUpdate)
|
void PowerCommandParser::setLastUpdateCommand(const uint32_t lastUpdate)
|
||||||
{
|
{
|
||||||
_lastUpdateCommand = lastUpdate;
|
_lastUpdateCommand = lastUpdate;
|
||||||
setLastUpdate(lastUpdate);
|
setLastUpdate(lastUpdate);
|
||||||
|
|||||||
@ -4,10 +4,10 @@
|
|||||||
|
|
||||||
class PowerCommandParser : public Parser {
|
class PowerCommandParser : public Parser {
|
||||||
public:
|
public:
|
||||||
void setLastPowerCommandSuccess(LastCommandSuccess status);
|
void setLastPowerCommandSuccess(const LastCommandSuccess status);
|
||||||
LastCommandSuccess getLastPowerCommandSuccess();
|
LastCommandSuccess getLastPowerCommandSuccess();
|
||||||
uint32_t getLastUpdateCommand();
|
uint32_t getLastUpdateCommand();
|
||||||
void setLastUpdateCommand(uint32_t lastUpdate);
|
void setLastUpdateCommand(const uint32_t lastUpdate);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LastCommandSuccess _lastLimitCommandSuccess = CMD_OK; // Set to OK because we have to assume nothing is done at startup
|
LastCommandSuccess _lastLimitCommandSuccess = CMD_OK; // Set to OK because we have to assume nothing is done at startup
|
||||||
|
|||||||
@ -60,7 +60,7 @@ StatisticsParser::StatisticsParser()
|
|||||||
clearBuffer();
|
clearBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatisticsParser::setByteAssignment(const byteAssign_t* byteAssignment, uint8_t size)
|
void StatisticsParser::setByteAssignment(const byteAssign_t* byteAssignment, const uint8_t size)
|
||||||
{
|
{
|
||||||
_byteAssignment = byteAssignment;
|
_byteAssignment = byteAssignment;
|
||||||
_byteAssignmentSize = size;
|
_byteAssignmentSize = size;
|
||||||
@ -86,7 +86,7 @@ void StatisticsParser::clearBuffer()
|
|||||||
memset(_lastYieldDay, 0, sizeof(_lastYieldDay));
|
memset(_lastYieldDay, 0, sizeof(_lastYieldDay));
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatisticsParser::appendFragment(uint8_t offset, uint8_t* payload, uint8_t len)
|
void StatisticsParser::appendFragment(const uint8_t offset, const uint8_t* payload, const uint8_t len)
|
||||||
{
|
{
|
||||||
if (offset + len > STATISTIC_PACKET_SIZE) {
|
if (offset + len > STATISTIC_PACKET_SIZE) {
|
||||||
Hoymiles.getMessageOutput()->printf("FATAL: (%s, %d) stats packet too large for buffer\r\n", __FILE__, __LINE__);
|
Hoymiles.getMessageOutput()->printf("FATAL: (%s, %d) stats packet too large for buffer\r\n", __FILE__, __LINE__);
|
||||||
@ -121,7 +121,7 @@ void StatisticsParser::endAppendFragment()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const byteAssign_t* StatisticsParser::getAssignmentByChannelField(ChannelType_t type, ChannelNum_t channel, FieldId_t fieldId)
|
const byteAssign_t* StatisticsParser::getAssignmentByChannelField(const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId)
|
||||||
{
|
{
|
||||||
for (uint8_t i = 0; i < _byteAssignmentSize; i++) {
|
for (uint8_t i = 0; i < _byteAssignmentSize; i++) {
|
||||||
if (_byteAssignment[i].type == type && _byteAssignment[i].ch == channel && _byteAssignment[i].fieldId == fieldId) {
|
if (_byteAssignment[i].type == type && _byteAssignment[i].ch == channel && _byteAssignment[i].fieldId == fieldId) {
|
||||||
@ -131,7 +131,7 @@ const byteAssign_t* StatisticsParser::getAssignmentByChannelField(ChannelType_t
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
fieldSettings_t* StatisticsParser::getSettingByChannelField(ChannelType_t type, ChannelNum_t channel, FieldId_t fieldId)
|
fieldSettings_t* StatisticsParser::getSettingByChannelField(const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId)
|
||||||
{
|
{
|
||||||
for (auto& i : _fieldSettings) {
|
for (auto& i : _fieldSettings) {
|
||||||
if (i.type == type && i.ch == channel && i.fieldId == fieldId) {
|
if (i.type == type && i.ch == channel && i.fieldId == fieldId) {
|
||||||
@ -141,7 +141,7 @@ fieldSettings_t* StatisticsParser::getSettingByChannelField(ChannelType_t type,
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
float StatisticsParser::getChannelFieldValue(ChannelType_t type, ChannelNum_t channel, FieldId_t fieldId)
|
float StatisticsParser::getChannelFieldValue(const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId)
|
||||||
{
|
{
|
||||||
const byteAssign_t* pos = getAssignmentByChannelField(type, channel, fieldId);
|
const byteAssign_t* pos = getAssignmentByChannelField(type, channel, fieldId);
|
||||||
if (pos == nullptr) {
|
if (pos == nullptr) {
|
||||||
@ -186,7 +186,7 @@ float StatisticsParser::getChannelFieldValue(ChannelType_t type, ChannelNum_t ch
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StatisticsParser::setChannelFieldValue(ChannelType_t type, ChannelNum_t channel, FieldId_t fieldId, float value)
|
bool StatisticsParser::setChannelFieldValue(const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId, float value)
|
||||||
{
|
{
|
||||||
const byteAssign_t* pos = getAssignmentByChannelField(type, channel, fieldId);
|
const byteAssign_t* pos = getAssignmentByChannelField(type, channel, fieldId);
|
||||||
if (pos == nullptr) {
|
if (pos == nullptr) {
|
||||||
@ -226,38 +226,38 @@ bool StatisticsParser::setChannelFieldValue(ChannelType_t type, ChannelNum_t cha
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
String StatisticsParser::getChannelFieldValueString(ChannelType_t type, ChannelNum_t channel, FieldId_t fieldId)
|
String StatisticsParser::getChannelFieldValueString(const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId)
|
||||||
{
|
{
|
||||||
return String(
|
return String(
|
||||||
getChannelFieldValue(type, channel, fieldId),
|
getChannelFieldValue(type, channel, fieldId),
|
||||||
static_cast<unsigned int>(getChannelFieldDigits(type, channel, fieldId)));
|
static_cast<unsigned int>(getChannelFieldDigits(type, channel, fieldId)));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StatisticsParser::hasChannelFieldValue(ChannelType_t type, ChannelNum_t channel, FieldId_t fieldId)
|
bool StatisticsParser::hasChannelFieldValue(const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId)
|
||||||
{
|
{
|
||||||
const byteAssign_t* pos = getAssignmentByChannelField(type, channel, fieldId);
|
const byteAssign_t* pos = getAssignmentByChannelField(type, channel, fieldId);
|
||||||
return pos != nullptr;
|
return pos != nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* StatisticsParser::getChannelFieldUnit(ChannelType_t type, ChannelNum_t channel, FieldId_t fieldId)
|
const char* StatisticsParser::getChannelFieldUnit(const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId)
|
||||||
{
|
{
|
||||||
const byteAssign_t* pos = getAssignmentByChannelField(type, channel, fieldId);
|
const byteAssign_t* pos = getAssignmentByChannelField(type, channel, fieldId);
|
||||||
return units[pos->unitId];
|
return units[pos->unitId];
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* StatisticsParser::getChannelFieldName(ChannelType_t type, ChannelNum_t channel, FieldId_t fieldId)
|
const char* StatisticsParser::getChannelFieldName(const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId)
|
||||||
{
|
{
|
||||||
const byteAssign_t* pos = getAssignmentByChannelField(type, channel, fieldId);
|
const byteAssign_t* pos = getAssignmentByChannelField(type, channel, fieldId);
|
||||||
return fields[pos->fieldId];
|
return fields[pos->fieldId];
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t StatisticsParser::getChannelFieldDigits(ChannelType_t type, ChannelNum_t channel, FieldId_t fieldId)
|
uint8_t StatisticsParser::getChannelFieldDigits(const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId)
|
||||||
{
|
{
|
||||||
const byteAssign_t* pos = getAssignmentByChannelField(type, channel, fieldId);
|
const byteAssign_t* pos = getAssignmentByChannelField(type, channel, fieldId);
|
||||||
return pos->digits;
|
return pos->digits;
|
||||||
}
|
}
|
||||||
|
|
||||||
float StatisticsParser::getChannelFieldOffset(ChannelType_t type, ChannelNum_t channel, FieldId_t fieldId)
|
float StatisticsParser::getChannelFieldOffset(const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId)
|
||||||
{
|
{
|
||||||
const fieldSettings_t* setting = getSettingByChannelField(type, channel, fieldId);
|
const fieldSettings_t* setting = getSettingByChannelField(type, channel, fieldId);
|
||||||
if (setting != nullptr) {
|
if (setting != nullptr) {
|
||||||
@ -266,7 +266,7 @@ float StatisticsParser::getChannelFieldOffset(ChannelType_t type, ChannelNum_t c
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatisticsParser::setChannelFieldOffset(ChannelType_t type, ChannelNum_t channel, FieldId_t fieldId, float offset)
|
void StatisticsParser::setChannelFieldOffset(const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId, const float offset)
|
||||||
{
|
{
|
||||||
fieldSettings_t* setting = getSettingByChannelField(type, channel, fieldId);
|
fieldSettings_t* setting = getSettingByChannelField(type, channel, fieldId);
|
||||||
if (setting != nullptr) {
|
if (setting != nullptr) {
|
||||||
@ -285,12 +285,12 @@ std::list<ChannelType_t> StatisticsParser::getChannelTypes()
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* StatisticsParser::getChannelTypeName(ChannelType_t type)
|
const char* StatisticsParser::getChannelTypeName(const ChannelType_t type)
|
||||||
{
|
{
|
||||||
return channelsTypes[type];
|
return channelsTypes[type];
|
||||||
}
|
}
|
||||||
|
|
||||||
std::list<ChannelNum_t> StatisticsParser::getChannelsByType(ChannelType_t type)
|
std::list<ChannelNum_t> StatisticsParser::getChannelsByType(const ChannelType_t type)
|
||||||
{
|
{
|
||||||
std::list<ChannelNum_t> l;
|
std::list<ChannelNum_t> l;
|
||||||
for (uint8_t i = 0; i < _byteAssignmentSize; i++) {
|
for (uint8_t i = 0; i < _byteAssignmentSize; i++) {
|
||||||
@ -302,12 +302,12 @@ std::list<ChannelNum_t> StatisticsParser::getChannelsByType(ChannelType_t type)
|
|||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint16_t StatisticsParser::getStringMaxPower(uint8_t channel)
|
uint16_t StatisticsParser::getStringMaxPower(const uint8_t channel)
|
||||||
{
|
{
|
||||||
return _stringMaxPower[channel];
|
return _stringMaxPower[channel];
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatisticsParser::setStringMaxPower(uint8_t channel, uint16_t power)
|
void StatisticsParser::setStringMaxPower(const uint8_t channel, const uint16_t power)
|
||||||
{
|
{
|
||||||
if (channel < sizeof(_stringMaxPower) / sizeof(_stringMaxPower[0])) {
|
if (channel < sizeof(_stringMaxPower) / sizeof(_stringMaxPower[0])) {
|
||||||
_stringMaxPower[channel] = power;
|
_stringMaxPower[channel] = power;
|
||||||
@ -339,7 +339,7 @@ void StatisticsParser::zeroDailyData()
|
|||||||
zeroFields(dailyProductionFields);
|
zeroFields(dailyProductionFields);
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatisticsParser::setLastUpdate(uint32_t lastUpdate)
|
void StatisticsParser::setLastUpdate(const uint32_t lastUpdate)
|
||||||
{
|
{
|
||||||
Parser::setLastUpdate(lastUpdate);
|
Parser::setLastUpdate(lastUpdate);
|
||||||
setLastUpdateFromInternal(lastUpdate);
|
setLastUpdateFromInternal(lastUpdate);
|
||||||
@ -350,7 +350,7 @@ uint32_t StatisticsParser::getLastUpdateFromInternal()
|
|||||||
return _lastUpdateFromInternal;
|
return _lastUpdateFromInternal;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatisticsParser::setLastUpdateFromInternal(uint32_t lastUpdate)
|
void StatisticsParser::setLastUpdateFromInternal(const uint32_t lastUpdate)
|
||||||
{
|
{
|
||||||
_lastUpdateFromInternal = lastUpdate;
|
_lastUpdateFromInternal = lastUpdate;
|
||||||
}
|
}
|
||||||
@ -360,7 +360,7 @@ bool StatisticsParser::getYieldDayCorrection()
|
|||||||
return _enableYieldDayCorrection;
|
return _enableYieldDayCorrection;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatisticsParser::setYieldDayCorrection(bool enabled)
|
void StatisticsParser::setYieldDayCorrection(const bool enabled)
|
||||||
{
|
{
|
||||||
_enableYieldDayCorrection = enabled;
|
_enableYieldDayCorrection = enabled;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -105,35 +105,35 @@ class StatisticsParser : public Parser {
|
|||||||
public:
|
public:
|
||||||
StatisticsParser();
|
StatisticsParser();
|
||||||
void clearBuffer();
|
void clearBuffer();
|
||||||
void appendFragment(uint8_t offset, uint8_t* payload, uint8_t len);
|
void appendFragment(const uint8_t offset, const uint8_t* payload, const uint8_t len);
|
||||||
void endAppendFragment();
|
void endAppendFragment();
|
||||||
|
|
||||||
void setByteAssignment(const byteAssign_t* byteAssignment, uint8_t size);
|
void setByteAssignment(const byteAssign_t* byteAssignment, const uint8_t size);
|
||||||
|
|
||||||
// Returns 1 based amount of expected bytes of statistic data
|
// Returns 1 based amount of expected bytes of statistic data
|
||||||
uint8_t getExpectedByteCount();
|
uint8_t getExpectedByteCount();
|
||||||
|
|
||||||
const byteAssign_t* getAssignmentByChannelField(ChannelType_t type, ChannelNum_t channel, FieldId_t fieldId);
|
const byteAssign_t* getAssignmentByChannelField(const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId);
|
||||||
fieldSettings_t* getSettingByChannelField(ChannelType_t type, ChannelNum_t channel, FieldId_t fieldId);
|
fieldSettings_t* getSettingByChannelField(const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId);
|
||||||
|
|
||||||
float getChannelFieldValue(ChannelType_t type, ChannelNum_t channel, FieldId_t fieldId);
|
float getChannelFieldValue(const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId);
|
||||||
String getChannelFieldValueString(ChannelType_t type, ChannelNum_t channel, FieldId_t fieldId);
|
String getChannelFieldValueString(const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId);
|
||||||
bool hasChannelFieldValue(ChannelType_t type, ChannelNum_t channel, FieldId_t fieldId);
|
bool hasChannelFieldValue(const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId);
|
||||||
const char* getChannelFieldUnit(ChannelType_t type, ChannelNum_t channel, FieldId_t fieldId);
|
const char* getChannelFieldUnit(const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId);
|
||||||
const char* getChannelFieldName(ChannelType_t type, ChannelNum_t channel, FieldId_t fieldId);
|
const char* getChannelFieldName(const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId);
|
||||||
uint8_t getChannelFieldDigits(ChannelType_t type, ChannelNum_t channel, FieldId_t fieldId);
|
uint8_t getChannelFieldDigits(const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId);
|
||||||
|
|
||||||
bool setChannelFieldValue(ChannelType_t type, ChannelNum_t channel, FieldId_t fieldId, float value);
|
bool setChannelFieldValue(const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId, float value);
|
||||||
|
|
||||||
float getChannelFieldOffset(ChannelType_t type, ChannelNum_t channel, FieldId_t fieldId);
|
float getChannelFieldOffset(const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId);
|
||||||
void setChannelFieldOffset(ChannelType_t type, ChannelNum_t channel, FieldId_t fieldId, float offset);
|
void setChannelFieldOffset(const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId, const float offset);
|
||||||
|
|
||||||
std::list<ChannelType_t> getChannelTypes();
|
std::list<ChannelType_t> getChannelTypes();
|
||||||
const char* getChannelTypeName(ChannelType_t type);
|
const char* getChannelTypeName(const ChannelType_t type);
|
||||||
std::list<ChannelNum_t> getChannelsByType(ChannelType_t type);
|
std::list<ChannelNum_t> getChannelsByType(const ChannelType_t type);
|
||||||
|
|
||||||
uint16_t getStringMaxPower(uint8_t channel);
|
uint16_t getStringMaxPower(const uint8_t channel);
|
||||||
void setStringMaxPower(uint8_t channel, uint16_t power);
|
void setStringMaxPower(const uint8_t channel, const uint16_t power);
|
||||||
|
|
||||||
void resetRxFailureCount();
|
void resetRxFailureCount();
|
||||||
void incrementRxFailureCount();
|
void incrementRxFailureCount();
|
||||||
@ -144,14 +144,14 @@ public:
|
|||||||
void resetYieldDayCorrection();
|
void resetYieldDayCorrection();
|
||||||
|
|
||||||
// Update time when new data from the inverter is received
|
// Update time when new data from the inverter is received
|
||||||
void setLastUpdate(uint32_t lastUpdate);
|
void setLastUpdate(const uint32_t lastUpdate);
|
||||||
|
|
||||||
// Update time when internal data structure changes (from inverter and by internal manipulation)
|
// Update time when internal data structure changes (from inverter and by internal manipulation)
|
||||||
uint32_t getLastUpdateFromInternal();
|
uint32_t getLastUpdateFromInternal();
|
||||||
void setLastUpdateFromInternal(uint32_t lastUpdate);
|
void setLastUpdateFromInternal(const uint32_t lastUpdate);
|
||||||
|
|
||||||
bool getYieldDayCorrection();
|
bool getYieldDayCorrection();
|
||||||
void setYieldDayCorrection(bool enabled);
|
void setYieldDayCorrection(const bool enabled);
|
||||||
private:
|
private:
|
||||||
void zeroFields(const FieldId_t* fields);
|
void zeroFields(const FieldId_t* fields);
|
||||||
|
|
||||||
|
|||||||
@ -18,7 +18,7 @@ void SystemConfigParaParser::clearBuffer()
|
|||||||
_payloadLength = 0;
|
_payloadLength = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemConfigParaParser::appendFragment(uint8_t offset, uint8_t* payload, uint8_t len)
|
void SystemConfigParaParser::appendFragment(const uint8_t offset, const uint8_t* payload, const uint8_t len)
|
||||||
{
|
{
|
||||||
if (offset + len > (SYSTEM_CONFIG_PARA_SIZE)) {
|
if (offset + len > (SYSTEM_CONFIG_PARA_SIZE)) {
|
||||||
Hoymiles.getMessageOutput()->printf("FATAL: (%s, %d) stats packet too large for buffer\r\n", __FILE__, __LINE__);
|
Hoymiles.getMessageOutput()->printf("FATAL: (%s, %d) stats packet too large for buffer\r\n", __FILE__, __LINE__);
|
||||||
@ -36,7 +36,7 @@ float SystemConfigParaParser::getLimitPercent()
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemConfigParaParser::setLimitPercent(float value)
|
void SystemConfigParaParser::setLimitPercent(const float value)
|
||||||
{
|
{
|
||||||
HOY_SEMAPHORE_TAKE();
|
HOY_SEMAPHORE_TAKE();
|
||||||
_payload[2] = ((uint16_t)(value * 10)) >> 8;
|
_payload[2] = ((uint16_t)(value * 10)) >> 8;
|
||||||
@ -44,7 +44,7 @@ void SystemConfigParaParser::setLimitPercent(float value)
|
|||||||
HOY_SEMAPHORE_GIVE();
|
HOY_SEMAPHORE_GIVE();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemConfigParaParser::setLastLimitCommandSuccess(LastCommandSuccess status)
|
void SystemConfigParaParser::setLastLimitCommandSuccess(const LastCommandSuccess status)
|
||||||
{
|
{
|
||||||
_lastLimitCommandSuccess = status;
|
_lastLimitCommandSuccess = status;
|
||||||
}
|
}
|
||||||
@ -59,13 +59,13 @@ uint32_t SystemConfigParaParser::getLastUpdateCommand()
|
|||||||
return _lastUpdateCommand;
|
return _lastUpdateCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemConfigParaParser::setLastUpdateCommand(uint32_t lastUpdate)
|
void SystemConfigParaParser::setLastUpdateCommand(const uint32_t lastUpdate)
|
||||||
{
|
{
|
||||||
_lastUpdateCommand = lastUpdate;
|
_lastUpdateCommand = lastUpdate;
|
||||||
setLastUpdate(lastUpdate);
|
setLastUpdate(lastUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemConfigParaParser::setLastLimitRequestSuccess(LastCommandSuccess status)
|
void SystemConfigParaParser::setLastLimitRequestSuccess(const LastCommandSuccess status)
|
||||||
{
|
{
|
||||||
_lastLimitRequestSuccess = status;
|
_lastLimitRequestSuccess = status;
|
||||||
}
|
}
|
||||||
@ -80,7 +80,7 @@ uint32_t SystemConfigParaParser::getLastUpdateRequest()
|
|||||||
return _lastUpdateRequest;
|
return _lastUpdateRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemConfigParaParser::setLastUpdateRequest(uint32_t lastUpdate)
|
void SystemConfigParaParser::setLastUpdateRequest(const uint32_t lastUpdate)
|
||||||
{
|
{
|
||||||
_lastUpdateRequest = lastUpdate;
|
_lastUpdateRequest = lastUpdate;
|
||||||
setLastUpdate(lastUpdate);
|
setLastUpdate(lastUpdate);
|
||||||
|
|||||||
@ -8,20 +8,20 @@ class SystemConfigParaParser : public Parser {
|
|||||||
public:
|
public:
|
||||||
SystemConfigParaParser();
|
SystemConfigParaParser();
|
||||||
void clearBuffer();
|
void clearBuffer();
|
||||||
void appendFragment(uint8_t offset, uint8_t* payload, uint8_t len);
|
void appendFragment(const uint8_t offset, const uint8_t* payload, const uint8_t len);
|
||||||
|
|
||||||
float getLimitPercent();
|
float getLimitPercent();
|
||||||
void setLimitPercent(float value);
|
void setLimitPercent(const float value);
|
||||||
|
|
||||||
void setLastLimitCommandSuccess(LastCommandSuccess status);
|
void setLastLimitCommandSuccess(const LastCommandSuccess status);
|
||||||
LastCommandSuccess getLastLimitCommandSuccess();
|
LastCommandSuccess getLastLimitCommandSuccess();
|
||||||
uint32_t getLastUpdateCommand();
|
uint32_t getLastUpdateCommand();
|
||||||
void setLastUpdateCommand(uint32_t lastUpdate);
|
void setLastUpdateCommand(const uint32_t lastUpdate);
|
||||||
|
|
||||||
void setLastLimitRequestSuccess(LastCommandSuccess status);
|
void setLastLimitRequestSuccess(const LastCommandSuccess status);
|
||||||
LastCommandSuccess getLastLimitRequestSuccess();
|
LastCommandSuccess getLastLimitRequestSuccess();
|
||||||
uint32_t getLastUpdateRequest();
|
uint32_t getLastUpdateRequest();
|
||||||
void setLastUpdateRequest(uint32_t lastUpdate);
|
void setLastUpdateRequest(const uint32_t lastUpdate);
|
||||||
|
|
||||||
// Returns 1 based amount of expected bytes of data
|
// Returns 1 based amount of expected bytes of data
|
||||||
uint8_t getExpectedByteCount();
|
uint8_t getExpectedByteCount();
|
||||||
|
|||||||
@ -20,7 +20,7 @@
|
|||||||
#include "rom/rtc.h"
|
#include "rom/rtc.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
String ResetReason::get_reset_reason_verbose(uint8_t cpu_id)
|
String ResetReason::get_reset_reason_verbose(const uint8_t cpu_id)
|
||||||
{
|
{
|
||||||
RESET_REASON reason;
|
RESET_REASON reason;
|
||||||
reason = rtc_get_reset_reason(cpu_id);
|
reason = rtc_get_reset_reason(cpu_id);
|
||||||
@ -86,7 +86,7 @@ String ResetReason::get_reset_reason_verbose(uint8_t cpu_id)
|
|||||||
return reason_str;
|
return reason_str;
|
||||||
}
|
}
|
||||||
|
|
||||||
String ResetReason::get_reset_reason_short(uint8_t cpu_id)
|
String ResetReason::get_reset_reason_short(const uint8_t cpu_id)
|
||||||
{
|
{
|
||||||
RESET_REASON reason;
|
RESET_REASON reason;
|
||||||
reason = rtc_get_reset_reason(cpu_id);
|
reason = rtc_get_reset_reason(cpu_id);
|
||||||
|
|||||||
@ -5,6 +5,6 @@
|
|||||||
|
|
||||||
class ResetReason {
|
class ResetReason {
|
||||||
public:
|
public:
|
||||||
static String get_reset_reason_verbose(uint8_t cpu_id);
|
static String get_reset_reason_verbose(const uint8_t cpu_id);
|
||||||
static String get_reset_reason_short(uint8_t cpu_id);
|
static String get_reset_reason_short(const uint8_t cpu_id);
|
||||||
};
|
};
|
||||||
@ -11,13 +11,13 @@ TimeoutHelper::TimeoutHelper()
|
|||||||
startMillis = 0;
|
startMillis = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TimeoutHelper::set(uint32_t ms)
|
void TimeoutHelper::set(const uint32_t ms)
|
||||||
{
|
{
|
||||||
timeout = ms;
|
timeout = ms;
|
||||||
startMillis = millis();
|
startMillis = millis();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TimeoutHelper::extend(uint32_t ms)
|
void TimeoutHelper::extend(const uint32_t ms)
|
||||||
{
|
{
|
||||||
timeout += ms;
|
timeout += ms;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,8 +6,8 @@
|
|||||||
class TimeoutHelper {
|
class TimeoutHelper {
|
||||||
public:
|
public:
|
||||||
TimeoutHelper();
|
TimeoutHelper();
|
||||||
void set(uint32_t ms);
|
void set(const uint32_t ms);
|
||||||
void extend(uint32_t ms);
|
void extend(const uint32_t ms);
|
||||||
void reset();
|
void reset();
|
||||||
bool occured();
|
bool occured();
|
||||||
|
|
||||||
|
|||||||
@ -360,7 +360,7 @@ INVERTER_CONFIG_T* ConfigurationClass::getFreeInverterSlot()
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
INVERTER_CONFIG_T* ConfigurationClass::getInverterConfig(uint64_t serial)
|
INVERTER_CONFIG_T* ConfigurationClass::getInverterConfig(const uint64_t serial)
|
||||||
{
|
{
|
||||||
for (uint8_t i = 0; i < INV_MAX_COUNT; i++) {
|
for (uint8_t i = 0; i < INV_MAX_COUNT; i++) {
|
||||||
if (config.Inverter[i].Serial == serial) {
|
if (config.Inverter[i].Serial == serial) {
|
||||||
|
|||||||
@ -39,7 +39,7 @@ DisplayGraphicClass::~DisplayGraphicClass()
|
|||||||
delete _display;
|
delete _display;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayGraphicClass::init(Scheduler* scheduler, DisplayType_t type, uint8_t data, uint8_t clk, uint8_t cs, 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;
|
_display_type = type;
|
||||||
if (_display_type > DisplayType_t::None) {
|
if (_display_type > DisplayType_t::None) {
|
||||||
@ -67,7 +67,7 @@ void DisplayGraphicClass::calcLineHeights()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayGraphicClass::setFont(uint8_t line)
|
void DisplayGraphicClass::setFont(const uint8_t line)
|
||||||
{
|
{
|
||||||
switch (line) {
|
switch (line) {
|
||||||
case 0:
|
case 0:
|
||||||
@ -82,7 +82,7 @@ void DisplayGraphicClass::setFont(uint8_t line)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayGraphicClass::printText(const char* text, uint8_t line)
|
void DisplayGraphicClass::printText(const char* text, const uint8_t line)
|
||||||
{
|
{
|
||||||
uint8_t dispX;
|
uint8_t dispX;
|
||||||
if (!_isLarge) {
|
if (!_isLarge) {
|
||||||
@ -96,7 +96,7 @@ void DisplayGraphicClass::printText(const char* text, uint8_t line)
|
|||||||
_display->drawStr(dispX, _lineOffsets[line], text);
|
_display->drawStr(dispX, _lineOffsets[line], text);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayGraphicClass::setOrientation(uint8_t rotation)
|
void DisplayGraphicClass::setOrientation(const uint8_t rotation)
|
||||||
{
|
{
|
||||||
if (_display_type == DisplayType_t::None) {
|
if (_display_type == DisplayType_t::None) {
|
||||||
return;
|
return;
|
||||||
@ -121,7 +121,7 @@ void DisplayGraphicClass::setOrientation(uint8_t rotation)
|
|||||||
calcLineHeights();
|
calcLineHeights();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayGraphicClass::setLanguage(uint8_t language)
|
void DisplayGraphicClass::setLanguage(const uint8_t language)
|
||||||
{
|
{
|
||||||
_display_language = language < sizeof(languages) / sizeof(languages[0]) ? language : DISPLAY_LANGUAGE;
|
_display_language = language < sizeof(languages) / sizeof(languages[0]) ? language : DISPLAY_LANGUAGE;
|
||||||
}
|
}
|
||||||
@ -199,7 +199,7 @@ void DisplayGraphicClass::loop()
|
|||||||
_display->setPowerSave(displayPowerSave);
|
_display->setPowerSave(displayPowerSave);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayGraphicClass::setContrast(uint8_t contrast)
|
void DisplayGraphicClass::setContrast(const uint8_t contrast)
|
||||||
{
|
{
|
||||||
if (_display_type == DisplayType_t::None) {
|
if (_display_type == DisplayType_t::None) {
|
||||||
return;
|
return;
|
||||||
@ -207,7 +207,7 @@ void DisplayGraphicClass::setContrast(uint8_t contrast)
|
|||||||
_display->setContrast(contrast * 2.55f);
|
_display->setContrast(contrast * 2.55f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayGraphicClass::setStatus(bool turnOn)
|
void DisplayGraphicClass::setStatus(const bool turnOn)
|
||||||
{
|
{
|
||||||
_displayTurnedOn = turnOn;
|
_displayTurnedOn = turnOn;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -129,7 +129,7 @@ void LedSingleClass::outputLoop()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LedSingleClass::setLed(uint8_t ledNo, bool ledState)
|
void LedSingleClass::setLed(const uint8_t ledNo, const bool ledState)
|
||||||
{
|
{
|
||||||
const auto& pin = PinMapping.get();
|
const auto& pin = PinMapping.get();
|
||||||
const auto& config = Configuration.get();
|
const auto& config = Configuration.get();
|
||||||
|
|||||||
@ -85,7 +85,7 @@ void MqttHandleHassClass::publishConfig()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MqttHandleHassClass::publishField(std::shared_ptr<InverterAbstract> inv, ChannelType_t type, ChannelNum_t channel, byteAssign_fieldDeviceClass_t fieldType, bool clear)
|
void MqttHandleHassClass::publishField(std::shared_ptr<InverterAbstract> inv, const ChannelType_t type, const ChannelNum_t channel, const byteAssign_fieldDeviceClass_t fieldType, const bool clear)
|
||||||
{
|
{
|
||||||
if (!inv->Statistics()->hasChannelFieldValue(type, channel, fieldType.fieldId)) {
|
if (!inv->Statistics()->hasChannelFieldValue(type, channel, fieldType.fieldId)) {
|
||||||
return;
|
return;
|
||||||
@ -193,7 +193,7 @@ void MqttHandleHassClass::publishInverterButton(std::shared_ptr<InverterAbstract
|
|||||||
void MqttHandleHassClass::publishInverterNumber(
|
void MqttHandleHassClass::publishInverterNumber(
|
||||||
std::shared_ptr<InverterAbstract> inv, const char* caption, const char* icon, const char* category,
|
std::shared_ptr<InverterAbstract> inv, const char* caption, const char* icon, const char* category,
|
||||||
const char* commandTopic, const char* stateTopic, const char* unitOfMeasure,
|
const char* commandTopic, const char* stateTopic, const char* unitOfMeasure,
|
||||||
int16_t min, int16_t max)
|
const int16_t min, const int16_t max)
|
||||||
{
|
{
|
||||||
const String serial = inv->serialString();
|
const String serial = inv->serialString();
|
||||||
|
|
||||||
|
|||||||
@ -124,7 +124,7 @@ void MqttHandleInverterClass::loop()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MqttHandleInverterClass::publishField(std::shared_ptr<InverterAbstract> inv, ChannelType_t type, ChannelNum_t channel, FieldId_t fieldId)
|
void MqttHandleInverterClass::publishField(std::shared_ptr<InverterAbstract> inv, const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId)
|
||||||
{
|
{
|
||||||
const String topic = getTopic(inv, type, channel, fieldId);
|
const String topic = getTopic(inv, type, channel, fieldId);
|
||||||
if (topic == "") {
|
if (topic == "") {
|
||||||
@ -134,7 +134,7 @@ void MqttHandleInverterClass::publishField(std::shared_ptr<InverterAbstract> inv
|
|||||||
MqttSettings.publish(topic, inv->Statistics()->getChannelFieldValueString(type, channel, fieldId));
|
MqttSettings.publish(topic, inv->Statistics()->getChannelFieldValueString(type, channel, fieldId));
|
||||||
}
|
}
|
||||||
|
|
||||||
String MqttHandleInverterClass::getTopic(std::shared_ptr<InverterAbstract> inv, ChannelType_t type, ChannelNum_t channel, FieldId_t fieldId)
|
String MqttHandleInverterClass::getTopic(std::shared_ptr<InverterAbstract> inv, const ChannelType_t type, const ChannelNum_t channel, const FieldId_t fieldId)
|
||||||
{
|
{
|
||||||
if (!inv->Statistics()->hasChannelFieldValue(type, channel, fieldId)) {
|
if (!inv->Statistics()->hasChannelFieldValue(type, channel, fieldId)) {
|
||||||
return "";
|
return "";
|
||||||
@ -159,7 +159,7 @@ String MqttHandleInverterClass::getTopic(std::shared_ptr<InverterAbstract> inv,
|
|||||||
return inv->serialString() + "/" + chanNum + "/" + chanName;
|
return inv->serialString() + "/" + chanNum + "/" + chanName;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MqttHandleInverterClass::onMqttMessage(const espMqttClientTypes::MessageProperties& properties, const char* topic, const uint8_t* payload, size_t len, size_t index, size_t total)
|
void MqttHandleInverterClass::onMqttMessage(const espMqttClientTypes::MessageProperties& properties, const char* topic, const uint8_t* payload, const size_t len, const size_t index, const size_t total)
|
||||||
{
|
{
|
||||||
const CONFIG_T& config = Configuration.get();
|
const CONFIG_T& config = Configuration.get();
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,7 @@ void MqttSettingsClass::NetworkEvent(network_event event)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MqttSettingsClass::onMqttConnect(bool sessionPresent)
|
void MqttSettingsClass::onMqttConnect(const bool sessionPresent)
|
||||||
{
|
{
|
||||||
MessageOutput.println("Connected to MQTT.");
|
MessageOutput.println("Connected to MQTT.");
|
||||||
const CONFIG_T& config = Configuration.get();
|
const CONFIG_T& config = Configuration.get();
|
||||||
@ -40,7 +40,7 @@ void MqttSettingsClass::onMqttConnect(bool sessionPresent)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MqttSettingsClass::subscribe(const String& topic, uint8_t qos, const espMqttClientTypes::OnMessageCallback& cb)
|
void MqttSettingsClass::subscribe(const String& topic, const uint8_t qos, const espMqttClientTypes::OnMessageCallback& cb)
|
||||||
{
|
{
|
||||||
_mqttSubscribeParser.register_callback(topic.c_str(), qos, cb);
|
_mqttSubscribeParser.register_callback(topic.c_str(), qos, cb);
|
||||||
std::lock_guard<std::mutex> lock(_clientLock);
|
std::lock_guard<std::mutex> lock(_clientLock);
|
||||||
@ -89,7 +89,7 @@ void MqttSettingsClass::onMqttDisconnect(espMqttClientTypes::DisconnectReason re
|
|||||||
2, +[](MqttSettingsClass* instance) { instance->performConnect(); }, this);
|
2, +[](MqttSettingsClass* instance) { instance->performConnect(); }, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MqttSettingsClass::onMqttMessage(const espMqttClientTypes::MessageProperties& properties, const char* topic, const uint8_t* payload, size_t len, size_t index, size_t total)
|
void MqttSettingsClass::onMqttMessage(const espMqttClientTypes::MessageProperties& properties, const char* topic, const uint8_t* payload, const size_t len, const size_t index, const size_t total)
|
||||||
{
|
{
|
||||||
MessageOutput.print("Received MQTT message on topic: ");
|
MessageOutput.print("Received MQTT message on topic: ");
|
||||||
MessageOutput.println(topic);
|
MessageOutput.println(topic);
|
||||||
@ -191,7 +191,7 @@ void MqttSettingsClass::publish(const String& subtopic, const String& payload)
|
|||||||
publishGeneric(topic, value, Configuration.get().Mqtt.Retain, 0);
|
publishGeneric(topic, value, Configuration.get().Mqtt.Retain, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MqttSettingsClass::publishGeneric(const String& topic, const String& payload, bool retain, uint8_t qos)
|
void MqttSettingsClass::publishGeneric(const String& topic, const String& payload, const bool retain, const uint8_t qos)
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(_clientLock);
|
std::lock_guard<std::mutex> lock(_clientLock);
|
||||||
if (mqttClient == nullptr) {
|
if (mqttClient == nullptr) {
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user