diff options
author | Ben V. Brown <Ralim@Ralimtek.com> | 2021-08-06 17:19:35 +0300 |
---|---|---|
committer | Ben V. Brown <Ralim@Ralimtek.com> | 2021-08-06 17:19:35 +0300 |
commit | af6496a9e4f82fbffae524fabcab6152aee6d79c (patch) | |
tree | 0468f3a748f6dfd482c688318ea5b3eb2f560a97 | |
parent | f06a8687dc94a66455503f4c7a0ffcdfc555708f (diff) |
Check discard after tx
-rw-r--r-- | src/policy_engine_states.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/policy_engine_states.cpp b/src/policy_engine_states.cpp index ffa4a4d..d3068a9 100644 --- a/src/policy_engine_states.cpp +++ b/src/policy_engine_states.cpp @@ -491,23 +491,15 @@ PolicyEngine::policy_engine_state PolicyEngine::pe_sink_wait_send_done() { uint32_t evt = currentEvents; clearEvents(); - if ((uint32_t)evt & (uint32_t)Notifications::DISCARD) { - // increment the counter - _tx_messageidcounter = (_tx_messageidcounter + 1) % 8; - notify(Notifications::TX_ERR); - return postSendFailedState; - } - /* If the message was sent successfully */ if ((uint32_t)evt & (uint32_t)Notifications::I_TXSENT) { - clearEvents(); if (incomingMessages.getOccupied()) { return pe_sink_wait_good_crc(); } else { // No Good CRC has arrived, these should _normally_ come really fast, but users implementation may be lagging // Setup a callback for this state - return waitForEvent(PEWaitingMessageGoodCRC, (uint32_t)Notifications::MSG_RX, 100); + return waitForEvent(PEWaitingMessageGoodCRC, (uint32_t)Notifications::MSG_RX, 120); } } /* If the message failed to be sent */ @@ -515,6 +507,13 @@ PolicyEngine::policy_engine_state PolicyEngine::pe_sink_wait_send_done() { notify(Notifications::TX_ERR); return postSendFailedState; } + /* A discard was queued due to rx */ + if ((uint32_t)evt & (uint32_t)Notifications::DISCARD) { + // increment the counter + _tx_messageidcounter = (_tx_messageidcounter + 1) % 8; + notify(Notifications::TX_ERR); + return postSendFailedState; + } /* Silence the compiler warning */ notify(Notifications::TX_ERR); |