mirror of
https://github.com/espressif/esp-idf.git
synced 2026-09-22 13:01:16 +03:00
fix(wifi): Preserve roam_config ABI and clamp roam diff
Append low_rssi_roam_diff so existing struct members keep their offsets, and clamp runtime values to 1-99 so determine_best_ap() cannot see 0 or wrap.
This commit is contained in:
@@ -20,7 +20,6 @@ struct roam_config {
|
||||
bool low_rssi_roam_trigger;
|
||||
int8_t low_rssi_threshold;
|
||||
uint8_t rssi_threshold_reduction_offset;
|
||||
uint8_t low_rssi_roam_diff;
|
||||
bool scan_monitor;
|
||||
#if CONFIG_ESP_WIFI_ROAMING_PERIODIC_SCAN_MONITOR
|
||||
uint8_t scan_interval;
|
||||
@@ -37,6 +36,7 @@ struct roam_config {
|
||||
uint8_t scan_filter_ssid[ROAM_SCAN_FILTER_SSID_LEN];
|
||||
uint8_t scan_filter_bssid[ROAM_SCAN_FILTER_BSSID_LEN];
|
||||
bool scan_filter_bssid_set;
|
||||
uint8_t low_rssi_roam_diff;
|
||||
};
|
||||
|
||||
void roam_init_app(void);
|
||||
|
||||
@@ -70,6 +70,8 @@ static const char *ROAMING_TAG = "ROAM";
|
||||
|
||||
#define RSSI_THRESHOLD_DISABLED -100
|
||||
#define RSSI_THRESHOLD_MAX 10
|
||||
#define LOW_RSSI_ROAM_DIFF_MIN 1
|
||||
#define LOW_RSSI_ROAM_DIFF_MAX 99
|
||||
#define BTM_QUERY_LIST_MAX_LEN (MAX_NEIGHBOR_LEN + 96)
|
||||
#define ROAMING_PENDING_TIMEOUT_USER_DATA_MAX 16
|
||||
|
||||
@@ -160,6 +162,19 @@ static int32_t roaming_app_clamp_rssi_threshold(int threshold)
|
||||
return threshold;
|
||||
}
|
||||
|
||||
static uint8_t roaming_app_clamp_low_rssi_roam_diff(uint8_t diff)
|
||||
{
|
||||
if (diff < LOW_RSSI_ROAM_DIFF_MIN) {
|
||||
return LOW_RSSI_ROAM_DIFF_MIN;
|
||||
}
|
||||
|
||||
if (diff > LOW_RSSI_ROAM_DIFF_MAX) {
|
||||
return LOW_RSSI_ROAM_DIFF_MAX;
|
||||
}
|
||||
|
||||
return diff;
|
||||
}
|
||||
|
||||
static bool roaming_app_scan_cache_is_valid(const struct timeval *now)
|
||||
{
|
||||
if (g_roaming_app.scanned_aps.time.tv_sec == 0 && g_roaming_app.scanned_aps.time.tv_usec == 0) {
|
||||
@@ -2400,6 +2415,8 @@ static int update_config_params(void *data)
|
||||
sizeof(next_scan_filter_bssid)) != 0);
|
||||
|
||||
g_roaming_app.config = *config;
|
||||
g_roaming_app.config.low_rssi_roam_diff =
|
||||
roaming_app_clamp_low_rssi_roam_diff(g_roaming_app.config.low_rssi_roam_diff);
|
||||
memset(g_roaming_app.config.scan_filter_ssid, 0, sizeof(g_roaming_app.config.scan_filter_ssid));
|
||||
memset(g_roaming_app.config.scan_filter_bssid, 0, sizeof(g_roaming_app.config.scan_filter_bssid));
|
||||
g_roaming_app.config.scan_filter_bssid_set = false;
|
||||
|
||||
Reference in New Issue
Block a user