Migrate MqttHandleInverter to TaskScheduler

This commit is contained in:
Thomas Basler
2023-11-20 21:42:58 +01:00
parent 5c501f879f
commit 524483451f
3 changed files with 67 additions and 65 deletions

View File

@@ -3,22 +3,23 @@
#include "Configuration.h"
#include <Hoymiles.h>
#include <TimeoutHelper.h>
#include <TaskSchedulerDeclarations.h>
#include <espMqttClient.h>
class MqttHandleInverterClass {
public:
void init();
void loop();
void init(Scheduler* scheduler);
static String getTopic(std::shared_ptr<InverterAbstract> inv, ChannelType_t type, ChannelNum_t channel, FieldId_t fieldId);
private:
void loop();
void publishField(std::shared_ptr<InverterAbstract> inv, ChannelType_t type, ChannelNum_t channel, 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);
Task _loopTask;
uint32_t _lastPublishStats[INV_MAX_COUNT] = { 0 };
uint32_t _lastPublish = 0;
FieldId_t _publishFields[14] = {
FLD_UDC,