esp32/network_wlan: Wait for STA/AP START/STOP event in wlan.active.

This is a fix for commit bccbaa92b1:
- Should only wait for WIFI_EVENT_STA_START when invoked on the STA_IF
  interface.
- The WIFI_EVENT_STA_START event is generated every time the STA_IF
  interface is set active(True) and it was previously inactive, ie. not
  only after calling esp_wifi_start().
- Also wait for WIFI_EVENT_STA_STOP when deactivating the interface.
- Also wait for relevant AP events.

Fixes issue #11910.

Signed-off-by: Glenn Moloney <glenn.moloney@gmail.com>
Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Glenn Moloney
2023-07-01 13:54:44 +10:00
committed by Damien George
parent 2c67671651
commit dbced75b48
3 changed files with 30 additions and 15 deletions

View File

@@ -44,6 +44,7 @@ typedef struct _base_if_obj_t {
mp_obj_base_t base;
esp_interface_t if_id;
esp_netif_t *netif;
volatile bool active;
} base_if_obj_t;
extern const mp_obj_type_t esp_network_wlan_type;