esp_wifi: Modify ESP_IF_WIFI_STA to WIFI_IF_STA

This commit is contained in:
xiehang 2021-01-19 11:55:44 +08:00
parent f0b0418ed4
commit b8a8fe3f54
25 changed files with 50 additions and 50 deletions

View File

@ -128,7 +128,7 @@ TEST_CASE("adc2 work with wifi","[adc]")
}, },
}; };
TEST_ESP_OK(esp_wifi_set_mode(WIFI_MODE_STA)); TEST_ESP_OK(esp_wifi_set_mode(WIFI_MODE_STA));
TEST_ESP_OK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config)); TEST_ESP_OK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config));
//test read value //test read value
TEST_ESP_OK( adc2_get_raw( ADC_TEST_CH1, ADC_TEST_WIDTH, &read_raw )); TEST_ESP_OK( adc2_get_raw( ADC_TEST_CH1, ADC_TEST_WIDTH, &read_raw ));
@ -260,7 +260,7 @@ TEST_CASE("adc1 and i2s work with wifi","[adc][ignore]")
}, },
}; };
TEST_ESP_OK(esp_wifi_set_mode(WIFI_MODE_STA)); TEST_ESP_OK(esp_wifi_set_mode(WIFI_MODE_STA));
TEST_ESP_OK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config)); TEST_ESP_OK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config));
i2s_adc_test(); i2s_adc_test();
//now start wifi //now start wifi
printf("wifi start...\n"); printf("wifi start...\n");

View File

@ -102,7 +102,7 @@ static void test_wifi_init_deinit(wifi_init_config_t *cfg, wifi_config_t* wifi_c
ESP_LOGI(TAG, EMPH_STR("esp_wifi_set_mode")); ESP_LOGI(TAG, EMPH_STR("esp_wifi_set_mode"));
TEST_ESP_OK(esp_wifi_set_mode(WIFI_MODE_STA)); TEST_ESP_OK(esp_wifi_set_mode(WIFI_MODE_STA));
ESP_LOGI(TAG, EMPH_STR("esp_wifi_set_config")); ESP_LOGI(TAG, EMPH_STR("esp_wifi_set_config"));
TEST_ESP_OK(esp_wifi_set_config(ESP_IF_WIFI_STA, wifi_config)); TEST_ESP_OK(esp_wifi_set_config(WIFI_IF_STA, wifi_config));
ESP_LOGI(TAG, EMPH_STR("esp_wifi_deinit...")); ESP_LOGI(TAG, EMPH_STR("esp_wifi_deinit..."));
TEST_ESP_OK(esp_wifi_deinit()); TEST_ESP_OK(esp_wifi_deinit());
} }
@ -116,7 +116,7 @@ static void test_wifi_start_stop(wifi_init_config_t *cfg, wifi_config_t* wifi_co
ESP_LOGI(TAG, EMPH_STR("esp_wifi_set_mode")); ESP_LOGI(TAG, EMPH_STR("esp_wifi_set_mode"));
TEST_ESP_OK(esp_wifi_set_mode(WIFI_MODE_STA)); TEST_ESP_OK(esp_wifi_set_mode(WIFI_MODE_STA));
ESP_LOGI(TAG, EMPH_STR("esp_wifi_set_config")); ESP_LOGI(TAG, EMPH_STR("esp_wifi_set_config"));
TEST_ESP_OK(esp_wifi_set_config(ESP_IF_WIFI_STA, wifi_config)); TEST_ESP_OK(esp_wifi_set_config(WIFI_IF_STA, wifi_config));
//now start wifi //now start wifi
ESP_LOGI(TAG, EMPH_STR("esp_wifi_start...")); ESP_LOGI(TAG, EMPH_STR("esp_wifi_start..."));
TEST_ESP_OK(esp_wifi_start()); TEST_ESP_OK(esp_wifi_start());

View File

@ -1105,7 +1105,7 @@ esp_err_t wifi_prov_mgr_is_provisioned(bool *provisioned)
/* Get Wi-Fi Station configuration */ /* Get Wi-Fi Station configuration */
wifi_config_t wifi_cfg; wifi_config_t wifi_cfg;
if (esp_wifi_get_config(ESP_IF_WIFI_STA, &wifi_cfg) != ESP_OK) { if (esp_wifi_get_config(WIFI_IF_STA, &wifi_cfg) != ESP_OK) {
return ESP_FAIL; return ESP_FAIL;
} }
@ -1164,7 +1164,7 @@ esp_err_t wifi_prov_mgr_configure_sta(wifi_config_t *wifi_cfg)
} }
/* Configure Wi-Fi station with host credentials /* Configure Wi-Fi station with host credentials
* provided during provisioning */ * provided during provisioning */
if (esp_wifi_set_config(ESP_IF_WIFI_STA, wifi_cfg) != ESP_OK) { if (esp_wifi_set_config(WIFI_IF_STA, wifi_cfg) != ESP_OK) {
ESP_LOGE(TAG, "Failed to set Wi-Fi configuration"); ESP_LOGE(TAG, "Failed to set Wi-Fi configuration");
RELEASE_LOCK(prov_ctx_lock); RELEASE_LOCK(prov_ctx_lock);
return ESP_FAIL; return ESP_FAIL;
@ -1434,14 +1434,14 @@ esp_err_t wifi_prov_mgr_start_provisioning(wifi_prov_security_t security, const
* to the AP whose credentials were present earlier */ * to the AP whose credentials were present earlier */
wifi_config_t wifi_cfg_empty, wifi_cfg_old; wifi_config_t wifi_cfg_empty, wifi_cfg_old;
memset(&wifi_cfg_empty, 0, sizeof(wifi_config_t)); memset(&wifi_cfg_empty, 0, sizeof(wifi_config_t));
esp_wifi_get_config(ESP_IF_WIFI_STA, &wifi_cfg_old); esp_wifi_get_config(WIFI_IF_STA, &wifi_cfg_old);
err = esp_wifi_set_storage(WIFI_STORAGE_RAM); err = esp_wifi_set_storage(WIFI_STORAGE_RAM);
if (err != ESP_OK) { if (err != ESP_OK) {
ESP_LOGE(TAG, "Failed to set Wi-Fi storage to RAM"); ESP_LOGE(TAG, "Failed to set Wi-Fi storage to RAM");
RELEASE_LOCK(prov_ctx_lock); RELEASE_LOCK(prov_ctx_lock);
return err; return err;
} }
esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_cfg_empty); esp_wifi_set_config(WIFI_IF_STA, &wifi_cfg_empty);
if (err != ESP_OK) { if (err != ESP_OK) {
ESP_LOGE(TAG, "Failed to set empty Wi-Fi credentials"); ESP_LOGE(TAG, "Failed to set empty Wi-Fi credentials");
RELEASE_LOCK(prov_ctx_lock); RELEASE_LOCK(prov_ctx_lock);
@ -1527,7 +1527,7 @@ esp_err_t wifi_prov_mgr_start_provisioning(wifi_prov_security_t security, const
err: err:
prov_ctx->prov_state = WIFI_PROV_STATE_IDLE; prov_ctx->prov_state = WIFI_PROV_STATE_IDLE;
esp_wifi_set_storage(WIFI_STORAGE_FLASH); esp_wifi_set_storage(WIFI_STORAGE_FLASH);
esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_cfg_old); esp_wifi_set_config(WIFI_IF_STA, &wifi_cfg_old);
exit: exit:
RELEASE_LOCK(prov_ctx_lock); RELEASE_LOCK(prov_ctx_lock);

View File

@ -158,7 +158,7 @@ static void esp_clear_bssid_flag(struct wpa_supplicant *wpa_s)
wifi_config_t *config; wifi_config_t *config;
/* Reset only if btm is enabled */ /* Reset only if btm is enabled */
if (esp_wifi_is_btm_enabled_internal(ESP_IF_WIFI_STA) == false) if (esp_wifi_is_btm_enabled_internal(WIFI_IF_STA) == false)
return; return;
config = os_zalloc(sizeof(wifi_config_t)); config = os_zalloc(sizeof(wifi_config_t));
@ -168,9 +168,9 @@ static void esp_clear_bssid_flag(struct wpa_supplicant *wpa_s)
return; return;
} }
esp_wifi_get_config(ESP_IF_WIFI_STA, config); esp_wifi_get_config(WIFI_IF_STA, config);
config->sta.bssid_set = 0; config->sta.bssid_set = 0;
esp_wifi_set_config(ESP_IF_WIFI_STA, config); esp_wifi_set_config(WIFI_IF_STA, config);
os_free(config); os_free(config);
wpa_printf(MSG_DEBUG, "cleared bssid flag"); wpa_printf(MSG_DEBUG, "cleared bssid flag");
} }
@ -182,9 +182,9 @@ static void esp_register_action_frame(struct wpa_supplicant *wpa_s)
wpa_s->subtype = 0; wpa_s->subtype = 0;
/* current supported features in supplicant: rrm and btm */ /* current supported features in supplicant: rrm and btm */
if (esp_wifi_is_rm_enabled_internal(ESP_IF_WIFI_STA)) if (esp_wifi_is_rm_enabled_internal(WIFI_IF_STA))
wpa_s->subtype = 1 << WLAN_ACTION_RADIO_MEASUREMENT; wpa_s->subtype = 1 << WLAN_ACTION_RADIO_MEASUREMENT;
if (esp_wifi_is_btm_enabled_internal(ESP_IF_WIFI_STA)) if (esp_wifi_is_btm_enabled_internal(WIFI_IF_STA))
wpa_s->subtype |= 1 << WLAN_ACTION_WNM; wpa_s->subtype |= 1 << WLAN_ACTION_WNM;
if (wpa_s->subtype) if (wpa_s->subtype)
@ -288,12 +288,12 @@ void wpa_supplicant_connect(struct wpa_supplicant *wpa_s,
return; return;
} }
esp_wifi_get_config(ESP_IF_WIFI_STA, config); esp_wifi_get_config(WIFI_IF_STA, config);
/* We only support roaming in same ESS, therefore only bssid setting is needed */ /* We only support roaming in same ESS, therefore only bssid setting is needed */
os_memcpy(config->sta.bssid, bss->bssid, ETH_ALEN); os_memcpy(config->sta.bssid, bss->bssid, ETH_ALEN);
config->sta.bssid_set = 1; config->sta.bssid_set = 1;
esp_wifi_internal_issue_disconnect(WIFI_REASON_ROAMING); esp_wifi_internal_issue_disconnect(WIFI_REASON_ROAMING);
esp_wifi_set_config(ESP_IF_WIFI_STA, config); esp_wifi_set_config(WIFI_IF_STA, config);
os_free(config); os_free(config);
esp_wifi_connect(); esp_wifi_connect();
} }
@ -313,7 +313,7 @@ void esp_set_rm_enabled_ie(void)
WLAN_RRM_CAPS_BEACON_REPORT_ACTIVE; WLAN_RRM_CAPS_BEACON_REPORT_ACTIVE;
/* set rm enabled IE if enabled in driver */ /* set rm enabled IE if enabled in driver */
if (esp_wifi_is_rm_enabled_internal(ESP_IF_WIFI_STA)) { if (esp_wifi_is_rm_enabled_internal(WIFI_IF_STA)) {
esp_wifi_set_appie_internal(WIFI_APPIE_RM_ENABLED_CAPS, rmm_ie, rrm_ie_len, 0); esp_wifi_set_appie_internal(WIFI_APPIE_RM_ENABLED_CAPS, rmm_ie, rrm_ie_len, 0);
} }
} }
@ -350,7 +350,7 @@ int wpa_drv_send_action(struct wpa_supplicant *wpa_s,
goto cleanup; goto cleanup;
} }
req->ifx = ESP_IF_WIFI_STA; req->ifx = WIFI_IF_STA;
req->subtype = WLAN_FC_STYPE_ACTION; req->subtype = WLAN_FC_STYPE_ACTION;
req->data_len = data_len; req->data_len = data_len;
os_memcpy(req->data, data, req->data_len); os_memcpy(req->data, data, req->data_len);

View File

@ -38,7 +38,7 @@ static void esp_scan_done_event_handler(void* arg, esp_event_base_t event_base,
struct wpa_supplicant *wpa_s = &g_wpa_supp; struct wpa_supplicant *wpa_s = &g_wpa_supp;
if (!wpa_s->scanning) { if (!wpa_s->scanning) {
/* update last scan time */ /* update last scan time */
wpa_s->scan_start_tsf = esp_wifi_get_tsf_time(ESP_IF_WIFI_STA); wpa_s->scan_start_tsf = esp_wifi_get_tsf_time(WIFI_IF_STA);
wpa_printf(MSG_DEBUG, "scan not triggered by supplicant, ignore"); wpa_printf(MSG_DEBUG, "scan not triggered by supplicant, ignore");
return; return;
} }
@ -174,7 +174,7 @@ static int esp_issue_scan(struct wpa_supplicant *wpa_s,
{ {
wifi_scan_config_t *params = NULL; wifi_scan_config_t *params = NULL;
int ret = 0; int ret = 0;
u64 scan_start_tsf = esp_wifi_get_tsf_time(ESP_IF_WIFI_STA); u64 scan_start_tsf = esp_wifi_get_tsf_time(WIFI_IF_STA);
/* TODO: Directly try to connect if scan results are recent */ /* TODO: Directly try to connect if scan results are recent */
if ((scan_start_tsf - wpa_s->scan_start_tsf) > 100000) { if ((scan_start_tsf - wpa_s->scan_start_tsf) > 100000) {
@ -183,7 +183,7 @@ static int esp_issue_scan(struct wpa_supplicant *wpa_s,
wpa_bss_flush(wpa_s); wpa_bss_flush(wpa_s);
} }
esp_wifi_get_macaddr_internal(ESP_IF_WIFI_STA, wpa_s->tsf_bssid); esp_wifi_get_macaddr_internal(WIFI_IF_STA, wpa_s->tsf_bssid);
if (scan_params) { if (scan_params) {
params = os_zalloc(sizeof(wifi_scan_config_t)); params = os_zalloc(sizeof(wifi_scan_config_t));

View File

@ -1023,7 +1023,7 @@ int ieee80211w_set_keys(struct wpa_sm *sm,
if (keyidx > 4095) { if (keyidx > 4095) {
return -1; return -1;
} }
return esp_wifi_set_igtk_internal(ESP_IF_WIFI_STA, igtk); return esp_wifi_set_igtk_internal(WIFI_IF_STA, igtk);
} }
return 0; return 0;
#else #else
@ -2075,7 +2075,7 @@ bool wpa_sm_init(char * payload, WPA_SEND_FUNC snd_func,
sm->key_entry_valid = 0; sm->key_entry_valid = 0;
sm->key_install = false; sm->key_install = false;
spp_attrubute = esp_wifi_get_spp_attrubute_internal(ESP_IF_WIFI_STA); spp_attrubute = esp_wifi_get_spp_attrubute_internal(WIFI_IF_STA);
sm->spp_sup.capable = ((spp_attrubute & WPA_CAPABILITY_SPP_CAPABLE) ? SPP_AMSDU_CAP_ENABLE : SPP_AMSDU_CAP_DISABLE); sm->spp_sup.capable = ((spp_attrubute & WPA_CAPABILITY_SPP_CAPABLE) ? SPP_AMSDU_CAP_ENABLE : SPP_AMSDU_CAP_DISABLE);
sm->spp_sup.require = ((spp_attrubute & WPA_CAPABILITY_SPP_REQUIRED) ? SPP_AMSDU_CAP_ENABLE : SPP_AMSDU_REQ_DISABLE); sm->spp_sup.require = ((spp_attrubute & WPA_CAPABILITY_SPP_REQUIRED) ? SPP_AMSDU_CAP_ENABLE : SPP_AMSDU_REQ_DISABLE);
@ -2169,7 +2169,7 @@ int wpa_set_bss(char *macddr, char * bssid, u8 pairwise_cipher, u8 group_cipher,
if (esp_wifi_sta_pmf_enabled()) { if (esp_wifi_sta_pmf_enabled()) {
wifi_config_t wifi_cfg; wifi_config_t wifi_cfg;
esp_wifi_get_config(ESP_IF_WIFI_STA, &wifi_cfg); esp_wifi_get_config(WIFI_IF_STA, &wifi_cfg);
sm->pmf_cfg = wifi_cfg.sta.pmf_cfg; sm->pmf_cfg = wifi_cfg.sta.pmf_cfg;
sm->mgmt_group_cipher = cipher_type_map_public_to_supp(esp_wifi_sta_get_mgmt_group_cipher()); sm->mgmt_group_cipher = cipher_type_map_public_to_supp(esp_wifi_sta_get_mgmt_group_cipher());
} else { } else {

View File

@ -131,7 +131,7 @@ static void start(const char *ssid, const char *passwd)
ESP_LOGI(TAG, "Connecting to %s...", wifi_config.sta.ssid); ESP_LOGI(TAG, "Connecting to %s...", wifi_config.sta.ssid);
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA)); ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));
ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config)); ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config));
ESP_ERROR_CHECK(esp_wifi_start()); ESP_ERROR_CHECK(esp_wifi_start());
esp_wifi_connect(); esp_wifi_connect();
s_connection_name = ssid; s_connection_name = ssid;

View File

@ -166,7 +166,7 @@ static bool wifi_cmd_sta_join(const char *ssid, const char *pass)
reconnect = true; reconnect = true;
esp_wifi_disconnect(); esp_wifi_disconnect();
//ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) ); //by snake //ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) ); //by snake
ESP_ERROR_CHECK( esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) ); ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_STA, &wifi_config) );
esp_wifi_connect(); esp_wifi_connect();
xEventGroupWaitBits(wifi_event_group, CONNECTED_BIT, 0, 1, 5000 / portTICK_RATE_MS); xEventGroupWaitBits(wifi_event_group, CONNECTED_BIT, 0, 1, 5000 / portTICK_RATE_MS);

View File

@ -131,7 +131,7 @@ void wifi_init_sta(void)
}, },
}; };
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA) ); ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA) );
ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) ); ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config) );
ESP_ERROR_CHECK(esp_wifi_start() ); ESP_ERROR_CHECK(esp_wifi_start() );
ESP_LOGI(TAG, "wifi_init_sta finished."); ESP_LOGI(TAG, "wifi_init_sta finished.");

View File

@ -269,7 +269,7 @@ static esp_netif_t *wifi_start(void)
}; };
ESP_LOGI(TAG, "Connecting to %s...", wifi_config.sta.ssid); ESP_LOGI(TAG, "Connecting to %s...", wifi_config.sta.ssid);
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA)); ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));
ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config)); ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config));
ESP_ERROR_CHECK(esp_wifi_start()); ESP_ERROR_CHECK(esp_wifi_start());
esp_wifi_connect(); esp_wifi_connect();
return netif; return netif;

View File

@ -251,7 +251,7 @@ mesh_netif_driver_t mesh_create_if_driver(bool is_ap, bool is_root)
} }
// save station mac address to exclude it from routing-table on broadcast // save station mac address to exclude it from routing-table on broadcast
esp_wifi_get_mac(ESP_IF_WIFI_STA, driver->sta_mac_addr); esp_wifi_get_mac(WIFI_IF_STA, driver->sta_mac_addr);
return driver; return driver;
} }
@ -301,7 +301,7 @@ static esp_err_t start_mesh_link_ap(void)
static esp_err_t start_wifi_link_sta(void) static esp_err_t start_wifi_link_sta(void)
{ {
uint8_t mac[6]; uint8_t mac[6];
esp_wifi_get_mac(ESP_IF_WIFI_STA, mac); esp_wifi_get_mac(WIFI_IF_STA, mac);
esp_err_t ret; esp_err_t ret;
void *driver = esp_netif_get_io_driver(netif_sta); void *driver = esp_netif_get_io_driver(netif_sta);
if ((ret = esp_wifi_register_if_rxcb(driver, esp_netif_receive, netif_sta)) != ESP_OK) { if ((ret = esp_wifi_register_if_rxcb(driver, esp_netif_receive, netif_sta)) != ESP_OK) {
@ -319,7 +319,7 @@ static esp_err_t start_wifi_link_sta(void)
static esp_err_t start_mesh_link_sta(void) static esp_err_t start_mesh_link_sta(void)
{ {
uint8_t mac[MAC_ADDR_LEN]; uint8_t mac[MAC_ADDR_LEN];
esp_wifi_get_mac(ESP_IF_WIFI_STA, mac); esp_wifi_get_mac(WIFI_IF_STA, mac);
esp_netif_set_mac(netif_sta, mac); esp_netif_set_mac(netif_sta, mac);
esp_netif_action_start(netif_sta, NULL, 0, NULL); esp_netif_action_start(netif_sta, NULL, 0, NULL);
esp_netif_action_connected(netif_sta, NULL, 0, NULL); esp_netif_action_connected(netif_sta, NULL, 0, NULL);

View File

@ -89,7 +89,7 @@ esp_err_t wifi_init_sta(void)
}, },
}; };
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA) ); ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA) );
ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) ); ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config) );
ESP_ERROR_CHECK(esp_wifi_start() ); ESP_ERROR_CHECK(esp_wifi_start() );
ESP_LOGI(TAG, "wifi_init_sta finished."); ESP_LOGI(TAG, "wifi_init_sta finished.");

View File

@ -288,7 +288,7 @@ esp_err_t app_prov_is_provisioned(bool *provisioned)
/* Get WiFi Station configuration */ /* Get WiFi Station configuration */
wifi_config_t wifi_cfg; wifi_config_t wifi_cfg;
if (esp_wifi_get_config(ESP_IF_WIFI_STA, &wifi_cfg) != ESP_OK) { if (esp_wifi_get_config(WIFI_IF_STA, &wifi_cfg) != ESP_OK) {
return ESP_FAIL; return ESP_FAIL;
} }
@ -309,7 +309,7 @@ esp_err_t app_prov_configure_sta(wifi_config_t *wifi_cfg)
} }
/* Configure WiFi station with host credentials /* Configure WiFi station with host credentials
* provided during provisioning */ * provided during provisioning */
if (esp_wifi_set_config(ESP_IF_WIFI_STA, wifi_cfg) != ESP_OK) { if (esp_wifi_set_config(WIFI_IF_STA, wifi_cfg) != ESP_OK) {
ESP_LOGE(TAG, "Failed to set WiFi configuration"); ESP_LOGE(TAG, "Failed to set WiFi configuration");
return ESP_FAIL; return ESP_FAIL;
} }

View File

@ -226,7 +226,7 @@ esp_err_t app_prov_is_provisioned(bool *provisioned)
/* Get WiFi Station configuration */ /* Get WiFi Station configuration */
wifi_config_t wifi_cfg; wifi_config_t wifi_cfg;
if (esp_wifi_get_config(ESP_IF_WIFI_STA, &wifi_cfg) != ESP_OK) { if (esp_wifi_get_config(WIFI_IF_STA, &wifi_cfg) != ESP_OK) {
return ESP_FAIL; return ESP_FAIL;
} }
@ -247,7 +247,7 @@ esp_err_t app_prov_configure_sta(wifi_config_t *wifi_cfg)
} }
/* Configure WiFi station with host credentials /* Configure WiFi station with host credentials
* provided during provisioning */ * provided during provisioning */
if (esp_wifi_set_config(ESP_IF_WIFI_STA, wifi_cfg) != ESP_OK) { if (esp_wifi_set_config(WIFI_IF_STA, wifi_cfg) != ESP_OK) {
ESP_LOGE(TAG, "Failed to set WiFi configuration"); ESP_LOGE(TAG, "Failed to set WiFi configuration");
return ESP_FAIL; return ESP_FAIL;
} }

View File

@ -251,7 +251,7 @@ esp_err_t app_prov_is_provisioned(bool *provisioned)
/* Get WiFi Station configuration */ /* Get WiFi Station configuration */
wifi_config_t wifi_cfg; wifi_config_t wifi_cfg;
if (esp_wifi_get_config(ESP_IF_WIFI_STA, &wifi_cfg) != ESP_OK) { if (esp_wifi_get_config(WIFI_IF_STA, &wifi_cfg) != ESP_OK) {
return ESP_FAIL; return ESP_FAIL;
} }
@ -272,7 +272,7 @@ esp_err_t app_prov_configure_sta(wifi_config_t *wifi_cfg)
} }
/* Configure WiFi station with host credentials /* Configure WiFi station with host credentials
* provided during provisioning */ * provided during provisioning */
if (esp_wifi_set_config(ESP_IF_WIFI_STA, wifi_cfg) != ESP_OK) { if (esp_wifi_set_config(WIFI_IF_STA, wifi_cfg) != ESP_OK) {
ESP_LOGE(TAG, "Failed to set WiFi configuration"); ESP_LOGE(TAG, "Failed to set WiFi configuration");
return ESP_FAIL; return ESP_FAIL;
} }

View File

@ -237,7 +237,7 @@ esp_err_t app_prov_is_provisioned(bool *provisioned)
/* Get WiFi Station configuration */ /* Get WiFi Station configuration */
wifi_config_t wifi_cfg; wifi_config_t wifi_cfg;
if (esp_wifi_get_config(ESP_IF_WIFI_STA, &wifi_cfg) != ESP_OK) { if (esp_wifi_get_config(WIFI_IF_STA, &wifi_cfg) != ESP_OK) {
return ESP_FAIL; return ESP_FAIL;
} }
@ -258,7 +258,7 @@ esp_err_t app_prov_configure_sta(wifi_config_t *wifi_cfg)
} }
/* Configure WiFi station with host credentials /* Configure WiFi station with host credentials
* provided during provisioning */ * provided during provisioning */
if (esp_wifi_set_config(ESP_IF_WIFI_STA, wifi_cfg) != ESP_OK) { if (esp_wifi_set_config(WIFI_IF_STA, wifi_cfg) != ESP_OK) {
ESP_LOGE(TAG, "Failed to set WiFi configuration"); ESP_LOGE(TAG, "Failed to set WiFi configuration");
return ESP_FAIL; return ESP_FAIL;
} }

View File

@ -71,7 +71,7 @@ static bool wifi_join(const char *ssid, const char *pass, int timeout_ms)
} }
ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) ); ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) );
ESP_ERROR_CHECK( esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) ); ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_STA, &wifi_config) );
esp_wifi_connect(); esp_wifi_connect();
int bits = xEventGroupWaitBits(wifi_event_group, CONNECTED_BIT, int bits = xEventGroupWaitBits(wifi_event_group, CONNECTED_BIT,

View File

@ -110,7 +110,7 @@ static void fast_scan(void)
}, },
}; };
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA)); ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));
ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config)); ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config));
ESP_ERROR_CHECK(esp_wifi_start()); ESP_ERROR_CHECK(esp_wifi_start());
} }

View File

@ -104,7 +104,7 @@ void wifi_init_sta(void)
}, },
}; };
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA) ); ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA) );
ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) ); ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config) );
ESP_ERROR_CHECK(esp_wifi_start() ); ESP_ERROR_CHECK(esp_wifi_start() );
ESP_LOGI(TAG, "wifi_init_sta finished."); ESP_LOGI(TAG, "wifi_init_sta finished.");

View File

@ -158,7 +158,7 @@ static bool wifi_cmd_sta_join(const char* ssid, const char* pass)
reconnect = true; reconnect = true;
ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) ); ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) );
ESP_ERROR_CHECK( esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) ); ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_STA, &wifi_config) );
esp_wifi_connect(); esp_wifi_connect();
xEventGroupWaitBits(wifi_event_group, CONNECTED_BIT, 0, 1, 5000/portTICK_RATE_MS); xEventGroupWaitBits(wifi_event_group, CONNECTED_BIT, 0, 1, 5000/portTICK_RATE_MS);

View File

@ -74,7 +74,7 @@ static void wifi_power_save(void)
}, },
}; };
ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA)); ESP_ERROR_CHECK(esp_wifi_set_mode(WIFI_MODE_STA));
ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config)); ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wifi_config));
ESP_ERROR_CHECK(esp_wifi_start()); ESP_ERROR_CHECK(esp_wifi_start());
ESP_LOGI(TAG, "esp_wifi_set_ps()."); ESP_LOGI(TAG, "esp_wifi_set_ps().");

View File

@ -353,7 +353,7 @@ static void initialise_wifi(void)
ESP_LOGI(TAG, "Setting WiFi configuration SSID %s...", wifi_config.sta.ssid); ESP_LOGI(TAG, "Setting WiFi configuration SSID %s...", wifi_config.sta.ssid);
ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) ); ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) );
ESP_ERROR_CHECK( esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) ); ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_STA, &wifi_config) );
ESP_ERROR_CHECK( esp_wifi_start() ); ESP_ERROR_CHECK( esp_wifi_start() );
} }

View File

@ -78,7 +78,7 @@ static void event_handler(void* arg, esp_event_base_t event_base,
} }
ESP_ERROR_CHECK( esp_wifi_disconnect() ); ESP_ERROR_CHECK( esp_wifi_disconnect() );
ESP_ERROR_CHECK( esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) ); ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_STA, &wifi_config) );
esp_wifi_connect(); esp_wifi_connect();
} else if (event_base == SC_EVENT && event_id == SC_EVENT_SEND_ACK_DONE) { } else if (event_base == SC_EVENT && event_id == SC_EVENT_SEND_ACK_DONE) {
xEventGroupSetBits(s_wifi_event_group, ESPTOUCH_DONE_BIT); xEventGroupSetBits(s_wifi_event_group, ESPTOUCH_DONE_BIT);

View File

@ -126,7 +126,7 @@ static void initialise_wifi(void)
}; };
ESP_LOGI(TAG, "Setting WiFi configuration SSID %s...", wifi_config.sta.ssid); ESP_LOGI(TAG, "Setting WiFi configuration SSID %s...", wifi_config.sta.ssid);
ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) ); ESP_ERROR_CHECK( esp_wifi_set_mode(WIFI_MODE_STA) );
ESP_ERROR_CHECK( esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) ); ESP_ERROR_CHECK( esp_wifi_set_config(WIFI_IF_STA, &wifi_config) );
ESP_ERROR_CHECK( esp_wifi_sta_wpa2_ent_set_identity((uint8_t *)EXAMPLE_EAP_ID, strlen(EXAMPLE_EAP_ID)) ); ESP_ERROR_CHECK( esp_wifi_sta_wpa2_ent_set_identity((uint8_t *)EXAMPLE_EAP_ID, strlen(EXAMPLE_EAP_ID)) );
#ifdef CONFIG_EXAMPLE_VALIDATE_SERVER_CERT #ifdef CONFIG_EXAMPLE_VALIDATE_SERVER_CERT

View File

@ -72,7 +72,7 @@ static void wifi_event_handler(void* arg, esp_event_base_t event_base,
if (ap_idx < s_ap_creds_num) { if (ap_idx < s_ap_creds_num) {
ESP_LOGI(TAG, "Connecting to SSID: %s, Passphrase: %s", ESP_LOGI(TAG, "Connecting to SSID: %s, Passphrase: %s",
wps_ap_creds[ap_idx].sta.ssid, wps_ap_creds[ap_idx].sta.password); wps_ap_creds[ap_idx].sta.ssid, wps_ap_creds[ap_idx].sta.password);
ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wps_ap_creds[ap_idx++]) ); ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wps_ap_creds[ap_idx++]) );
esp_wifi_connect(); esp_wifi_connect();
} }
s_retry_num = 0; s_retry_num = 0;
@ -99,7 +99,7 @@ static void wifi_event_handler(void* arg, esp_event_base_t event_base,
/* If multiple AP credentials are received from WPS, connect with first one */ /* If multiple AP credentials are received from WPS, connect with first one */
ESP_LOGI(TAG, "Connecting to SSID: %s, Passphrase: %s", ESP_LOGI(TAG, "Connecting to SSID: %s, Passphrase: %s",
wps_ap_creds[0].sta.ssid, wps_ap_creds[0].sta.password); wps_ap_creds[0].sta.ssid, wps_ap_creds[0].sta.password);
ESP_ERROR_CHECK(esp_wifi_set_config(ESP_IF_WIFI_STA, &wps_ap_creds[0]) ); ESP_ERROR_CHECK(esp_wifi_set_config(WIFI_IF_STA, &wps_ap_creds[0]) );
} }
/* /*
* If only one AP credential is received from WPS, there will be no event data and * If only one AP credential is received from WPS, there will be no event data and