ota_mesh_push.py: airtime of a LoRa frame multiplied the coded payload by CR, not CR + 4 -- ~3x too little, --duty 3 let ~9 % through

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
tthandClaude Opus 5.5 committed 2026-11-14 20:53:02 +01:00
1 parent 9c4bdcae42
commit 4a4d4b169f
1 file changed
+4 -1
+4 -1
View File
@@ -162,8 +162,11 @@ def lora_airtime(n: int, sf: int, bw_khz: float, cr: int, preamble: int = 16) ->
"""Seconds on air for an n-byte LoRa frame (explicit header, CRC on)."""
tsym = (2**sf) / (bw_khz * 1000)
de = 1 if tsym > 0.016 else 0
# Semtech AN1200.13: ceil(...) * (CR + 4), CR = 1..4 for 4/5..4/8. Until
# 14. 11. 2026 this multiplied by CR alone: ~3x too little airtime at 4/5,
# so --duty 3 let about 9 % through.
payload = 8 + max(
math.ceil((8 * n - 4 * sf + 28 + 16) / (4 * (sf - 2 * de))) * cr, 0
math.ceil((8 * n - 4 * sf + 28 + 16) / (4 * (sf - 2 * de))) * (cr + 4), 0
)
return (preamble + 4.25) * tsym + payload * tsym