diff --git a/components/esp_wifi/wifi_apps/roaming_app/include/esp_roaming.h b/components/esp_wifi/wifi_apps/roaming_app/include/esp_roaming.h index dff094c3b8..28ccb7a79e 100644 --- a/components/esp_wifi/wifi_apps/roaming_app/include/esp_roaming.h +++ b/components/esp_wifi/wifi_apps/roaming_app/include/esp_roaming.h @@ -16,9 +16,11 @@ struct roam_config { int8_t low_rssi_threshold; uint8_t rssi_threshold_reduction_offset; bool scan_monitor; +#if CONFIG_ESP_WIFI_ROAMING_PERIODIC_SCAN_MONITOR uint8_t scan_interval; int8_t scan_rssi_threshold; uint8_t scan_rssi_diff; +#endif bool legacy_roam_enabled; uint8_t btm_retry_cnt; bool btm_roaming_enabled; diff --git a/components/esp_wifi/wifi_apps/roaming_app/src/esp_roaming_i.h b/components/esp_wifi/wifi_apps/roaming_app/src/esp_roaming_i.h index 4afda4c0aa..29d3effc5b 100644 --- a/components/esp_wifi/wifi_apps/roaming_app/src/esp_roaming_i.h +++ b/components/esp_wifi/wifi_apps/roaming_app/src/esp_roaming_i.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2023-2024 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2023-2025 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -22,12 +22,18 @@ extern "C" { #define ROAMING_BACKOFF_TIME CONFIG_ESP_WIFI_ROAMING_BACKOFF_TIME /* Low RSSI based roaming configuration */ +#ifndef CONFIG_ESP_WIFI_ROAMING_LOW_RSSI_ROAMING +#define CONFIG_ESP_WIFI_ROAMING_LOW_RSSI_ROAMING 0 +#endif #define LOW_RSSI_ROAMING_ENABLED CONFIG_ESP_WIFI_ROAMING_LOW_RSSI_ROAMING #if LOW_RSSI_ROAMING_ENABLED #define ROAMING_LOW_RSSI_THRESHOLD CONFIG_ESP_WIFI_ROAMING_LOW_RSSI_THRESHOLD #define RSSI_THRESHOLD_REDUCTION_OFFSET CONFIG_ESP_WIFI_ROAMING_LOW_RSSI_OFFSET #endif /*LOW_RSSI_ROAMING_ENABLED*/ +#ifndef CONFIG_ESP_WIFI_ROAMING_PERIODIC_SCAN_MONITOR +#define CONFIG_ESP_WIFI_ROAMING_PERIODIC_SCAN_MONITOR 0 +#endif /* Periodic Scan based Roaming configuration */ #define PERIODIC_SCAN_MONITORING CONFIG_ESP_WIFI_ROAMING_PERIODIC_SCAN_MONITOR #if PERIODIC_SCAN_MONITORING diff --git a/components/esp_wifi/wifi_apps/roaming_app/src/roaming_app.c b/components/esp_wifi/wifi_apps/roaming_app/src/roaming_app.c index 2934e7f1d4..c7b84d5c0f 100644 --- a/components/esp_wifi/wifi_apps/roaming_app/src/roaming_app.c +++ b/components/esp_wifi/wifi_apps/roaming_app/src/roaming_app.c @@ -625,9 +625,8 @@ static void periodic_rrm_request(struct timeval *now) static bool candidate_security_match(wifi_ap_record_t candidate) { - u8 transition_disable = wpa_supplicant_get_transition_disable(); - #if CONFIG_ESP_WIFI_ROAMING_PREVENT_DOWNGRADE + u8 transition_disable = wpa_supplicant_get_transition_disable(); if (transition_disable & TRANSITION_DISABLE_WPA3_PERSONAL) { if (candidate.authmode == WIFI_AUTH_WPA2_PSK) { return false; @@ -968,9 +967,11 @@ static esp_err_t init_config_params(void) g_roaming_app.config.rssi_threshold_reduction_offset = RSSI_THRESHOLD_REDUCTION_OFFSET; g_roaming_app.config.scan_monitor = PERIODIC_SCAN_MONITORING; +#if PERIODIC_SCAN_MONITORING g_roaming_app.config.scan_interval = SCAN_MONITOR_INTERVAL; g_roaming_app.config.scan_rssi_threshold = SCAN_MONITOR_RSSI_THRESHOLD; g_roaming_app.config.scan_rssi_diff = SCAN_ROAM_RSSI_DIFF; +#endif /* PERIODIC_SCAN_MONITORING */ g_roaming_app.config.legacy_roam_enabled = LEGACY_ROAM_ENABLED; g_roaming_app.config.btm_retry_cnt = BSS_TM_RETRY_COUNT; @@ -986,9 +987,11 @@ static esp_err_t init_config_params(void) g_roaming_app.config.backoff_time, g_roaming_app.config.low_rssi_roam_trigger, g_roaming_app.config.low_rssi_threshold, g_roaming_app.config.rssi_threshold_reduction_offset); +#if PERIODIC_SCAN_MONITORING ESP_LOGD(ROAMING_TAG, "scan_monitor=%d scan_interval=%d scan_rssi_threshold=%d scan_rssi_diff=%d", g_roaming_app.config.scan_monitor, g_roaming_app.config.scan_interval, g_roaming_app.config.scan_rssi_threshold, g_roaming_app.config.scan_rssi_diff); +#endif /* PERIODIC_SCAN_MONITORING */ ESP_LOGD(ROAMING_TAG, "legacy_roam_enabled=%d, btm_retry_cnt=%d btm_roaming_enabled=%d", g_roaming_app.config.legacy_roam_enabled, @@ -1179,9 +1182,11 @@ static int update_config_params(void *data) g_roaming_app.config.backoff_time, g_roaming_app.config.low_rssi_roam_trigger, g_roaming_app.config.low_rssi_threshold, g_roaming_app.config.rssi_threshold_reduction_offset); +#if PERIODIC_SCAN_MONITORING ESP_LOGI(ROAMING_TAG, "scan_monitor=%d scan_interval=%d scan_rssi_threshold=%d scan_rssi_diff=%d", g_roaming_app.config.scan_monitor, g_roaming_app.config.scan_interval, g_roaming_app.config.scan_rssi_threshold, g_roaming_app.config.scan_rssi_diff); +#endif ESP_LOGI(ROAMING_TAG, "legacy_roam_enabled=%d, btm_retry_cnt=%d btm_roaming_enabled=%d", g_roaming_app.config.legacy_roam_enabled, diff --git a/examples/wifi/roaming/roaming_11kvr/main/roaming_example.c b/examples/wifi/roaming/roaming_11kvr/main/roaming_example.c index edf0669494..d108cca8fe 100644 --- a/examples/wifi/roaming/roaming_11kvr/main/roaming_example.c +++ b/examples/wifi/roaming/roaming_11kvr/main/roaming_example.c @@ -325,7 +325,7 @@ static void esp_neighbor_report_recv_handler(void* arg, esp_event_base_t event_b g_neighbor_report_active = false; uint8_t cand_list = 0; wifi_event_neighbor_report_t *neighbor_report_event = (wifi_event_neighbor_report_t*)event_data; - uint8_t *pos = (uint8_t *)neighbor_report_event->report; + uint8_t *pos = (uint8_t *)neighbor_report_event->n_report; char * neighbor_list = NULL; if (!pos) { ESP_LOGE(TAG, "Neighbor report is empty");