mirror of
https://github.com/lumapu/ahoy.git
synced 2025-05-15 01:46:38 +02:00
partly fix statistics
- add more data requests to startup phase
This commit is contained in:
parent
3fbd2c7c88
commit
444a716012
3 changed files with 22 additions and 9 deletions
|
@ -159,6 +159,7 @@ class Communication : public CommQueue<> {
|
||||||
//setAttempt();
|
//setAttempt();
|
||||||
mHeu.evalTxChQuality(q->iv, false, 0, 0);
|
mHeu.evalTxChQuality(q->iv, false, 0, 0);
|
||||||
//q->iv->radioStatistics.rxFailNoAnser++; // should only be one of fail or retransmit.
|
//q->iv->radioStatistics.rxFailNoAnser++; // should only be one of fail or retransmit.
|
||||||
|
q->iv->radioStatistics.txCnt--;
|
||||||
q->iv->radioStatistics.retransmits++;
|
q->iv->radioStatistics.retransmits++;
|
||||||
q->iv->radio->mRadioWaitTime.stopTimeMonitor();
|
q->iv->radio->mRadioWaitTime.stopTimeMonitor();
|
||||||
mState = States::START;
|
mState = States::START;
|
||||||
|
@ -835,8 +836,9 @@ class Communication : public CommQueue<> {
|
||||||
DBGHEXLN(cmd);
|
DBGHEXLN(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(q->iv->miMultiParts == 7)
|
//if(q->iv->miMultiParts > 5) //if(q->iv->miMultiParts == 7)
|
||||||
q->iv->radioStatistics.rxSuccess++;
|
q->iv->radioStatistics.rxSuccess++;
|
||||||
|
q->iv->radioStatistics.ivSent++;
|
||||||
|
|
||||||
mFramesExpected = getFramesExpected(q);
|
mFramesExpected = getFramesExpected(q);
|
||||||
q->iv->radio->setExpectedFrames(mFramesExpected);
|
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->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]);
|
q->iv->radio->mRadioWaitTime.startTimeMonitor(DURATION_TXFRAME + DURATION_ONEFRAME + duration_reserve[q->iv->ivRadioType]);
|
||||||
mIsRetransmit = false;
|
mIsRetransmit = false;
|
||||||
|
|
|
@ -200,13 +200,17 @@ class Inverter {
|
||||||
cb(devControlCmd, false); // custom command which was received by API
|
cb(devControlCmd, false); // custom command which was received by API
|
||||||
devControlCmd = InitDataState;
|
devControlCmd = InitDataState;
|
||||||
mGetLossInterval = 1;
|
mGetLossInterval = 1;
|
||||||
} else if(0 == getFwVersion())
|
} else if(0 == getFwVersion()) {
|
||||||
|
cb(RealTimeRunData_Debug, false); // get live data
|
||||||
cb(InverterDevInform_All, false); // get firmware version
|
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
|
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
|
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);
|
cb(GridOnProFilePara, false);
|
||||||
} else if (mGetLossInterval > AHOY_GET_LOSS_INTERVAL) { // get loss rate
|
} else if (mGetLossInterval > AHOY_GET_LOSS_INTERVAL) { // get loss rate
|
||||||
mGetLossInterval = 1;
|
mGetLossInterval = 1;
|
||||||
|
|
|
@ -113,6 +113,7 @@ class HmRadio : public Radio {
|
||||||
|
|
||||||
if (mRadioWaitTime.isTimeout()) { // timeout reached!
|
if (mRadioWaitTime.isTimeout()) { // timeout reached!
|
||||||
mNRFisInRX = false;
|
mNRFisInRX = false;
|
||||||
|
rx_ready = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,7 +166,7 @@ class HmRadio : public Radio {
|
||||||
}
|
}
|
||||||
|
|
||||||
if(rx_ready) {
|
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;
|
mNRFisInRX = false;
|
||||||
rx_ready = false;
|
rx_ready = false;
|
||||||
mRadioWaitTime.startTimeMonitor(DURATION_PAUSE_LASTFR); // let the inverter first end his transmissions
|
mRadioWaitTime.startTimeMonitor(DURATION_PAUSE_LASTFR); // let the inverter first end his transmissions
|
||||||
|
@ -183,6 +184,7 @@ class HmRadio : public Radio {
|
||||||
mRxChIdx = tempRxChIdx;
|
mRxChIdx = tempRxChIdx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
rx_ready = false; // reset
|
||||||
return mNRFisInRX;
|
return mNRFisInRX;
|
||||||
} /*else if(tx_fail) {
|
} /*else if(tx_fail) {
|
||||||
mNRFisInRX = false;
|
mNRFisInRX = false;
|
||||||
|
@ -305,6 +307,7 @@ class HmRadio : public Radio {
|
||||||
private:
|
private:
|
||||||
inline bool getReceived(void) {
|
inline bool getReceived(void) {
|
||||||
bool isLastPackage = false;
|
bool isLastPackage = false;
|
||||||
|
bool isRetransmitAnswer = false;
|
||||||
rx_ready = false; // reset for ACK case
|
rx_ready = false; // reset for ACK case
|
||||||
|
|
||||||
while(mNrf24->available()) {
|
while(mNrf24->available()) {
|
||||||
|
@ -329,8 +332,11 @@ class HmRadio : public Radio {
|
||||||
mLastIv->mGotFragment = true;
|
mLastIv->mGotFragment = true;
|
||||||
mBufCtrl.push(p);
|
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
|
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(IV_MI == mLastIv->ivGen) {
|
||||||
if (p.packet[0] == (0x0f + ALL_FRAMES)) // response from MI get information command
|
if (p.packet[0] == (0x0f + ALL_FRAMES)) // response from MI get information command
|
||||||
|
@ -346,7 +352,7 @@ class HmRadio : public Radio {
|
||||||
}
|
}
|
||||||
if(isLastPackage)
|
if(isLastPackage)
|
||||||
mLastIv->mGotLastMsg = true;
|
mLastIv->mGotLastMsg = true;
|
||||||
return isLastPackage;
|
return isLastPackage || isRetransmitAnswer;
|
||||||
}
|
}
|
||||||
|
|
||||||
void sendPacket(Inverter<> *iv, uint8_t len, bool isRetransmit, bool appendCrc16=true) {
|
void sendPacket(Inverter<> *iv, uint8_t len, bool isRetransmit, bool appendCrc16=true) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue