OpenDTU/lib/Hoymiles/src/Hoymiles.h
Thomas Basler c9e603b2de Replace EVERY_N_SECONDS with millis
EVERY_N_SECONDS is not updated without a reboot of the controller
2022-06-15 22:15:02 +02:00

35 lines
920 B
C++

#pragma once
#include "HoymilesRadio.h"
#include "inverters/InverterAbstract.h"
#include "types.h"
#include <SPI.h>
#include <memory>
#include <vector>
class HoymilesClass {
public:
void init();
void loop();
std::shared_ptr<InverterAbstract> addInverter(const char* name, uint64_t serial);
std::shared_ptr<InverterAbstract> getInverterByPos(uint8_t pos);
std::shared_ptr<InverterAbstract> getInverterBySerial(uint64_t serial);
std::shared_ptr<InverterAbstract> getInverterByFragment(fragment_t* fragment);
void removeInverterByPos(uint8_t pos);
size_t getNumInverters();
HoymilesRadio* getRadio();
uint32_t PollInterval();
void setPollInterval(uint32_t interval);
private:
std::vector<std::shared_ptr<InverterAbstract>> _inverters;
std::unique_ptr<HoymilesRadio> _radio;
uint32_t _pollInterval;
uint32_t _lastPoll = 0;
};
extern HoymilesClass Hoymiles;