Fixed OTA Ethernet bug
All checks were successful
Test compiling project / test (push) Successful in 2m28s
All checks were successful
Test compiling project / test (push) Successful in 2m28s
This commit is contained in:
38
documentation/old.md
Normal file
38
documentation/old.md
Normal file
@@ -0,0 +1,38 @@
|
||||
extern "C" {
|
||||
#include "lwip/netif.h"
|
||||
}
|
||||
|
||||
void listNetworkInterfaces() {
|
||||
esp_netif_t *netif = NULL;
|
||||
Serial.println("\n=== Listing Network Interfaces ===");
|
||||
|
||||
for (netif = esp_netif_next(NULL); netif != NULL; netif = esp_netif_next(netif)) {
|
||||
const char* if_key = esp_netif_get_ifkey(netif);
|
||||
const char* if_desc = esp_netif_get_desc(netif);
|
||||
|
||||
Serial.printf("Interface Key: %s\n", if_key);
|
||||
Serial.printf("Description : %s\n", if_desc);
|
||||
Serial.println("-----------------------------");
|
||||
}
|
||||
}
|
||||
|
||||
void setEthernetAsDefault() {
|
||||
Log.verbose("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
|
||||
listNetworkInterfaces();
|
||||
// Attempt to locate the Ethernet network interface.
|
||||
// (The name may vary—on some systems it might be "eth0")
|
||||
esp_netif_t* netif = esp_netif_get_handle_from_ifkey("ETH_DEF");
|
||||
|
||||
if (netif) {
|
||||
Serial.println("Netif handle obtained successfully.");
|
||||
} else {
|
||||
Serial.println("Failed to obtain netif handle.");
|
||||
}
|
||||
struct netif *eth_netif2 = netif_find("ETH_DEF");
|
||||
if (netif) {
|
||||
netif_set_default(eth_netif2);
|
||||
Log.verbose("Ethernet set as default network interface.");
|
||||
} else {
|
||||
Log.verbose("Could not find Ethernet netif.");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user