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:
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:
and the logs look like:
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
Robin