mirror of
https://github.com/lumapu/ahoy.git
synced 2025-07-18 00:37:13 +02:00
parent
27ad75b7d3
commit
40097aba18
7 changed files with 30 additions and 26 deletions
|
@ -7,6 +7,7 @@
|
||||||
* merge Prometheus metrics fix #1310
|
* merge Prometheus metrics fix #1310
|
||||||
* merge MI grid profile request #1306
|
* merge MI grid profile request #1306
|
||||||
* merge update documentation / readme #1305
|
* merge update documentation / readme #1305
|
||||||
|
* add `getLossRate` to radio statistics and to MqTT #1199
|
||||||
|
|
||||||
## 0.8.38 - 2023-12-31
|
## 0.8.38 - 2023-12-31
|
||||||
* fix Grid-Profile JSON #1304
|
* fix Grid-Profile JSON #1304
|
||||||
|
|
|
@ -103,6 +103,10 @@ typedef struct {
|
||||||
uint32_t frmCnt;
|
uint32_t frmCnt;
|
||||||
uint32_t txCnt;
|
uint32_t txCnt;
|
||||||
uint32_t retransmits;
|
uint32_t retransmits;
|
||||||
|
uint16_t ivRxCnt; // last iv rx frames (from GetLossRate)
|
||||||
|
uint16_t ivTxCnt; // last iv tx frames (from GetLossRate)
|
||||||
|
uint16_t dtuRxCnt; // current DTU rx frames (since last GetLossRate)
|
||||||
|
uint16_t dtuTxCnt; // current DTU tx frames (since last GetLossRate)
|
||||||
} statistics_t;
|
} statistics_t;
|
||||||
|
|
||||||
#endif /*__DEFINES_H__*/
|
#endif /*__DEFINES_H__*/
|
||||||
|
|
|
@ -151,7 +151,7 @@ class Communication : public CommQueue<> {
|
||||||
|
|
||||||
if(validateIvSerial(&p->packet[1], q->iv)) {
|
if(validateIvSerial(&p->packet[1], q->iv)) {
|
||||||
q->iv->radioStatistics.frmCnt++;
|
q->iv->radioStatistics.frmCnt++;
|
||||||
q->iv->mDtuRxCnt++;
|
q->iv->radioStatistics.dtuRxCnt++;
|
||||||
|
|
||||||
if (p->packet[0] == (TX_REQ_INFO + ALL_FRAMES)) { // response from get information command
|
if (p->packet[0] == (TX_REQ_INFO + ALL_FRAMES)) { // response from get information command
|
||||||
if(parseFrame(p))
|
if(parseFrame(p))
|
||||||
|
|
|
@ -141,12 +141,6 @@ class Inverter {
|
||||||
uint8_t curCmtFreq; // current used CMT frequency, used to check if freq. was changed during runtime
|
uint8_t curCmtFreq; // current used CMT frequency, used to check if freq. was changed during runtime
|
||||||
bool commEnabled; // 'pause night communication' sets this field to false
|
bool commEnabled; // 'pause night communication' sets this field to false
|
||||||
|
|
||||||
uint16_t mIvRxCnt; // last iv rx frames (from GetLossRate)
|
|
||||||
uint16_t mIvTxCnt; // last iv tx frames (from GetLossRate)
|
|
||||||
uint16_t mDtuRxCnt; // cur dtu rx frames (since last GetLossRate)
|
|
||||||
uint16_t mDtuTxCnt; // cur dtu tx frames (since last getLoassRate)
|
|
||||||
uint8_t mGetLossInterval; // request iv every AHOY_GET_LOSS_INTERVAL RealTimeRunData_Debu
|
|
||||||
|
|
||||||
static uint32_t *timestamp; // system timestamp
|
static uint32_t *timestamp; // system timestamp
|
||||||
static cfgInst_t *generalConfig; // general inverter configuration from setup
|
static cfgInst_t *generalConfig; // general inverter configuration from setup
|
||||||
|
|
||||||
|
@ -171,10 +165,6 @@ class Inverter {
|
||||||
mIsSingleframeReq = false;
|
mIsSingleframeReq = false;
|
||||||
radio = NULL;
|
radio = NULL;
|
||||||
commEnabled = true;
|
commEnabled = true;
|
||||||
mIvRxCnt = 0;
|
|
||||||
mIvTxCnt = 0;
|
|
||||||
mDtuRxCnt = 0;
|
|
||||||
mDtuTxCnt = 0;
|
|
||||||
|
|
||||||
memset(&radioStatistics, 0, sizeof(statistics_t));
|
memset(&radioStatistics, 0, sizeof(statistics_t));
|
||||||
memset(heuristics.txRfQuality, -6, 5);
|
memset(heuristics.txRfQuality, -6, 5);
|
||||||
|
@ -605,21 +595,25 @@ class Inverter {
|
||||||
uint16_t rxCnt = (pyld[0] << 8) + pyld[1];
|
uint16_t rxCnt = (pyld[0] << 8) + pyld[1];
|
||||||
uint16_t txCnt = (pyld[2] << 8) + pyld[3];
|
uint16_t txCnt = (pyld[2] << 8) + pyld[3];
|
||||||
|
|
||||||
if (mIvRxCnt || mIvTxCnt) { // there was successful GetLossRate in the past
|
if (radioStatistics.ivRxCnt || radioStatistics.ivTxCnt) { // there was successful GetLossRate in the past
|
||||||
DPRINT_IVID(DBG_INFO, id);
|
DPRINT_IVID(DBG_INFO, id);
|
||||||
DBGPRINTLN("Inv loss: " +
|
DBGPRINT(F("Inv loss: "));
|
||||||
String (mDtuTxCnt - (rxCnt - mIvRxCnt)) + " of " +
|
DBGPRINT(String (radioStatistics.dtuTxCnt - (rxCnt - radioStatistics.ivRxCnt)));
|
||||||
String (mDtuTxCnt) + ", DTU loss: " +
|
DBGPRINT(F(" of "));
|
||||||
String (txCnt - mIvTxCnt - mDtuRxCnt) + " of " +
|
DBGPRINT(String (radioStatistics.dtuTxCnt));
|
||||||
String (txCnt - mIvTxCnt));
|
DBGPRINT(F(", DTU loss: "));
|
||||||
|
DBGPRINT(String (txCnt - radioStatistics.ivTxCnt - radioStatistics.dtuRxCnt));
|
||||||
|
DBGPRINT(F(" of "));
|
||||||
|
DBGPRINTLN(String (txCnt - radioStatistics.ivTxCnt));
|
||||||
}
|
}
|
||||||
|
|
||||||
mIvRxCnt = rxCnt;
|
radioStatistics.ivRxCnt = rxCnt;
|
||||||
mIvTxCnt = txCnt;
|
radioStatistics.ivTxCnt = txCnt;
|
||||||
mDtuRxCnt = 0; // start new interval
|
radioStatistics.dtuRxCnt = 0; // start new interval
|
||||||
mDtuTxCnt = 0; // start new interval
|
radioStatistics.dtuTxCnt = 0; // start new interval
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -811,6 +805,7 @@ class Inverter {
|
||||||
bool mDevControlRequest; // true if change needed
|
bool mDevControlRequest; // true if change needed
|
||||||
uint8_t mGridLen = 0;
|
uint8_t mGridLen = 0;
|
||||||
uint8_t mGridProfile[MAX_GRID_LENGTH];
|
uint8_t mGridProfile[MAX_GRID_LENGTH];
|
||||||
|
uint8_t mGetLossInterval; // request iv every AHOY_GET_LOSS_INTERVAL RealTimeRunData_Debug
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class REC_TYP>
|
template <class REC_TYP>
|
||||||
|
|
|
@ -339,7 +339,7 @@ class HmRadio : public Radio {
|
||||||
mMillis = millis();
|
mMillis = millis();
|
||||||
|
|
||||||
mLastIv = iv;
|
mLastIv = iv;
|
||||||
iv->mDtuTxCnt++;
|
iv->radioStatistics.dtuTxCnt++;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t getIvId(Inverter<> *iv) {
|
uint64_t getIvId(Inverter<> *iv) {
|
||||||
|
|
|
@ -112,7 +112,7 @@ class CmtRadio : public Radio {
|
||||||
if(CMT_ERR_RX_IN_FIFO == status)
|
if(CMT_ERR_RX_IN_FIFO == status)
|
||||||
mIrqRcvd = true;
|
mIrqRcvd = true;
|
||||||
}
|
}
|
||||||
iv->mDtuTxCnt++;
|
iv->radioStatistics.dtuTxCnt++;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t getIvId(Inverter<> *iv) {
|
uint64_t getIvId(Inverter<> *iv) {
|
||||||
|
|
|
@ -195,12 +195,16 @@ class PubMqttIvData {
|
||||||
|
|
||||||
inline void sendRadioStat(uint8_t start) {
|
inline void sendRadioStat(uint8_t start) {
|
||||||
snprintf(mSubTopic, 32 + MAX_NAME_LENGTH, "%s/radio_stat", mIv->config->name);
|
snprintf(mSubTopic, 32 + MAX_NAME_LENGTH, "%s/radio_stat", mIv->config->name);
|
||||||
snprintf(mVal, 100, "{\"tx\":%d,\"success\":%d,\"fail\":%d,\"no_answer\":%d,\"retransmits\":%d}",
|
snprintf(mVal, 140, "{\"tx\":%d,\"success\":%d,\"fail\":%d,\"no_answer\":%d,\"retransmits\":%d,\"lossIvRx\":%d,\"lossIvTx\":%d,\"lossDtuRx\":%d,\"lossDtuTx\":%d}",
|
||||||
mIv->radioStatistics.txCnt,
|
mIv->radioStatistics.txCnt,
|
||||||
mIv->radioStatistics.rxSuccess,
|
mIv->radioStatistics.rxSuccess,
|
||||||
mIv->radioStatistics.rxFail,
|
mIv->radioStatistics.rxFail,
|
||||||
mIv->radioStatistics.rxFailNoAnser,
|
mIv->radioStatistics.rxFailNoAnser,
|
||||||
mIv->radioStatistics.retransmits);
|
mIv->radioStatistics.retransmits,
|
||||||
|
mIv->radioStatistics.ivRxCnt,
|
||||||
|
mIv->radioStatistics.ivTxCnt,
|
||||||
|
mIv->radioStatistics.dtuRxCnt,
|
||||||
|
mIv->radioStatistics.dtuTxCnt);
|
||||||
mPublish(mSubTopic, mVal, false, QOS_0);
|
mPublish(mSubTopic, mVal, false, QOS_0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,7 +267,7 @@ class PubMqttIvData {
|
||||||
bool mRTRDataHasBeenSent;
|
bool mRTRDataHasBeenSent;
|
||||||
|
|
||||||
char mSubTopic[32 + MAX_NAME_LENGTH + 1];
|
char mSubTopic[32 + MAX_NAME_LENGTH + 1];
|
||||||
char mVal[100];
|
char mVal[140];
|
||||||
bool mZeroValues; // makes sure that yield day is sent even if no inverter is online
|
bool mZeroValues; // makes sure that yield day is sent even if no inverter is online
|
||||||
|
|
||||||
std::queue<sendListCmdIv> *mSendList;
|
std::queue<sendListCmdIv> *mSendList;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue