|
|
@ -84,7 +84,7 @@ struct record_t { |
|
|
|
byteAssign_t* assign = nullptr; // assignment of bytes in payload
|
|
|
|
uint8_t length = 0; // length of the assignment list
|
|
|
|
T *record = nullptr; // data pointer
|
|
|
|
uint32_t ts = 0; // timestamp of last received payload
|
|
|
|
uint32_t ts = 0; // Timestamp of last received payload
|
|
|
|
uint8_t pyldLen = 0; // expected payload length for plausibility check
|
|
|
|
MqttSentStatus mqttSentStatus = MqttSentStatus:: NEW_DATA; // indicates the current MqTT sent status
|
|
|
|
}; |
|
|
@ -146,7 +146,7 @@ class Inverter { |
|
|
|
statistics_t radioStatistics; // information about transmitted, failed, ... packets
|
|
|
|
HeuristicInv heuristics; // heuristic information / logic
|
|
|
|
uint8_t curCmtFreq = 0; // current used CMT frequency, used to check if freq. was changed during runtime
|
|
|
|
uint32_t tsMaxAcPower = 0; // holds the timestamp when the MaxAC power was seen
|
|
|
|
uint32_t tsMaxAcPower = 0; // holds the Timestamp when the MaxAC power was seen
|
|
|
|
bool commEnabled = true; // 'pause night communication' sets this field to false
|
|
|
|
|
|
|
|
public: |
|
|
@ -189,7 +189,7 @@ class Inverter { |
|
|
|
cb(InverterDevInform_Simple, false); // get hardware version
|
|
|
|
} else if((alarmLastId != alarmMesIndex) && (alarmMesIndex != 0)) { |
|
|
|
cb(AlarmData, false); // get last alarms
|
|
|
|
} else if((0 == mGridLen) && generalConfig->readGrid) { // read grid profile
|
|
|
|
} else if((0 == mGridLen) && GeneralConfig->readGrid) { // read grid profile
|
|
|
|
cb(GridOnProFilePara, false); |
|
|
|
} else if (mGetLossInterval > AHOY_GET_LOSS_INTERVAL) { // get loss rate
|
|
|
|
mGetLossInterval = 1; |
|
|
@ -213,7 +213,7 @@ class Inverter { |
|
|
|
if (getChannelFieldValue(CH0, FLD_PART_NUM, rec) == 0) { |
|
|
|
cb(0x0f, false); // hard- and firmware version for missing HW part nr, delivered by frame 1
|
|
|
|
mIvRxCnt +=2; |
|
|
|
} else if((getChannelFieldValue(CH0, FLD_GRID_PROFILE_CODE, rec) == 0) && generalConfig->readGrid) // read grid profile
|
|
|
|
} else if((getChannelFieldValue(CH0, FLD_GRID_PROFILE_CODE, rec) == 0) && GeneralConfig->readGrid) // read grid profile
|
|
|
|
cb(0x10, false); // legacy GPF command
|
|
|
|
} |
|
|
|
} |
|
|
@ -270,16 +270,18 @@ class Inverter { |
|
|
|
if(InverterStatus::OFF != status) { |
|
|
|
mDevControlRequest = true; |
|
|
|
devControlCmd = cmd; |
|
|
|
//assert(App);
|
|
|
|
//App->triggerTickSend(0);
|
|
|
|
assert(App); |
|
|
|
App->triggerTickSend(id); |
|
|
|
return true; |
|
|
|
} |
|
|
|
return (InverterStatus::OFF != status); |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
bool setDevCommand(uint8_t cmd) { |
|
|
|
if(InverterStatus::OFF != status) |
|
|
|
bool retval = (InverterStatus::OFF != status); |
|
|
|
if(retval) |
|
|
|
devControlCmd = cmd; |
|
|
|
return (InverterStatus::OFF != status); |
|
|
|
return retval; |
|
|
|
} |
|
|
|
|
|
|
|
void addValue(uint8_t pos, const uint8_t buf[], record_t<> *rec) { |
|
|
@ -409,14 +411,14 @@ class Inverter { |
|
|
|
if(recordMeas.ts == 0) |
|
|
|
return false; |
|
|
|
|
|
|
|
if(((*timestamp) - recordMeas.ts) < INVERTER_INACT_THRES_SEC) |
|
|
|
if(((*Timestamp) - recordMeas.ts) < INVERTER_INACT_THRES_SEC) |
|
|
|
avail = true; |
|
|
|
|
|
|
|
if(avail) { |
|
|
|
if(status < InverterStatus::PRODUCING) |
|
|
|
status = InverterStatus::STARTING; |
|
|
|
} else { |
|
|
|
if(((*timestamp) - recordMeas.ts) > INVERTER_OFF_THRES_SEC) { |
|
|
|
if(((*Timestamp) - recordMeas.ts) > INVERTER_OFF_THRES_SEC) { |
|
|
|
if(status != InverterStatus::OFF) { |
|
|
|
status = InverterStatus::OFF; |
|
|
|
actPowerLimit = 0xffff; // power limit will be read once inverter becomes available
|
|
|
@ -817,8 +819,8 @@ class Inverter { |
|
|
|
} |
|
|
|
|
|
|
|
public: |
|
|
|
static uint32_t *timestamp; // system timestamp
|
|
|
|
static cfgInst_t *generalConfig; // general inverter configuration from setup
|
|
|
|
static uint32_t *Timestamp; // system timestamp
|
|
|
|
static cfgInst_t *GeneralConfig; // general inverter configuration from setup
|
|
|
|
static IApp *App; |
|
|
|
|
|
|
|
uint16_t mDtuRxCnt = 0; |
|
|
@ -837,9 +839,9 @@ class Inverter { |
|
|
|
}; |
|
|
|
|
|
|
|
template <class REC_TYP> |
|
|
|
uint32_t *Inverter<REC_TYP>::timestamp {0}; |
|
|
|
uint32_t *Inverter<REC_TYP>::Timestamp {0}; |
|
|
|
template <class REC_TYP> |
|
|
|
cfgInst_t *Inverter<REC_TYP>::generalConfig {0}; |
|
|
|
cfgInst_t *Inverter<REC_TYP>::GeneralConfig {0}; |
|
|
|
template <class REC_TYP> |
|
|
|
IApp *Inverter<REC_TYP>::App {nullptr}; |
|
|
|
|
|
|
@ -948,7 +950,7 @@ T calcMaxPowerAcCh0(Inverter<> *iv, uint8_t arg0) { |
|
|
|
} |
|
|
|
} |
|
|
|
if(acPower > acMaxPower) { |
|
|
|
iv->tsMaxAcPower = *iv->timestamp; |
|
|
|
iv->tsMaxAcPower = *iv->Timestamp; |
|
|
|
return acPower; |
|
|
|
} |
|
|
|
} |
|
|
|