On 09/11/17 18:38, Mark Webb-Johnson wrote:
I’ve committed a change to the esp32wifi component, to try to support a promiscuous mode for the wifi client. This should make it work the way it does on cellphones, computers, and pretty much all equipment. Rather than specifying a specific wifi AP to connect to, it just connects to whichever it can (based on where it has connected to in the past).
Nice! This is much better than the terrible network manager I wrote. If you trigger it from a startup script then it never connects because monotonictime is 0 which doesn't pass the test in EventTimer10(). I'm running with the following patch, but you might want to start monotonictime at 1, or not overload a boolean into m_nextscan. diff --git a/vehicle/OVMS.V3/components/esp32wifi/esp32wifi.cpp b/vehicle/OVMS.V3/components/esp32wifi/esp32wifi.cpp index 236f4c9..c6ebcd4 100644 --- a/vehicle/OVMS.V3/components/esp32wifi/esp32wifi.cpp +++ b/vehicle/OVMS.V3/components/esp32wifi/esp32wifi.cpp @@ -262,7 +262,9 @@ void esp32wifi::StartScanningClientMode() memset(&m_wifi_apsta_cfg,0,sizeof(m_wifi_apsta_cfg)); ESP_ERROR_CHECK(esp_wifi_start()); - m_nextscan = monotonictime; + // if we are triggered by a startup script, monotonictime will be zero which + // won't pass the test in EventTimer10() + m_nextscan = monotonictime == 0 ? 1 : monotonictime; } void esp32wifi::StartAccessPointMode(std::string ssid, std::string password) If there is a network in range that has the same name as a network that is saved but has a different password, the client never tries the next network. Instead it tries to connect to the "fake" network over and over and over. It appears to use the network that is alphabetically first in the list, which isn't good if it knows about an AndroidAP and there happens to be someone else's AndroidAP switched on while you're trying to connect to a network with a name that doesn't start with A.