a) you should not call esp_event_loop_create_default()insidethat function and b) you have a memory leak the size of one event group per call. To be clear: It's never tooearlyto call esp_event_loop_create_default(). It doesn't have to be donein-betweenany of the WiFi setup funct...
If I replace esp_event_loop_create_default with esp_event_loop_init(nullptr, nullptr), which I understand is deprecated, the error goes away and everything still works fine. The strangest thing is that when I created a new project to test this, neither esp_event_loop_create_default nor ...
MAC2STR(event->mac), event->aid); } }voidwifi_init_softap(void){ ESP_ERROR_CHECK(esp_netif_init()); ESP_ERROR_CHECK(esp_event_loop_create_default()); esp_netif_create_default_wifi_ap();wifi_init_config_tcfg = WIFI_INIT_CONFIG_DEFAULT(); ESP_ERROR_CHECK(esp_wifi_init(&cfg)); ...
esp_netif_create_default_wifi_ap 或 esp_netif_create_default_wifi_sta 函数实际上调用了宏—— ESP_NETIF_DEFAULT_WIFI_AP、ESP_NETIF_DEFAULT_WIFI_STA,用默认的值配置后,用 esp_netif_new 函数创建 esp_netif_t;然后调用 esp_netif_attach_wifi_station 或 esp_netif_attach_wifi_ap 函数,把驱动关联到...
ESP_ERROR_CHECK(esp_event_loop_create_default()); esp_netif_config_t cfg = ESP_NETIF_DEFAULT_ETH(); esp_netif_t *eth_netif = esp_netif_new(&cfg); // 设置默认处理程序来处理TCP/IP内容 // Set default handlers to process TCP/IP stuffs ...
Many components depend on the event loop being initialised, so you should do it once early in your main initialisation. Repeated calls will return ESP_ERR_INVALID_STATE. Is there another esp_event_loop_create_default() somewhere before this wifiInit()?
//首先调用esp_event_loop_create_default() 创建默认事件循环。 //之后使用esp_event_handler_register() 将事件处理程序注册到系统事件循环。 ESP_ERROR_CHECK( esp_event_handler_register(WIFI_EVENT, ESP_EVENT_ANY_ID, &event_handler, NULL) ); ...
} Event_ID; void Task0(void *pvParam) { char *Event_Data = "Task0_Event"; esp_event_post_to(event_loop_handler, TASK0_BASE, Event_N_1, (void *)Event_Data, strlen(Event_Data) + 1, portMAX_DELAY); while (true) { vTaskDelay(1000 / portTICK_PERIOD_MS); ...
//首先调用esp_event_loop_create_default()创建默认事件循环。 //之后使用esp_event_handler_register()将事件处理程序注册到系统事件循环。 ESP_ERROR_CHECK(esp_event_handler_register(WIFI_EVENT,ESP_EVENT_ANY_ID,&event_handler,NULL)); ESP_ERROR_CHECK(esp_event_handler_register(IP_EVENT,IP_EVENT_STA...
调用esp_event_loop_create_default()创建默认事件循环。之后使用esp_event_handler_register()将事件处理程序注册到系统事件循环,详情见上一小节 1.3 WiFi事件的注册、响应、信息获取 部分。 在示例中: 在这里插入图片描述 初始化WiFi 和 配置WiFi 使用esp_wifi_init进行 WiFi 初始化。 在示例中,先是使用了默认配...