You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2021/06/19 11:00:44 UTC
[incubator-nuttx] 01/02: risc-v/esp32c3: Disable Wi-Fi reconnect by
default
This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit ee3350ed1d1f198d4b540a7b4aeb7d33936d46ce
Author: chenwen <ch...@espressif.com>
AuthorDate: Tue May 25 17:48:09 2021 +0800
risc-v/esp32c3: Disable Wi-Fi reconnect by default
---
arch/risc-v/src/esp32c3/Kconfig | 6 ++++++
arch/risc-v/src/esp32c3/esp32c3_wifi_adapter.c | 7 ++++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/arch/risc-v/src/esp32c3/Kconfig b/arch/risc-v/src/esp32c3/Kconfig
index adda87b..30e92dd 100644
--- a/arch/risc-v/src/esp32c3/Kconfig
+++ b/arch/risc-v/src/esp32c3/Kconfig
@@ -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"
diff --git a/arch/risc-v/src/esp32c3/esp32c3_wifi_adapter.c b/arch/risc-v/src/esp32c3/esp32c3_wifi_adapter.c
index 97be493..d15a271 100644
--- a/arch/risc-v/src/esp32c3/esp32c3_wifi_adapter.c
+++ b/arch/risc-v/src/esp32c3/esp32c3_wifi_adapter.c
@@ -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: