rx_boost state is undefined at boot (minor fix)

every LBT-retried flood packet loses its priority (fixed)
witching between LBT and non-LBT mode (or any cad.mode change) could silently skip full reconfiguration and leave the radio in the wrong mode (fixed)
This commit is contained in:
liquidraver
2026-05-08 09:50:52 +02:00
parent 66f7b8508f
commit 6919c3511c
5 changed files with 36 additions and 3 deletions
+7 -2
View File
@@ -28,6 +28,7 @@ Dispatcher::Dispatcher(Radio &radio, MillisecondClock &ms, PacketManager &mgr)
: _radio(&radio), _ms(&ms), _mgr(&mgr)
{
outbound = nullptr;
outbound_priority = 0;
total_air_time = rx_air_time = 0;
next_tx_time = 0;
cad_busy_start = 0;
@@ -410,6 +411,10 @@ void Dispatcher::checkSend()
}
cad_busy_start = 0;
/* Snapshot the priority of the packet we're about to dequeue so it
* can be preserved if the send attempt fails and we need to re-queue.
* Must be called before getNextOutbound() removes the entry. */
outbound_priority = _mgr->peekNextOutboundPriority(now);
outbound = _mgr->getNextOutbound(now);
if (outbound) {
uint8_t raw[MAX_TRANS_UNIT];
@@ -460,7 +465,7 @@ void Dispatcher::checkSend()
LOG_DBG("checkSend: final gate blocked TX (isReceiving=%d, isRadioReady=%d, inRecvMode=%d)",
(int)final_is_receiving, (int)final_is_radio_ready,
(int)_radio->isInRecvMode());
_mgr->queueOutbound(outbound, 0, futureMillis((int)retry));
_mgr->queueOutbound(outbound, outbound_priority, futureMillis((int)retry));
outbound = nullptr;
if (_tx_queued_cb) {
_tx_queued_cb(retry, _tx_queued_user_data);
@@ -473,7 +478,7 @@ void Dispatcher::checkSend()
uint32_t retry = getCADFailRetryDelay();
LOG_ERR("checkSend: startSendRaw failed! re-queuing delay=%u", retry);
logTxFail(outbound, outbound->getRawLength());
_mgr->queueOutbound(outbound, 0, futureMillis((int)retry));
_mgr->queueOutbound(outbound, outbound_priority, futureMillis((int)retry));
outbound = nullptr;
if (_tx_queued_cb) {
_tx_queued_cb(retry, _tx_queued_user_data);