risc-v/esp32c3: Disable Wi-Fi reconnect by default

This commit is contained in:
chenwen 2021-05-25 17:48:09 +08:00 committed by Alan Carvalho de Assis
parent c3792f0aae
commit ee3350ed1d
2 changed files with 12 additions and 1 deletions

View File

@ -751,6 +751,12 @@ choice EXAMPLE_POWER_SAVE_MODE
bool "maximum modem"
endchoice
config ESP32C3_WIFI_RECONNECT
bool "Enable Wi-Fi to reconnect"
default n
---help---
Select this option to enable Wi-Fi to reconnect for station when disconnected.
endmenu # ESP32C3_WIRELESS
menu "SPI Flash configuration"

View File

@ -2056,6 +2056,7 @@ static void esp_evt_work_cb(FAR void *arg)
irqstate_t flags;
struct evt_adpt *evt_adpt;
struct wifi_notify *notify;
wifi_event_sta_disconnected_t *disconnected;
while (1)
{
@ -2092,8 +2093,11 @@ static void esp_evt_work_cb(FAR void *arg)
break;
case WIFI_ADPT_EVT_STA_DISCONNECT:
wlinfo("INFO: Wi-Fi sta disconnect\n");
disconnected = (wifi_event_sta_disconnected_t *)evt_adpt->buf;
wlinfo("INFO: Wi-Fi sta disconnect, reason code: %d\n",
disconnected->reason);
g_sta_connected = false;
#ifdef CONFIG_ESP32C3_WIFI_RECONNECT
if (g_sta_reconnect)
{
ret = esp_wifi_connect();
@ -2102,6 +2106,7 @@ static void esp_evt_work_cb(FAR void *arg)
wlerr("ERROR: Failed to connect AP error=%d\n", ret);
}
}
#endif
break;
case WIFI_ADPT_EVT_STA_STOP: