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.radio.start_ap() new kwarg: max_connections #6022

Merged
merged 3 commits into from
Feb 14, 2022
Merged

wifi.radio.start_ap() new kwarg: max_connections #6022

merged 3 commits into from
Feb 14, 2022

Conversation

anecdata
Copy link
Member

@anecdata anecdata commented Feb 12, 2022

This PR is somewhat independent of #5915, though extra internal RAM never hurts. Each Station connection to the Access Point uses an additional ~1.5KB. Even on an ESP32-S2-DevKitC-1-N4R2, A simple AP running with 10 connections should have about 50KB of free espidf memory (a simple AP with no connections has about 65KB free).

This max_connections value was hard-coded to 4 in the released code, which was Espressif's default setting. Now it can go from 0 to 10 (Espressif's full supported range), with default (without the kwarg) remaining at 4. There are use cases for 0; creating an AP to which no connections can be made. An exception is raised for values outside the range.

Although we can't have this many simultaneous sockets (with or without #6021), more Station devices could stay connected to the AP and use UDP or sometimes-connected TCP, assuming they had appropriate exception-handling for when the AP refused the connection.

Tested the 0 case using a phone as Station and got an unable to connect dialog as expected. A CircuitPython device connecting to an AP with max_connections=0 will get a ConnectionError: Unknown failure 205, which is a general Espressif wifi error code. Progressively tested 8 simultaneous connections on an esp32s3_devkitc_1_n8r2, with 8 separate ESP32-S2 and ESP32-S3 Stations.

@anecdata anecdata added the espressif applies to multiple Espressif chips label Feb 12, 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.

Thanks for adding this! One request

shared-bindings/wifi/Radio.c Outdated Show resolved Hide resolved
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.

Thank you!

@tannewt tannewt merged commit d4c2ffe into adafruit:main Feb 14, 2022
@anecdata anecdata deleted the more_ap_connections branch February 14, 2022 18:43
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