From de5cd8705fed417deea609c8e0f9005fea4bd93d Mon Sep 17 00:00:00 2001 From: Jeroen Oudshoorn Date: Sat, 4 Jan 2025 15:55:19 +0100 Subject: [PATCH] Update for better wifi channel calculation Signed-off-by: Jeroen Oudshoorn --- pwnagotchi/mesh/wifi.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pwnagotchi/mesh/wifi.py b/pwnagotchi/mesh/wifi.py index 10a91037..3610bd17 100644 --- a/pwnagotchi/mesh/wifi.py +++ b/pwnagotchi/mesh/wifi.py @@ -1,5 +1,3 @@ -NumChannels: int = 233 - def freq_to_channel(freq: float) -> int: """ Convert a Wi-Fi frequency (in MHz) to its corresponding channel number. @@ -16,8 +14,10 @@ def freq_to_channel(freq: float) -> int: return 14 # 5 GHz Wi-Fi channels elif 5150 <= freq <= 5850: # 5 GHz Wi-Fi - if freq < 5270: # Channels 36-48 + if 5150 <= freq <= 5350: # Channels 36-64 return int(((freq - 5180) / 20) + 36) + elif 5470 <= freq <= 5725: # Channels 100-144 + return int(((freq - 5500) / 20) + 100) else: # Channels 149-165 return int(((freq - 5745) / 20) + 149) # 6 GHz Wi-Fi channels