From 4a4d4b169f6077894194a738e9794016de2e7ec4 Mon Sep 17 00:00:00 2001 From: TeTeHacko Date: Sat, 14 Nov 2026 20:53:02 +0100 Subject: [PATCH] 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 --- tools/ota_mesh_push.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/ota_mesh_push.py b/tools/ota_mesh_push.py index dd85ae01..614dfa47 100755 --- a/tools/ota_mesh_push.py +++ b/tools/ota_mesh_push.py @@ -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