I was looking for an event that would trigger wifi readiness for a call to esp_wifi_scan_start(). I thought maybe the event SYSTEM_EVENT_WIFI_READY would be useful. Unfortunately, that event doesn't seem to be invoked or used.
Perhaps after esp_wifi_init() returns, the wifi subsystem is ready? Should SYSTEM_EVENT_WIFI_READY be invoked in esp_wifi_init() before it returns?
Robin
SYSTEM_EVENT_WIFI_READY not invoked
Re: SYSTEM_EVENT_WIFI_READY not invoked
Howdy,
My notes seem to say that you should indeed see a SYSTEM_WIFI_READY event. Can you paste your code into pastebin and post a link to the code you are using? Specifically, I want to see how you are registering your event handler and to ensure it is being registered prior to the WiFi initialization.
My notes seem to say that you should indeed see a SYSTEM_WIFI_READY event. Can you paste your code into pastebin and post a link to the code you are using? Specifically, I want to see how you are registering your event handler and to ensure it is being registered prior to the WiFi initialization.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Re: SYSTEM_EVENT_WIFI_READY not invoked
The handler is registered before init call. I see the SYSTEM_EVENT_STA_START event (and all of the other events that I should see) but never see the SYSTEM_EVENT_WIFI_READY. The event handler starts like:
and the logs look like:
Robin
Code: Select all
static esp_err_t event_handler(void *ctx, system_event_t *event)
{
switch(event->event_id) {
case SYSTEM_EVENT_WIFI_READY:
ESP_LOGI(TAG, "wifi ready\n");
break;
case SYSTEM_EVENT_STA_START:
ESP_LOGI(TAG, "wifi started\n");
start_scan_wifi();
break;
case SYSTEM_EVENT_STA_STOP:
ESP_LOGI(TAG, "wifi stopped\n");
break;
case SYSTEM_EVENT_STA_GOT_IP: {
uint8_t mac[6];
ESP_LOGI(TAG, "wifi got IP\n");
esp_wifi_get_mac(WIFI_IF_AP, mac);
ESP_LOGI(TAG, "~~~~~~~~~~~");
ESP_LOGI(TAG, "WIFIIP: "IPSTR, IP2STR(&event->event_info.got_ip.ip_info.ip));
ESP_LOGI(TAG, "WIFIPMASK: "IPSTR, IP2STR(&event->event_info.got_ip.ip_info.netmask));
ESP_LOGI(TAG, "WIFIPGW: "IPSTR, IP2STR(&event->event_info.got_ip.ip_info.gw));
ESP_LOGI(TAG, "WIFIMAC: %02x:%02x:%02x:%02x:%02x:%02x",
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
ESP_LOGI(TAG, "~~~~~~~~~~~");
xEventGroupSetBits(dvair_event_group, WIFI_CONNECTED_BIT);
break;
}
case SYSTEM_EVENT_STA_CONNECTED:
Code: Select all
I (572) dvair_wifi: wifi initializing...
I (572) wifi: wifi firmware version: 72ddf26
I (572) wifi: config NVS flash: enabled
I (572) wifi: config nano formating: disabled
I (582) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (592) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (622) wifi: Init dynamic tx buffer num: 32
I (622) wifi: Init dynamic rx buffer num: 32
I (622) wifi: wifi driver task: 3ffe8674, prio:23, stack:4096
I (622) wifi: Init static rx buffer num: 10
I (632) wifi: Init dynamic rx buffer num: 32
I (632) wifi: Init rx ampdu len mblock:7
I (632) wifi: Init lldesc rx ampdu entry mblock:4
I (642) wifi: wifi power manager task: 0x3ffe901c prio: 21 stack: 2560
I (642) dvair_wifi: Setting wifi configuration SSID SSID...
I (652) dvair_wifi: wifi initialized
I (662) wifi: wifi timer task: 3ffe94f4, prio:22, stack:3584
I (672) wifi: mode : sta (30:ae:a4:xx:xx:xx)
I (672) dvair_main: wifi started
Re: SYSTEM_EVENT_WIFI_READY not invoked
I take it back ... I was plain wrong ... apparently we will never see this event ... see:
http://esp-idf.readthedocs.io/en/latest ... wifi-ready
http://esp-idf.readthedocs.io/en/latest ... wifi-ready
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Re: SYSTEM_EVENT_WIFI_READY not invoked
Great research! I looked through *almost* all of the docs and code...
Robin
Robin
Who is online
Users browsing this forum: Eshwar487, nopnop2002 and 89 guests