mirror of
https://github.com/espressif/esp-idf.git
synced 2026-10-02 03:00:34 +03:00
Merge branch 'examples/vlan_test_fix_v6.0' into 'release/v6.0'
fix: Reorder Ethernet initialization in VLAN example (v6.0) See merge request espressif/esp-idf!43553
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2022-2023 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2022-2025 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
||||
*/
|
||||
@@ -128,16 +128,8 @@ void app_main(void)
|
||||
s_vlan_event_group = xEventGroupCreate();
|
||||
|
||||
static esp_vlan_netifs vlan_netif_list;
|
||||
|
||||
// Initialize Ethernet driver
|
||||
uint8_t eth_port_cnt = 0;
|
||||
esp_eth_handle_t *eth_handle;
|
||||
ESP_ERROR_CHECK(ethernet_init_all(ð_handle, ð_port_cnt));
|
||||
|
||||
// Check or multiple ethernet interface
|
||||
if (1 < eth_port_cnt) {
|
||||
ESP_LOGW(TAG, "Multiple Ethernet Interface detected: Only the first initialized interface is going to be used.");
|
||||
}
|
||||
|
||||
// Initialize TCP/IP network interface (should be called only once in application)
|
||||
ESP_ERROR_CHECK(esp_netif_init());
|
||||
@@ -145,6 +137,14 @@ void app_main(void)
|
||||
// Create default event loop that running in background
|
||||
ESP_ERROR_CHECK(esp_event_loop_create_default());
|
||||
|
||||
// Initialize Ethernet driver
|
||||
ESP_ERROR_CHECK(ethernet_init_all(ð_handle, ð_port_cnt));
|
||||
|
||||
// Check or multiple ethernet interface
|
||||
if (1 < eth_port_cnt) {
|
||||
ESP_LOGW(TAG, "Multiple Ethernet Interface detected: Only the first initialized interface is going to be used.");
|
||||
}
|
||||
|
||||
// Register user defined event handlers
|
||||
ESP_ERROR_CHECK(esp_event_handler_register(ETH_EVENT, ESP_EVENT_ANY_ID, ð_event_handler, NULL));
|
||||
ESP_ERROR_CHECK(esp_event_handler_register(IP_EVENT, IP_EVENT_ETH_GOT_IP, &got_ip_event_handler, NULL));
|
||||
|
||||
Reference in New Issue
Block a user