Browse Source

partly fix statistics

- add more data requests to startup phase
pull/1394/head
rejoe2 9 months ago
committed by GitHub
parent
commit
444a716012
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 7
      src/hm/Communication.h
  2. 12
      src/hm/hmInverter.h
  3. 12
      src/hm/hmRadio.h

7
src/hm/Communication.h

@ -159,6 +159,7 @@ class Communication : public CommQueue<> {
//setAttempt();
mHeu.evalTxChQuality(q->iv, false, 0, 0);
//q->iv->radioStatistics.rxFailNoAnser++; // should only be one of fail or retransmit.
q->iv->radioStatistics.txCnt--;
q->iv->radioStatistics.retransmits++;
q->iv->radio->mRadioWaitTime.stopTimeMonitor();
mState = States::START;
@ -835,8 +836,9 @@ class Communication : public CommQueue<> {
DBGHEXLN(cmd);
}
if(q->iv->miMultiParts == 7)
q->iv->radioStatistics.rxSuccess++;
//if(q->iv->miMultiParts > 5) //if(q->iv->miMultiParts == 7)
q->iv->radioStatistics.rxSuccess++;
q->iv->radioStatistics.ivSent++;
mFramesExpected = getFramesExpected(q);
q->iv->radio->setExpectedFrames(mFramesExpected);
@ -861,6 +863,7 @@ class Communication : public CommQueue<> {
}
q->iv->radio->sendCmdPacket(q->iv, q->cmd, 0x00, true);
q->iv->radioStatistics.retransmits++;
q->iv->radio->mRadioWaitTime.startTimeMonitor(DURATION_TXFRAME + DURATION_ONEFRAME + duration_reserve[q->iv->ivRadioType]);
mIsRetransmit = false;

12
src/hm/hmInverter.h

@ -200,13 +200,17 @@ class Inverter {
cb(devControlCmd, false); // custom command which was received by API
devControlCmd = InitDataState;
mGetLossInterval = 1;
} else if(0 == getFwVersion())
} else if(0 == getFwVersion()) {
cb(RealTimeRunData_Debug, false); // get live data
cb(InverterDevInform_All, false); // get firmware version
else if(0 == getHwVersion())
}
else if(0 == getHwVersion()) {
cb(RealTimeRunData_Debug, false); // get live data
cb(InverterDevInform_Simple, false); // get hardware version
else if((alarmLastId != alarmMesIndex) && (alarmMesIndex != 0))
} else if((alarmLastId != alarmMesIndex) && (alarmMesIndex != 0)) {
cb(RealTimeRunData_Debug, false); // get live data
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;

12
src/hm/hmRadio.h

@ -113,6 +113,7 @@ class HmRadio : public Radio {
if (mRadioWaitTime.isTimeout()) { // timeout reached!
mNRFisInRX = false;
rx_ready = false;
return false;
}
@ -165,7 +166,7 @@ class HmRadio : public Radio {
}
if(rx_ready) {
if (getReceived()) { // check what we got, returns true for last package
if (getReceived()) { // check what we got, returns true for last package or success for single frame request
mNRFisInRX = false;
rx_ready = false;
mRadioWaitTime.startTimeMonitor(DURATION_PAUSE_LASTFR); // let the inverter first end his transmissions
@ -183,6 +184,7 @@ class HmRadio : public Radio {
mRxChIdx = tempRxChIdx;
}
}
rx_ready = false; // reset
return mNRFisInRX;
} /*else if(tx_fail) {
mNRFisInRX = false;
@ -305,6 +307,7 @@ class HmRadio : public Radio {
private:
inline bool getReceived(void) {
bool isLastPackage = false;
bool isRetransmitAnswer = false;
rx_ready = false; // reset for ACK case
while(mNrf24->available()) {
@ -329,8 +332,11 @@ class HmRadio : public Radio {
mLastIv->mGotFragment = true;
mBufCtrl.push(p);
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
isLastPackage = (p.packet[9] > ALL_FRAMES); // > ALL_FRAMES indicates last packet received
if(mLastIv->mIsSingleframeReq) // we only expect one frame here...
isRetransmitAnswer = true;
}
if(IV_MI == mLastIv->ivGen) {
if (p.packet[0] == (0x0f + ALL_FRAMES)) // response from MI get information command
@ -346,7 +352,7 @@ class HmRadio : public Radio {
}
if(isLastPackage)
mLastIv->mGotLastMsg = true;
return isLastPackage;
return isLastPackage || isRetransmitAnswer;
}
void sendPacket(Inverter<> *iv, uint8_t len, bool isRetransmit, bool appendCrc16=true) {

Loading…
Cancel
Save