Managed to implement some stuff, need to rewrite reading from DTU
This commit is contained in:
parent
f3f1aa3903
commit
9c3ed916b5
10 changed files with 90 additions and 27 deletions
|
|
@ -2,6 +2,8 @@
|
|||
#define DTU_H
|
||||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
||||
#include "microinverter.h"
|
||||
|
||||
|
|
@ -10,7 +12,8 @@ typedef _modbus modbus_t;
|
|||
|
||||
class Dtu {
|
||||
private:
|
||||
modbus_t *modbus_context;
|
||||
std::shared_ptr<modbus_t*> modbus_context;
|
||||
std::mutex modbus_context_mutex;
|
||||
|
||||
std::vector<Microinverter> microinverters;
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@
|
|||
#define MICROINVERTER_H
|
||||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
||||
#include "port.h"
|
||||
|
||||
|
|
@ -10,14 +12,15 @@ typedef _modbus modbus_t;
|
|||
|
||||
class Microinverter {
|
||||
private:
|
||||
modbus_t *modbus_context;
|
||||
std::shared_ptr<modbus_t*> modbus_context;
|
||||
std::mutex *modbus_context_mutex;
|
||||
|
||||
std::vector<Port> ports;
|
||||
|
||||
void populatePorts();
|
||||
|
||||
public:
|
||||
Microinverter(modbus_t *modbus_t);
|
||||
Microinverter(std::shared_ptr<modbus_t*> modbus_context, std::mutex *modbus_context_mutex);
|
||||
|
||||
void updatePorts();
|
||||
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
||||
#include "portParametersGeneric.h"
|
||||
|
||||
|
|
@ -13,7 +14,9 @@ typedef _modbus modbus_t;
|
|||
|
||||
class Port {
|
||||
private:
|
||||
modbus_t *modbus_context;
|
||||
std::shared_ptr<modbus_t*> modbus_context;
|
||||
std::mutex *modbus_context_mutex;
|
||||
|
||||
uint16_t portStartAddress;
|
||||
|
||||
std::vector<std::shared_ptr<PortParameter>> parameters;
|
||||
|
|
@ -21,7 +24,7 @@ class Port {
|
|||
void populateParameters();
|
||||
|
||||
public:
|
||||
Port(modbus_t *modbus_context, uint16_t portStartAddress);
|
||||
Port(std::shared_ptr<modbus_t*> modbus_context, std::mutex *modbus_context_mutex, uint16_t portStartAddress);
|
||||
|
||||
void updateParameters();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@
|
|||
#include "portParametersGeneric.h"
|
||||
|
||||
class PortParameterMicroinverterSerialNumber : public PortParameterInt {
|
||||
protected:
|
||||
void setValueFromRegisters(uint16_t *readArray, int registerCount);
|
||||
|
||||
public:
|
||||
PortParameterMicroinverterSerialNumber();
|
||||
};
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
|
||||
struct _modbus;
|
||||
typedef _modbus modbus_t;
|
||||
|
|
@ -38,7 +40,7 @@ class PortParameter {
|
|||
|
||||
virtual std::string getOutputValue();
|
||||
|
||||
void updateValue(modbus_t *modbus_context, uint16_t portStartAddress);
|
||||
void updateValue(std::shared_ptr<modbus_t*> modbus_context, std::mutex *modbus_context_mutex, uint16_t portStartAddress);
|
||||
};
|
||||
|
||||
class PortParameterFloat : virtual public PortParameter {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue