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