- Fri Apr 05, 2019 5:31 am
#81577
Code: Select all- can anybody think of a more elegant way to check the bssid value? is memcmp with "\0\0\0\0\0\0" the most elegant way? I initially used a union with a uint64_t but this took up valuable space in the RTC memory
don't think this is what you are looking for but anyway:
when comparing MAC addresses efficiently I'd write a custom function that checks from the 6th to the 1st byte
in your scenario it's very likely that city provided wifi will use same vendor equipment and so the first 3 bytes of the MAC will be the same
Code: Select all- when the fast connection fails for the first time, I see a message in the debug info that says 'scandone'. This is what is printed at the end of a channel scan. So I was wondering if anybody knew if the SDK automatically does a channel scan when a connection fails? Perhaps I don't need all my fallbacks?
I think this is because you drop the channel and next connection trial will have necessarily to perform a full scan.
The figures you pointed out (about 10 seconds for a full scan) make sense to me.
Performing a generic active scan means you have to change the channel for sending probe-any requests and,
I may be wrong, this is usually done scanning each channel for 30 ms per seconds leading to a total time around 10s if the RF finds 11 channels.
Why do you wait 1 second before checking for the next channel?
Cause while performing a generic scan you want to guarantee that the wifi keeps operating with no traffic drop.
I mean you wanna keep the effective scan time (on a channel different by the working one) a very little (3% in the example above) percentage of the wifi working time.
I don't see any reason why Espressif should do anything different.
But your scenario is totally different, I'm guessing you don't care about traffic while performing the scan just because there is none.
Then you should perform your custom scan tuning the wifi_ative_scan_time using the sdk structures below and optimize the way you connect to AP to something like this (just for saying ...)
1) try the fast connection
2) on fail of point 1 => perform custom scan on 1,6,11 (or whatever) and connect to the SSID with best rssi
3) on fail of point 2 => perform custom scan on all channels and connect to the SSID with best rssi
by the way you got me curious and I think I will perform some measure of the scan times playing with custom scan parameters ...
Code: Select alltypedef enum {
WIFI_SCAN_TYPE_ACTIVE = 0, /**< active scan */
WIFI_SCAN_TYPE_PASSIVE, /**< passive scan */
} wifi_scan_type_t;
/** @brief Range of active scan times per channel */
typedef struct {
uint32_t min; /**< minimum active scan time per channel, units: millisecond */
uint32_t max; /**< maximum active scan time per channel, units: millisecond, values above 1500ms may
cause station to disconnect from AP and are not recommended. */
} wifi_active_scan_time_t;
/** @brief Aggregate of active & passive scan time per channel */
typedef union {
wifi_active_scan_time_t active; /**< active scan time per channel, units: millisecond. */
uint32_t passive; /**< passive scan time per channel, units: millisecond, values above 1500ms may
cause station to disconnect from AP and are not recommended. */
} wifi_scan_time_t;
struct scan_config {
uint8 *ssid; // Note: ssid == NULL, don't filter ssid.
uint8 *bssid; // Note: bssid == NULL, don't filter bssid.
uint8 channel; // Note: channel == 0, scan all channels, otherwise scan set channel.
uint8 show_hidden; // Note: show_hidden == 1, can get hidden ssid routers' info.
wifi_scan_type_t scan_type; // scan type, active or passive
wifi_scan_time_t scan_time; // scan time per channel
};
https://github.com/quackmore