event_handler, init, and reset
This commit is contained in:
parent
8f73270f2b
commit
bfc5eb1660
|
@ -50,11 +50,23 @@ static void event_handler(void *arg, esp_event_base_t event_base,
|
|||
ESP_LOGW(TAG, "scan");
|
||||
xEventGroupSetBits(radio->event_group_handle, WIFI_SCAN_DONE_BIT);
|
||||
break;
|
||||
case WIFI_EVENT_AP_START:
|
||||
ESP_LOGW(TAG, "ap start");
|
||||
break;
|
||||
case WIFI_EVENT_AP_STOP:
|
||||
ESP_LOGW(TAG, "ap stop");
|
||||
break;
|
||||
case WIFI_EVENT_AP_STACONNECTED:
|
||||
ESP_LOGW(TAG, "ap sta connected");
|
||||
break;
|
||||
case WIFI_EVENT_AP_STADISCONNECTED:
|
||||
ESP_LOGW(TAG, "ap sta disconnected");
|
||||
break;
|
||||
case WIFI_EVENT_STA_START:
|
||||
ESP_LOGW(TAG, "start");
|
||||
ESP_LOGW(TAG, "sta start");
|
||||
break;
|
||||
case WIFI_EVENT_STA_STOP:
|
||||
ESP_LOGW(TAG, "stop");
|
||||
ESP_LOGW(TAG, "sta stop");
|
||||
break;
|
||||
case WIFI_EVENT_STA_CONNECTED:
|
||||
ESP_LOGW(TAG, "connected");
|
||||
|
@ -109,6 +121,7 @@ void common_hal_wifi_init(void) {
|
|||
|
||||
wifi_radio_obj_t *self = &common_hal_wifi_radio_obj;
|
||||
self->netif = esp_netif_create_default_wifi_sta();
|
||||
self->ap_netif = esp_netif_create_default_wifi_ap();
|
||||
self->started = false;
|
||||
|
||||
// Even though we just called esp_netif_create_default_wifi_sta,
|
||||
|
@ -155,6 +168,8 @@ void wifi_reset(void) {
|
|||
ESP_ERROR_CHECK(esp_wifi_deinit());
|
||||
esp_netif_destroy(radio->netif);
|
||||
radio->netif = NULL;
|
||||
esp_netif_destroy(radio->ap_netif);
|
||||
radio->ap_netif = NULL;
|
||||
}
|
||||
|
||||
void ipaddress_ipaddress_to_esp_idf(mp_obj_t ip_address, ip_addr_t *esp_ip_address) {
|
||||
|
|
Loading…
Reference in New Issue