event_handler STADISCONNECTED sometimes not received

francescofcf
Posts: 10
Joined: Wed Sep 05, 2018 8:02 am

event_handler STADISCONNECTED sometimes not received

Postby francescofcf » Wed Sep 05, 2018 9:15 am

Hi, I have an problem about event_handler(void *ctx, system_event_t *event)
In My project I initialize the ESP32 in AP with DHCP.
This is the code..

Code: Select all

void wifi_init_softap() {
	wifi_event_group = xEventGroupCreate();

	tcpip_adapter_init();
	ESP_ERROR_CHECK(esp_event_loop_init(event_handler, NULL));

	wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT();
	ESP_ERROR_CHECK(esp_wifi_init(&cfg));
	wifi_config_t wifi_config = ………………..
The problem is:
At startup the event_handler receive:
Event 13 : SYSTEM_EVENT_AP_START
after connected
Event 15 : SYSTEM_EVENT_AP_STACONNECTED
Event 17 : SYSTEM_EVENT_AP_STAIPASSIGNED
but after disconnected sometimes (often the first time) the
Event 16 : SYSTEM_EVENT_AP_STADISCONNECTED
it is not received.

you have some ideas, thanks in advanced.

francescofcf
Posts: 10
Joined: Wed Sep 05, 2018 8:02 am

Re: event_handler STADISCONNECTED sometimes not received

Postby francescofcf » Wed Sep 05, 2018 9:30 am

another information:
I have chek the problem also in "Simple WiFi Example" in "esp-idf \ examples \ wifi \ simple_wifi \ main" whitout modify.
(it happens similarly also in this example)

After If I add a task and print this information:

Code: Select all

ESP_ERROR_CHECK(esp_wifi_ap_get_sta_list(&wifi_sta_list));
ESP_ERROR_CHECK(tcpip_adapter_get_sta_list(&wifi_sta_list, &adapter_sta_list));
the task print the old station now disconnected given as connected
The procedure that I use to disconnect the station (Apple smartphone) is to turn off the your wifi.

francescofcf
Posts: 10
Joined: Wed Sep 05, 2018 8:02 am

Re: event_handler STADISCONNECTED sometimes not received

Postby francescofcf » Fri Oct 12, 2018 2:54 pm

The new release ESP-IDF V3.1 did not solve the problem!

Who is online

Users browsing this forum: Majestic-12 [Bot] and 386 guests