Skip to content

Commit c8808f4

Browse files
authored
Merge pull request #3580 from astrobokonon/esp32s2-FixSTAMODE
ESP32S2: Reset sta_mode and ap_mode flags
2 parents 2d2503c + e202da4 commit c8808f4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ports/esp32s2/common-hal/wifi/__init__.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@ void common_hal_wifi_init(void) {
100100
wifi_radio_obj_t* self = &common_hal_wifi_radio_obj;
101101
self->netif = esp_netif_create_default_wifi_sta();
102102

103+
// Even though we just called esp_netif_create_default_wifi_sta,
104+
// station mode isn't actually ready for use until esp_wifi_set_mode()
105+
// is called and the configuration is loaded via esp_wifi_set_config().
106+
// Set both convienence flags to false so it's not forgotten.
107+
self->sta_mode = 0;
108+
self->ap_mode = 0;
109+
103110
self->event_group_handle = xEventGroupCreateStatic(&self->event_group);
104111
ESP_ERROR_CHECK(esp_event_handler_instance_register(WIFI_EVENT,
105112
ESP_EVENT_ANY_ID,

0 commit comments

Comments
 (0)