-
Notifications
You must be signed in to change notification settings - Fork 1.3k
ESP32S2: Reset sta_mode and ap_mode flags #3580
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
Conversation
Forgot to mention that in the original issue I mentioned I was seeing a hard crash - I'm still seeing that after this fix, so it seems like building with |
I'm testing your fix and my WLAN join works, but I'm still not able to reliably do a get. Can you see if this is true for you as well. You need the import socketpool
import ssl
import wifi
import adafruit_requests
radio = wifi.radio
pool = socketpool.SocketPool(radio)
requests = adafruit_requests.Session(pool, ssl.create_default_context())
response = requests.get("http://wifitest.adafruit.com/testwifi/index.html")
print(response.status_code)
print(response.text) I init my network in an earlier setup.
|
@askpatrickw I haven't tested requests just yet, but I did notice just now that if I connect to an AP, and then just ping in a loop, I get about 18-20 iterations before the espidf memory stats get dire and things just fail. At this point I'm wondering if what you're seeing and #3562 are the same thing and there's something not getting cleared on the espidf side during all of this. If I just print out
Late edit: I did follow up, and I was able to run 250 requests in a row (and still going) but memory usage on the circuitpython side is ticking up steadily, so at least what I'm seeing is likely that other issue. |
Doesn't seem to be out of memory, just no socket and on the first call. |
I implemented this PR on a saola_wrover-- seems to still work OK - after reboot.
the test code is:
|
hmm -- testing on the umfeathers2, I am occasionally getting this error
I have not see this yet on the wrover, but both failures are intermittent. Sometimes it runs fine. |
Followup on "ping" issue using this code
|
@jerryneedell I noticed that the |
Anyone concerned that this fix is a regression? The issues above seem like ones that may exist without this fix. |
@tannewt I think the other things above are variations on the theme "really weird stuff can happen when the ESP heap gets too fragmented or just plain runs out" at least based on what I've seen so far, but I don't have a good understanding on why different behaviors are seen for different folks/boards to be honest. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Should close #3576.
I opted to set both
ap_mode
andsta_mode
flags incommon_hal_wifi_init
to False just to start from a clean slate every time, since at that point things aren't properly configured for either mode anyways. I think technically settingsta_mode
to True might be legit after the call toesp_netif_create_default_wifi_sta
but it's functionally not useful until after you load in the config so to me it seems debatable. I at least added a comment to that effect as a reminder for the next brave soul mucking about in there.These could be removed in favor of just using
esp_wifi_get_mode
and checking what comes back, but that requires an esp-idf call whereas it seems simple enough to just carry around the bool flags for now. If things get more complicated in there it might be worth doing though.