From 62d4adb482bf4a63b21adaef394dcc60e0a529bb Mon Sep 17 00:00:00 2001 From: chenjianxing Date: Thu, 25 Aug 2022 14:26:14 +0800 Subject: [PATCH] esp_wifi: fix espnow example add peer fail when config channel Closes https://github.com/espressif/esp-idf/issues/9592 --- examples/wifi/espnow/main/espnow_example_main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/examples/wifi/espnow/main/espnow_example_main.c b/examples/wifi/espnow/main/espnow_example_main.c index 1d4e84d419bd..38bbecacf835 100644 --- a/examples/wifi/espnow/main/espnow_example_main.c +++ b/examples/wifi/espnow/main/espnow_example_main.c @@ -51,6 +51,7 @@ static void example_wifi_init(void) ESP_ERROR_CHECK( esp_wifi_set_storage(WIFI_STORAGE_RAM) ); ESP_ERROR_CHECK( esp_wifi_set_mode(ESPNOW_WIFI_MODE) ); ESP_ERROR_CHECK( esp_wifi_start()); + ESP_ERROR_CHECK( esp_wifi_set_channel(CONFIG_ESPNOW_CHANNEL, WIFI_SECOND_CHAN_NONE)); #if CONFIG_ESPNOW_ENABLE_LONG_RANGE ESP_ERROR_CHECK( esp_wifi_set_protocol(ESPNOW_WIFI_IF, WIFI_PROTOCOL_11B|WIFI_PROTOCOL_11G|WIFI_PROTOCOL_11N|WIFI_PROTOCOL_LR) );