Skip to content

Respect dynamic CR in transmit timing#38

Open
robekl wants to merge 3 commits intoweebl2000:snr-drives-crfrom
robekl:fix/dynamic-cr-transmit-delays-v2
Open

Respect dynamic CR in transmit timing#38
robekl wants to merge 3 commits intoweebl2000:snr-drives-crfrom
robekl:fix/dynamic-cr-transmit-delays-v2

Conversation

@robekl
Copy link
Copy Markdown

@robekl robekl commented Mar 11, 2026

This patch makes transmit timing respect dynamic coding rate (CR) instead of assuming the node's default CR.

What Changed

  • Added a shared estimateTxAirtimeFor(...) hook in Dispatcher so timing paths can use a per-packet CR when one is selected.
  • Updated retransmit delay and send-expiry calculations to use _tx_cr.
  • Updated direct-send timeout estimation to set _tx_cr before estimating airtime, so sender-side timing reflects the selected first-hop dynamic CR.
  • Added exact LoRa airtime overrides in the mesh implementations that know their active SF/BW/CR (companion, repeater, room_server, sensor, and simple_secure_chat).
  • Synchronized setDefaultCR(...) anywhere runtime radio parameters are applied or restored.

Why This Satisfies the Goal

The goal was to update retransmit delay and transmit-duration calculations based on dynamic CR.

This patch does that by making:

  • retransmit delays use the effective per-packet CR
  • dispatcher transmit-expiry timing use the effective per-packet CR
  • direct-send timeout estimates use the selected first-hop CR when that CR is actually knowable

Notes

  • Airtime estimation does not mutate live radio state.
  • Sender-side multi-hop timeout estimation is only exact for the local hop, because downstream repeater CR choices are not knowable in advance.

weebl2000 and others added 3 commits March 9, 2026 13:56
When a repeater forwards a direct-routed pkt, it looks up the next-hop
neighbor's SNR, computes the link margin against the SF-specific
demodulation floor, then determines coding rate (RT) based on SNR.
Weaker links get higher CR. We apply CR on a per-packet basis and
restore to default configuration after TX.

Margin thresholds:
<3 dB   - CR 4/8
3-6 dB  - CR 4/7
6-10 dB - CR 4/6
>=10 dB - CR 4/5

Flood repeats adhere to configured CR, as do forwards to unknown
neighbors.
@weebl2000
Copy link
Copy Markdown
Owner

Thank you, I will have a look at this over the weekend most likely!

@weebl2000 weebl2000 force-pushed the snr-drives-cr branch 2 times, most recently from 88f5888 to bf7a82b Compare April 4, 2026 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants