mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-31 03:07:21 +02:00
fix(esp_wifi): Some more cleanup for roaming app
This commit is contained in:
@ -113,8 +113,8 @@ static void wifi_default_action_sta_connected(void *arg, esp_event_base_t base,
|
||||
|
||||
static void wifi_default_action_sta_disconnected(void *arg, esp_event_base_t base, int32_t event_id, void *data)
|
||||
{
|
||||
wifi_event_sta_disconnected_t *disconn = data;
|
||||
#ifdef ESP_WIFI_NETWORK_ASSISTED_ROAMING_IP_RENEW_SKIP
|
||||
wifi_event_sta_disconnected_t *disconn = data;
|
||||
if (disconn->reason == WIFI_REASON_ROAMING) {
|
||||
roaming_ongoing = true;
|
||||
/* do nothing else */
|
||||
|
@ -6,12 +6,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "sdkconfig.h"
|
||||
#include "esp_log.h"
|
||||
#include "esp_err.h"
|
||||
#include "esp_wifi_types.h"
|
||||
#include "utils/common.h"
|
||||
#include <sys/time.h>
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@ -19,18 +13,18 @@ extern "C" {
|
||||
struct roam_config {
|
||||
uint8_t backoff_time;
|
||||
bool low_rssi_roam_trigger;
|
||||
uint8_t low_rssi_threshold;
|
||||
int8_t low_rssi_threshold;
|
||||
uint8_t rssi_threshold_reduction_offset;
|
||||
bool scan_monitor;
|
||||
uint8_t scan_interval;
|
||||
uint8_t scan_rssi_threshold;
|
||||
int8_t scan_rssi_threshold;
|
||||
uint8_t scan_rssi_diff;
|
||||
bool legacy_roam_enabled;
|
||||
uint8_t btm_retry_cnt;
|
||||
bool btm_roaming_enabled;
|
||||
bool rrm_monitor;
|
||||
uint8_t rrm_monitor_time;
|
||||
uint8_t rrm_monitor_rssi_threshold;
|
||||
int8_t rrm_monitor_rssi_threshold;
|
||||
wifi_scan_config_t scan_config;
|
||||
};
|
||||
|
||||
@ -38,6 +32,8 @@ void init_roaming_app(void);
|
||||
void deinit_roaming_app(void);
|
||||
void roaming_app_disable_reconnect(void);
|
||||
void roaming_app_enable_reconnect(void);
|
||||
esp_err_t roam_get_config_params(struct roam_config *config);
|
||||
esp_err_t roam_set_config_params(struct roam_config *config);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -919,6 +919,7 @@ void deinit_roaming_app(void)
|
||||
}
|
||||
}
|
||||
|
||||
/* No need for this to be done in pptask ctx */
|
||||
esp_err_t roam_get_config_params(struct roam_config *config)
|
||||
{
|
||||
memcpy(config, &g_roaming_app.config, sizeof(*config));
|
||||
@ -926,46 +927,41 @@ esp_err_t roam_get_config_params(struct roam_config *config)
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t roam_set_config_params(struct roam_config *config)
|
||||
static int update_config_params(void *data)
|
||||
{
|
||||
g_roaming_app.config.backoff_time = config->backoff_time;
|
||||
struct roam_config *config = data;
|
||||
g_roaming_app.config = *config;
|
||||
|
||||
g_roaming_app.config.low_rssi_roam_trigger = config->low_rssi_roam_trigger;
|
||||
g_roaming_app.config.low_rssi_threshold = config->low_rssi_threshold;
|
||||
g_roaming_app.config.rssi_threshold_reduction_offset = config->rssi_threshold_reduction_offset;
|
||||
ESP_LOGI(ROAMING_TAG, "Updated Roaming app config :");
|
||||
|
||||
g_roaming_app.config.scan_monitor = config->scan_monitor;
|
||||
g_roaming_app.config.scan_interval = config->scan_interval;
|
||||
g_roaming_app.config.scan_rssi_threshold = config->scan_rssi_threshold;
|
||||
g_roaming_app.config.scan_rssi_diff = config->scan_rssi_diff;
|
||||
|
||||
g_roaming_app.config.legacy_roam_enabled = config->legacy_roam_enabled;
|
||||
g_roaming_app.config.btm_retry_cnt = config->btm_retry_cnt;
|
||||
g_roaming_app.config.btm_roaming_enabled = config->btm_roaming_enabled;
|
||||
|
||||
g_roaming_app.config.rrm_monitor = config->rrm_monitor;
|
||||
g_roaming_app.config.rrm_monitor_time = config->rrm_monitor_time;
|
||||
g_roaming_app.config.rrm_monitor_rssi_threshold = config->rrm_monitor_rssi_threshold;
|
||||
g_roaming_app.config.scan_config = config->scan_config;
|
||||
|
||||
ESP_LOGD(ROAMING_TAG, "Updated Roaming app config :");
|
||||
|
||||
ESP_LOGD(ROAMING_TAG, "backoff time=%d low_rssi_roam_trigger=%d low_rssi_threshold=%d rssi_threshold_reduction_offset=%d",
|
||||
ESP_LOGI(ROAMING_TAG, "backoff time=%d low_rssi_roam_trigger=%d low_rssi_threshold=%d rssi_threshold_reduction_offset=%d",
|
||||
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);
|
||||
|
||||
ESP_LOGD(ROAMING_TAG, "scan_monitor=%d scan_interval=%d scan_rssi_threshold=%d scan_rssi_diff=%d",
|
||||
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);
|
||||
|
||||
ESP_LOGD(ROAMING_TAG, "legacy_roam_enabled=%d, btm_retry_cnt=%d btm_roaming_enabled=%d",
|
||||
ESP_LOGI(ROAMING_TAG, "legacy_roam_enabled=%d, btm_retry_cnt=%d btm_roaming_enabled=%d",
|
||||
g_roaming_app.config.legacy_roam_enabled,
|
||||
g_roaming_app.config.btm_retry_cnt, g_roaming_app.config.btm_roaming_enabled);
|
||||
|
||||
ESP_LOGD(ROAMING_TAG, "rrm_monitor=%d, rrm_monitor_time=%d rrm_monitor_rssi_threshold=%d",
|
||||
ESP_LOGI(ROAMING_TAG, "rrm_monitor=%d, rrm_monitor_time=%d rrm_monitor_rssi_threshold=%d",
|
||||
g_roaming_app.config.rrm_monitor,
|
||||
g_roaming_app.config.rrm_monitor_time,
|
||||
g_roaming_app.config.rrm_monitor_rssi_threshold);
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
||||
esp_err_t roam_set_config_params(struct roam_config *config)
|
||||
{
|
||||
wifi_ipc_config_t cfg;
|
||||
|
||||
cfg.fn = update_config_params;
|
||||
cfg.arg = config;
|
||||
cfg.arg_size = sizeof(*config);
|
||||
esp_wifi_ipc_internal(&cfg, false);
|
||||
|
||||
return ESP_OK;
|
||||
}
|
||||
|
@ -23,9 +23,6 @@
|
||||
#include "rsn_supp/wpa_i.h"
|
||||
#include "rsn_supp/wpa.h"
|
||||
#include "esp_private/wifi.h"
|
||||
#if CONFIG_ESP_WIFI_ENABLE_ROAMING_APP
|
||||
#include "esp_roaming.h"
|
||||
#endif
|
||||
|
||||
/* Utility Functions */
|
||||
esp_err_t esp_supplicant_str_to_mac(const char *str, uint8_t dest[6])
|
||||
|
@ -40,9 +40,6 @@
|
||||
#include "ap/sta_info.h"
|
||||
#include "wps/wps_defs.h"
|
||||
#include "wps/wps.h"
|
||||
#if CONFIG_ESP_WIFI_ENABLE_ROAMING_APP
|
||||
#include "esp_roaming.h"
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_DPP
|
||||
#include "common/dpp.h"
|
||||
|
Reference in New Issue
Block a user