Replies: 3 comments 1 reply
-
Dropping and recreating everything is definitely something that should work. Setting a new config should also work but you need to disconnect first and call connect afterwards. However, the networking stack needs a reset (if the stack can't figure that out on itself - I think embassy-net should be able to figure it out on itself) |
Beta Was this translation helpful? Give feedback.
-
OK, so I had to put this aside for a while, but I am back on it now. Here's the issues that I am dealing with: The specific issue I am having is this: if I hard-code an SSID and PASSWORD into the executable and try to connect, everything works as expected - I can get an IP address and do the HTTP GET. However, if I try to scan for an open wifi first, I can successfully get an SSID, but afterwards I'm unable to get an IP address. That is, using the SSID I got from the scan, I am able to set the new configuration, open a connection, and get the network stack up, but then when it tries to get an IP address it just loops forever. The networking stack shouldn't need to be reset because it hasn't been created until after the wifi scan is done. Calling controller.disconnect() or controller.stop() after doing the scan doesn't seem to have any effect. Dropping the wifi controller entirely is a problem, because this requires not only re-initializing the wifi controller, but re-initializing peripherals as well - since you can't re-use the peripherals.WIFI value since it was moved in the init. |
Beta Was this translation helpful? Give feedback.
-
Setting a new configuration should just work - I agree the docs could be improved and finding that information elsewhere is not easy (something we definitely plan to improve) Dropping the controller to tear down the WiFi stack is an option and @yanshay is right - you should be able to pass an exclusive reference instead of moving the peripheral into the driver (which is generally true for all/most drivers) |
Beta Was this translation helpful? Give feedback.
-
I'm attempting to do a wifi scan (using
WifiController::scan_n_async
), and then establish a connection based on what I find. In order to do a scan, I need to start the wifi controller. The result of the scan is a newConfiguration
which would then be pass in viaset_configuration()
. What I can't seem to figure out (and I've spent a couple days searching for information) is whether it is legal to simply set a new configuration while the controller is started, or whether I have to shut down the controller (or perhaps even create a brand new controller instance) in order to set the new configuration.The broader question is: which controller methods are valid in particular states? The Rust docs don't say, and while the Espressif C docs talk about this a little bit, it's hard to map the C methods to the Rust methods.
Beta Was this translation helpful? Give feedback.
All reactions