diff --git a/docs/cli_commands.md b/docs/cli_commands.md index 6657097e..cba67c7e 100644 --- a/docs/cli_commands.md +++ b/docs/cli_commands.md @@ -953,7 +953,7 @@ region save --- ### Direct Retry -Direct retry resends direct-routed packets when the downstream echo is not heard. It applies to direct messages and TRACE packets. It does not change ACK handling. +Direct retry resends direct-routed packets when the downstream echo is not heard. It applies to direct messages, ACK packets, multipart packets carrying ACK payloads, and TRACE packets. #### View or change direct retry state **Usage:** diff --git a/examples/simple_repeater/MyMesh.cpp b/examples/simple_repeater/MyMesh.cpp index 4765e7af..2afaae2e 100644 --- a/examples/simple_repeater/MyMesh.cpp +++ b/examples/simple_repeater/MyMesh.cpp @@ -574,8 +574,8 @@ uint8_t MyMesh::getDirectRetryCodingRateForSNR(int8_t snr_x4) const { if (!_prefs.direct_retry_cr_enabled) return 0; if (snr_x4 >= _prefs.direct_retry_cr4_snr_x4) return 4; if (snr_x4 >= _prefs.direct_retry_cr5_snr_x4) return 5; - if (snr_x4 >= _prefs.direct_retry_cr7_snr_x4) return 7; if (snr_x4 <= _prefs.direct_retry_cr8_snr_x4) return 8; + if (snr_x4 >= _prefs.direct_retry_cr7_snr_x4) return 7; return 7; } diff --git a/src/Dispatcher.cpp b/src/Dispatcher.cpp index 63112f85..aee81a04 100644 --- a/src/Dispatcher.cpp +++ b/src/Dispatcher.cpp @@ -348,19 +348,23 @@ void Dispatcher::checkSend() { outbound_restore_cr = 0; outbound_restore_preamble_len = 0; uint8_t default_cr = getDefaultTxCodingRate(); + bool using_low_retry_cr = false; if (outbound->tx_cr >= 4 && outbound->tx_cr <= 8 && default_cr >= 4 && default_cr <= 8 && outbound->tx_cr != default_cr) { if (_radio->setCodingRate(outbound->tx_cr)) { outbound_restore_cr = default_cr; + using_low_retry_cr = outbound->tx_cr == 4 || outbound->tx_cr == 5; max_airtime = _radio->getEstAirtimeFor(len)*3/2; } else { MESH_DEBUG_PRINTLN("%s Dispatcher::checkSend(): WARN: failed to set packet CR%d", getLogDateTime(), (uint32_t)outbound->tx_cr); } + } else if (outbound->tx_cr == 4 || outbound->tx_cr == 5) { + using_low_retry_cr = outbound->tx_cr == default_cr; } bool has_direct_path = outbound->getPathHashCount() > 0 || (outbound->getPayloadType() == PAYLOAD_TYPE_TRACE && outbound->payload_len > 9); if (outbound->isRouteDirect() && has_direct_path - && (outbound->tx_cr == 4 || outbound->tx_cr == 5)) { + && using_low_retry_cr) { uint16_t default_preamble_len = _radio->getDefaultPreambleLength(); if (default_preamble_len > 16 && _radio->setPreambleLength(16)) { outbound_restore_preamble_len = default_preamble_len; diff --git a/src/Packet.cpp b/src/Packet.cpp index a542a5a2..3aab6349 100644 --- a/src/Packet.cpp +++ b/src/Packet.cpp @@ -87,4 +87,3 @@ bool Packet::readFrom(const uint8_t src[], uint8_t len) { } } -