From 1808392a1dcdaabc4241241c4f2bb1ad6cd2f7e6 Mon Sep 17 00:00:00 2001 From: Simone Margaritelli <evilsocket@gmail.com> Date: Sun, 13 Oct 2019 17:40:30 +0200 Subject: [PATCH] misc: small fix or general refactoring i did not bother commenting --- pwnagotchi/mesh/wifi.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pwnagotchi/mesh/wifi.py b/pwnagotchi/mesh/wifi.py index 93fe9ab..3bc714b 100644 --- a/pwnagotchi/mesh/wifi.py +++ b/pwnagotchi/mesh/wifi.py @@ -1 +1,12 @@ NumChannels = 140 + + +def freq_to_channel(freq): + if freq <= 2472: + return int(((freq - 2412) / 5) + 1) + elif freq == 2484: + return int(14) + elif 5035 <= freq <= 5865: + return int(((freq - 5035) / 5) + 7) + else: + return 0