Browse Source

0.8.2720

finally GetLossRate seems to work without troubles...
pull/1284/head
rejoe2 2 years ago
committed by GitHub
parent
commit
1bffc7528e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/defines.h
  2. 6
      src/hm/Communication.h
  3. 11
      src/hm/hmInverter.h
  4. 15
      src/hm/hmRadio.h

2
src/defines.h

@ -13,7 +13,7 @@
//-------------------------------------
#define VERSION_MAJOR 0
#define VERSION_MINOR 8
#define VERSION_PATCH 2716
#define VERSION_PATCH 2720
//-------------------------------------
typedef struct {

6
src/hm/Communication.h

@ -488,8 +488,10 @@ class Communication : public CommQueue<> {
record_t<> *rec = q->iv->getRecordStruct(q->cmd);
if(NULL == rec) {
if(GetLossRate == q->cmd) {
q->iv->parseGetLossRate(q->iv->id, mPayload, len);
closeRequest(q, true);
//q->iv->parseGetLossRate(q->iv->id, mPayload, len);
q->iv->parseGetLossRate(mPayload, len);
//closeRequest(q, true);
return;
} else {
DPRINTLN(DBG_ERROR, F("record is NULL!"));
closeRequest(q, false);

11
src/hm/hmInverter.h

@ -175,6 +175,10 @@ class Inverter {
mIsSingleframeReq = false;
radio = NULL;
commEnabled = true;
mIvRxCnt = 0;
mIvTxCnt = 0;
mDtuRxCnt = 0;
mDtuTxCnt = 0;
memset(&radioStatistics, 0, sizeof(statistics_t));
memset(heuristics.txRfQuality, -6, 5);
@ -601,18 +605,21 @@ class Inverter {
memset(mLastYD, 0, sizeof(float) * 6);
}
bool parseGetLossRate(uint8_t id, uint8_t pyld[], uint8_t len) {
//bool parseGetLossRate(uint8_t id, uint8_t pyld[], uint8_t len) {
bool parseGetLossRate(uint8_t pyld[], uint8_t len) {
if (len == HMGETLOSSRATE_PAYLOAD_LEN) {
uint16_t rxCnt = (pyld[0] << 8) + pyld[1];
uint16_t txCnt = (pyld[2] << 8) + pyld[3];
if (mIvRxCnt || mIvTxCnt) { // there was successful GetLossRate in the past
DPRINT_IVID(DBG_INFO, id);
DBGPRINTLN("Inv loss: " + String (mDtuTxCnt - (rxCnt - mIvRxCnt)) + " of " +
DBGPRINTLN("Inv loss: " +
String (mDtuTxCnt - (rxCnt - mIvRxCnt)) + " of " +
String (mDtuTxCnt) + ", DTU loss: " +
String (txCnt - mIvTxCnt - mDtuRxCnt) + " of " +
String (txCnt - mIvTxCnt));
}
mIvRxCnt = rxCnt;
mIvTxCnt = txCnt;
mDtuRxCnt = 0; // start new interval

15
src/hm/hmRadio.h

@ -130,10 +130,12 @@ class HmRadio : public Radio {
//mRxChannels - 1; //
//(mTxChIdx + mRxChannels) % RF_MAX_CHANNEL_ID; // start with a fixed offset
bool switchch = true;
uint8_t looprounds = 0;
while ((millis() - loopMillis) < mRxTmoOuterLoop) {
while ((micros() - startMicros) < mRxTmoInnerLoop) { // listen (4088us or?) 5110us to each channel
if (mIrqRcvd) {
mIrqRcvd = false;
mLastIv->mRxChanSync = false; //reset
if (getReceived()) { // everything received
return;
@ -142,10 +144,22 @@ class HmRadio : public Radio {
yield();
}
// switch to next RX channel
bool chgchan = true;
/*if (mLastIv->mRxChanSync) {
if (!looprounds) {
mRxChIdx = mLastIv->mRxChanIdx - switchch;
} else if (++looprounds > 9) {
looprounds = 0;
switchch = !switchch;
mRxChIdx = mLastIv->mRxChanIdx - switchch;
if(switchch)
mLastIv->mRxChanSync = false; // we didn't receive st. timely on this channel
} else
chgchan = false;
}*/
if(chgchan) {
if(++mRxChIdx >= RF_CHANNELS)
mRxChIdx = 0;
@ -157,6 +171,7 @@ class HmRadio : public Radio {
mNrf24->setChannel(mRfChLst[mRxChIdx]);
//mNrf24->setChannel(mRfChLst[nextRxCh]);
}
startMicros = micros();
}
// not finished but time is over

Loading…
Cancel
Save