-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
ESP32S2: implement API for Access Point mode #4246
Comments
I think this would go on the wifi.Radio object |
Does CP in general support AP mode or is this an ESP32 S2 limitation? This is an issue because AP mode allows for wifi credentials to be updated. |
CP doesn't have an API for it yet. It is not an ESP32-S2 limitation. |
I am also attempting to create an AP using CP on a FeatherS2 as well and tried this approach based on the example code in the message coming back is always I noticed that some of the examples have pins defined by
|
@matthewjerome The ESP32SPI library is only for Airlift configurations, where an ESP32 is used as the wifi co-processor (e.g., PyPortal). It is not for use with the native ESP32-S2 networking. |
@anecdata thank you for clarifying - this makes sense now |
Is anyone thinking about this, or working on it? Espressif has a basic example: I think we would need in
In
STA mode may be a little embedded in the current logic flow, and some things may have to get moved. Also some thought is needed on whether STA and AP could be turned on and off independently without affecting the other (I'm not even sure if this is possible with the API), or whether code would enforce mode setting only from a clean init. We don't want AP to start unless directed by user code. There may also be some complications with scanning (currently requires STA or STA+AP). |
@anecdata I don't know of anyone. It'd be cool to see it added. |
Some other considerations: API:
STA vs. STA+AP vs. AP:
Other:
|
Super-rough and early proof-of-concept. I'll make a draft PR, still many questions on architecture, API, and implementation. It gets complex pretty fast, it would be great to collaborate with someone knowledgeable about the core and wifi. import wifi
import ipaddress
import socketpool
from secrets import secrets
# this STA connects to an AP
print("STA MAC", ":".join("%02X" % _ for _ in wifi.radio.mac_address))
print(f"Enabled? {wifi.radio.enabled}")
print("Connected?", end=" ")
wifi.radio.connect(secrets["ssid"], secrets["password"])
print(bool(wifi.radio.ipv4_address))
# get some sockets
pool = socketpool.SocketPool(wifi.radio)
# ping
ipv4 = ipaddress.ip_address(pool.getaddrinfo(secrets['host'], 443)[0][4][0])
print(f"wan ping: {wifi.radio.ping(ipv4)} ms")
# this STA becomes a STA+SoftAP
wifi.radio.start_ap("Bob", "abcd1234")
print("AP MAC", ":".join("%02X" % _ for _ in wifi.radio.mac_address_ap))
print("Waiting for connection to this SoftAP...")
while True:
pass # wait for STAs to connect CircuitPython:
ESP_LOG:
|
@anecdata Great work on this. I'm following your pull request and look forward to helping with testing. |
@RWhite-EDR Actually you could starting know if you download the firmware built for your particular board in the PR Here If you already knew ignore the previous message 😄 |
Implement API to run an Access Point on the S2 instead of connecting to one.
Just to track the feature request.
The text was updated successfully, but these errors were encountered: