Release with more helpful help message
This commit is contained in:
parent
3b79dc94f4
commit
a0d06edf7b
8 changed files with 105 additions and 110 deletions
|
|
@ -1,46 +1,31 @@
|
|||
#ifndef MICROINVERTER_H
|
||||
#define MICROINVERTER_H
|
||||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
// #include <mutex>
|
||||
#include <vector>
|
||||
|
||||
#include "port.h"
|
||||
#include "modbus.h"
|
||||
|
||||
// struct _modbus;
|
||||
// typedef _modbus modbus_t;
|
||||
#include "port.h"
|
||||
|
||||
class Microinverter {
|
||||
private:
|
||||
// std::shared_ptr<modbus_t*> modbus_context;
|
||||
|
||||
std::shared_ptr<class modbus> modbus;
|
||||
|
||||
// std::mutex *modbus_context_mutex;
|
||||
|
||||
|
||||
|
||||
public:
|
||||
Microinverter(
|
||||
std::shared_ptr<class modbus> modbus, long long serialNumber);
|
||||
Microinverter(std::shared_ptr<class modbus> modbus, long long serialNumber);
|
||||
|
||||
long long serialNumber;
|
||||
|
||||
std::vector<Port> ports;
|
||||
|
||||
// void updatePorts();
|
||||
|
||||
void updatePorts(std::vector<std::string> ¶metersToGet, bool allParameters);
|
||||
|
||||
void updatePort(int i);
|
||||
|
||||
Port getPort(int i);
|
||||
|
||||
// void printPorts();
|
||||
|
||||
void printPorts(std::vector<std::string> ¶metersToGet, bool allParameters);
|
||||
|
||||
long long getTodayProduction();
|
||||
|
||||
long long getTotalProduction();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -16,8 +16,6 @@ class Port {
|
|||
|
||||
void populateParameters();
|
||||
|
||||
std::pair<std::shared_ptr<PortParameter>, bool> getParameterByName(std::string name);
|
||||
|
||||
void fixCurrent();
|
||||
bool currentFixed;
|
||||
|
||||
|
|
@ -26,12 +24,10 @@ class Port {
|
|||
|
||||
std::vector<std::shared_ptr<PortParameter>> parameters;
|
||||
|
||||
// void updateParameters();
|
||||
std::pair<std::shared_ptr<PortParameter>, bool> getParameterByName(std::string name);
|
||||
|
||||
void updateParameters(std::vector<std::string> ¶metersToGet, bool allParameters);
|
||||
|
||||
// void printParameters();
|
||||
|
||||
void printParameters(std::vector<std::string> ¶metersToGet, bool allParameters);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -4,84 +4,84 @@
|
|||
#include "portParametersGeneric.h"
|
||||
|
||||
class PortParameterMicroinverterSerialNumber : public PortParameterInt {
|
||||
protected:
|
||||
void setValueFromRegisters(uint16_t *readArray, int registerCount);
|
||||
private:
|
||||
void setValueFromRegisters(uint16_t *readArray, int registerCount);
|
||||
|
||||
public:
|
||||
PortParameterMicroinverterSerialNumber();
|
||||
PortParameterMicroinverterSerialNumber();
|
||||
};
|
||||
|
||||
class PortParameterPortNumber : public PortParameterInt {
|
||||
private:
|
||||
void setValueFromRegisters(uint16_t *readArray, int registerCount);
|
||||
void setValueFromRegisters(uint16_t *readArray, int registerCount);
|
||||
|
||||
public:
|
||||
PortParameterPortNumber();
|
||||
PortParameterPortNumber();
|
||||
};
|
||||
|
||||
class PortParameterPvVoltage : public PortParameterFloat {
|
||||
public:
|
||||
PortParameterPvVoltage();
|
||||
PortParameterPvVoltage();
|
||||
};
|
||||
|
||||
class PortParameterPvCurrentMi : public PortParameterFloat {
|
||||
public:
|
||||
PortParameterPvCurrentMi();
|
||||
PortParameterPvCurrentMi();
|
||||
};
|
||||
|
||||
class PortParameterPvCurrentHm : public PortParameterFloat {
|
||||
public:
|
||||
PortParameterPvCurrentHm();
|
||||
PortParameterPvCurrentHm();
|
||||
};
|
||||
|
||||
class PortParameterGridVoltage : public PortParameterFloat {
|
||||
public:
|
||||
PortParameterGridVoltage();
|
||||
PortParameterGridVoltage();
|
||||
};
|
||||
|
||||
class PortParameterGridFrequency : public PortParameterFloat {
|
||||
public:
|
||||
PortParameterGridFrequency();
|
||||
PortParameterGridFrequency();
|
||||
};
|
||||
|
||||
class PortParameterPvPower : public PortParameterFloat {
|
||||
public:
|
||||
PortParameterPvPower();
|
||||
PortParameterPvPower();
|
||||
};
|
||||
|
||||
class PortParameterTodayProduction : public PortParameterInt {
|
||||
public:
|
||||
PortParameterTodayProduction();
|
||||
PortParameterTodayProduction();
|
||||
};
|
||||
|
||||
class PortParameterTotalProduction : public PortParameterInt {
|
||||
public:
|
||||
PortParameterTotalProduction();
|
||||
PortParameterTotalProduction();
|
||||
};
|
||||
|
||||
class PortParameterTemperature : public PortParameterFloat {
|
||||
public:
|
||||
PortParameterTemperature();
|
||||
PortParameterTemperature();
|
||||
};
|
||||
|
||||
class PortParameterOperatingStatus : public PortParameterInt {
|
||||
public:
|
||||
PortParameterOperatingStatus();
|
||||
PortParameterOperatingStatus();
|
||||
};
|
||||
|
||||
class PortParameterAlarmCode : public PortParameterInt {
|
||||
public:
|
||||
PortParameterAlarmCode();
|
||||
PortParameterAlarmCode();
|
||||
};
|
||||
|
||||
class PortParameterAlarmCount : public PortParameterInt {
|
||||
public:
|
||||
PortParameterAlarmCount();
|
||||
PortParameterAlarmCount();
|
||||
};
|
||||
|
||||
class PortParameterLinkStatus : public PortParameterInt {
|
||||
public:
|
||||
PortParameterLinkStatus();
|
||||
PortParameterLinkStatus();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,10 +1,9 @@
|
|||
#ifndef PORTPARAMETERSGENERIC_H
|
||||
#define PORTPARAMETERSGENERIC_H
|
||||
|
||||
#include <memory>
|
||||
#include <stdint.h>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
// #include <mutex>
|
||||
|
||||
struct _modbus;
|
||||
typedef _modbus modbus_t;
|
||||
|
|
@ -29,7 +28,7 @@ class PortParameter {
|
|||
};
|
||||
|
||||
protected:
|
||||
PortParameterValueType valueType;
|
||||
PortParameterValueType valueType;
|
||||
PortParameterValue value;
|
||||
|
||||
public:
|
||||
|
|
@ -45,21 +44,21 @@ class PortParameter {
|
|||
|
||||
class PortParameterFloat : virtual public PortParameter {
|
||||
protected:
|
||||
int decimalPlaces;
|
||||
int decimalPlaces;
|
||||
|
||||
virtual void setValueFromRegisters(uint16_t *readArray, int registerCount);
|
||||
virtual void setValueFromRegisters(uint16_t *readArray, int registerCount);
|
||||
|
||||
public:
|
||||
public:
|
||||
PortParameterFloat(std::string name, int decimalPlaces, uint16_t parameterAddressOffset, int registerSize);
|
||||
|
||||
std::string getOutputValue();
|
||||
};
|
||||
|
||||
class PortParameterInt : virtual public PortParameter {
|
||||
protected:
|
||||
protected:
|
||||
virtual void setValueFromRegisters(uint16_t *readArray, int registerCount);
|
||||
|
||||
public:
|
||||
public:
|
||||
PortParameterInt(std::string name, uint16_t parameterAddressOffset, int registerSize);
|
||||
|
||||
std::string getOutputValue();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue