Skip to content

Commit

Permalink
Fix: Only count RF RX packets when packets where sent
Browse files Browse the repository at this point in the history
This mainly occours after a reset of  the statistics that receive count is higher then transmit count
  • Loading branch information
tbnobody committed Sep 26, 2024
1 parent 67cae68 commit 8e26ef4
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions lib/Hoymiles/src/HoymilesRadio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,23 +67,29 @@ void HoymilesRadio::handleReceivedPackage()
} else if (verifyResult == FRAGMENT_ALL_MISSING_TIMEOUT) {
Hoymiles.getMessageOutput()->println("Nothing received, resend count exeeded");
// Statistics: Count RX Fail No Answer
inv->RadioStats.RxFailNoAnswer++;
if (inv->RadioStats.TxRequestData > 0) {
inv->RadioStats.RxFailNoAnswer++;
}

_commandQueue.pop();
_busyFlag = false;

} else if (verifyResult == FRAGMENT_RETRANSMIT_TIMEOUT) {
Hoymiles.getMessageOutput()->println("Retransmit timeout");
// Statistics: Count RX Fail Partial Answer
inv->RadioStats.RxFailPartialAnswer++;
if (inv->RadioStats.TxRequestData > 0) {
inv->RadioStats.RxFailPartialAnswer++;
}

_commandQueue.pop();
_busyFlag = false;

} else if (verifyResult == FRAGMENT_HANDLE_ERROR) {
Hoymiles.getMessageOutput()->println("Packet handling error");
// Statistics: Count RX Fail Corrupt Data
inv->RadioStats.RxFailCorruptData++;
if (inv->RadioStats.TxRequestData > 0) {
inv->RadioStats.RxFailCorruptData++;
}

_commandQueue.pop();
_busyFlag = false;
Expand All @@ -101,7 +107,9 @@ void HoymilesRadio::handleReceivedPackage()
// Successful received all packages
Hoymiles.getMessageOutput()->println("Success");
// Statistics: Count RX Success
inv->RadioStats.RxSuccess++;
if (inv->RadioStats.TxRequestData > 0) {
inv->RadioStats.RxSuccess++;
}

_commandQueue.pop();
_busyFlag = false;
Expand Down

0 comments on commit 8e26ef4

Please sign in to comment.