Repository navigation
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the hardcoded 4-second CAD-busy timeout in
Dispatcher::getCADFailMaxDuration()with a persisted, tunable count of full-size (255-byte) packet airtimes computed from the current LoRa settings. Addsget cad.wait.packets/set cad.wait.packets <n>to the shared radio CLI.4packets (≈4 s at SF10 / BW250)1–16Motivation
A fixed 4000 ms wait does not scale with radio settings. At slow spreading factors / narrow bandwidths a single full-size packet can take seconds on the air, so the old timeout could force a TX while the channel was still busy. At fast settings it held transmissions off much longer than necessary. Expressing the wait as a number of packet airtimes makes it adapt automatically to the configured SF, BW and CR.
Changes
Core —
src/Dispatcher.{h,cpp}getCADFailMaxDuration()now returnscalcCADFailMaxDuration(*_radio, getCADFailWaitPackets())instead of4000.Dispatcher::calcCADFailMaxDuration(Radio&, uint32_t)so the Dispatcher and the CLI use one shared formula.getCADFailWaitPackets()defaults to4, so builds without CLI prefs (KISS modem, secure chat) keep sensible behavior.CLI —
src/helpers/CommonRadioPrefs.{h,cpp}getCADWaitPackets()/setCADWaitPackets(uint8_t)to the radio prefs interface, plusgetCADFailWaitMs().get cad.wait.packetsreports the computed timeout in milliseconds, with packet count and per-packet airtime.set cad.wait.packets <n>validates the range, persists the value and echoes the resulting timeout.Persistence
cad_wait_packets = 4with JSON keyradio.cad_wait_pktsto bothNodePrefsclasses (companion radio andCommonCLI).prefs.jsonfiles without the new key load with the default of4. Changes are saved through the existing dirty-prefs flow.Firmware overrides
MyMesh, repeaterMyMesh, room serverMyMeshandSensorMeshnow overridegetCADFailMaxDuration()and return the prefs-derived value.Docs and tests
docs/cli_commands.md.test/test_companion_node_prefs/.Example