Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WiFi Monitor: improve channel validation #5996

Merged
merged 3 commits into from Feb 9, 2022
Merged

WiFi Monitor: improve channel validation #5996

merged 3 commits into from Feb 9, 2022

Conversation

anecdata
Copy link
Member

@anecdata anecdata commented Feb 8, 2022

Test code:

import wifi

# new check in monitor.channel
monitor = wifi.Monitor()
for channel in range(-1, 16):
    try:
        monitor.channel = channel
        print(monitor.channel, "channel OK")
    except ValueError as e:
        print(channel, e)

print()

# corrected check in wifi.Monitor(channel=)
for channel in range(-1, 16):
    try:
        monitor = wifi.Monitor(channel=channel)
        print(monitor.channel, "channel OK")
        monitor.deinit()
    except ValueError as e:
        print(channel, e)

Result (same for both loops):

code.py output:
-1 channel out of bounds
0 channel out of bounds
1 channel OK
2 channel OK
3 channel OK
4 channel OK
5 channel OK
6 channel OK
7 channel OK
8 channel OK
9 channel OK
10 channel OK
11 channel OK
12 channel OK
13 channel OK
14 channel out of bounds
15 channel out of bounds

@anecdata anecdata added the espressif applies to multiple Espressif chips label Feb 8, 2022
Copy link
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thank you!

@tannewt tannewt merged commit 88b000f into adafruit:main Feb 9, 2022
@anecdata anecdata deleted the channel_validate branch February 9, 2022 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
espressif applies to multiple Espressif chips
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants