From ded15ea43d7a7bcfb1b0711c38fd7c026b7aa9e6 Mon Sep 17 00:00:00 2001 From: Lloyd Date: Sun, 8 Feb 2026 09:44:20 +0000 Subject: [PATCH] Fix bandwidth calculation in calculate_airtime method for accurate airtime estimation --- repeater/airtime.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/repeater/airtime.py b/repeater/airtime.py index bd8ae26..b1f0040 100644 --- a/repeater/airtime.py +++ b/repeater/airtime.py @@ -53,17 +53,17 @@ class AirtimeManager: Airtime in milliseconds """ sf = spreading_factor or self.spreading_factor - bw_khz = (bandwidth_hz or self.bandwidth) / 1000 + bw_hz = (bandwidth_hz or self.bandwidth) cr = coding_rate or self.coding_rate preamble_len = preamble_len or self.preamble_length crc = 1 if crc_enabled else 0 h = 0 if explicit_header else 1 # H=0 for explicit, H=1 for implicit # Low data rate optimization: required for SF11/SF12 at 125kHz - de = 1 if (sf >= 11 and bandwidth_hz <= 125000) else 0 + de = 1 if (sf >= 11 and bw_hz <= 125000) else 0 # Symbol time in milliseconds: T_sym = 2^SF / BW_kHz - t_sym = (2 ** sf) / bw_khz + t_sym = (2 ** sf) / (bw_hz / 1000) # Preamble time: T_preamble = (n_preamble + 4.25) * T_sym t_preamble = (preamble_len + 4.25) * t_sym