queue every text event until the frame was checked by it checksum. then process the data directly into the buffer struct. do not clear the buffer struct, so it will always include the most recent value of a particular data point.
41 lines
984 B
C++
41 lines
984 B
C++
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
#pragma once
|
|
|
|
#include "VeDirectMpptController.h"
|
|
#include "Configuration.h"
|
|
#include <Arduino.h>
|
|
#include <map>
|
|
#include <TaskSchedulerDeclarations.h>
|
|
|
|
#ifndef VICTRON_PIN_RX
|
|
#define VICTRON_PIN_RX 22
|
|
#endif
|
|
|
|
#ifndef VICTRON_PIN_TX
|
|
#define VICTRON_PIN_TX 21
|
|
#endif
|
|
|
|
class MqttHandleVedirectClass {
|
|
public:
|
|
void init(Scheduler& scheduler);
|
|
void forceUpdate();
|
|
private:
|
|
void loop();
|
|
std::map<std::string, VeDirectMpptController::data_t> _kvFrames;
|
|
|
|
Task _loopTask;
|
|
|
|
// point of time in millis() when updated values will be published
|
|
uint32_t _nextPublishUpdatesOnly = 0;
|
|
|
|
// point of time in millis() when all values will be published
|
|
uint32_t _nextPublishFull = 1;
|
|
|
|
bool _PublishFull;
|
|
|
|
void publish_mppt_data(const VeDirectMpptController::spData_t &spMpptData,
|
|
const VeDirectMpptController::data_t &frame) const;
|
|
};
|
|
|
|
extern MqttHandleVedirectClass MqttHandleVedirect;
|