1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-01 17:42:22 +01:00

[wifi] Use custom MAC address if programmed (#7498)

This commit is contained in:
Keith Burzinski
2024-09-26 17:24:18 -05:00
committed by GitHub
parent 3df25a183a
commit 529ff4bd52
3 changed files with 57 additions and 3 deletions

View File

@@ -130,11 +130,16 @@ void event_handler(void *arg, esp_event_base_t event_base, int32_t event_id, voi
}
void WiFiComponent::wifi_pre_setup_() {
#ifdef USE_ESP32_IGNORE_EFUSE_MAC_CRC
uint8_t mac[6];
#ifdef USE_ESP32_IGNORE_EFUSE_MAC_CRC
get_mac_address_raw(mac);
set_mac_address(mac);
ESP_LOGV(TAG, "Use EFuse MAC without checking CRC: %s", get_mac_address_pretty().c_str());
#else
if (has_custom_mac_address()) {
get_mac_address_raw(mac);
set_mac_address(mac);
}
#endif
esp_err_t err = esp_netif_init();
if (err != ERR_OK) {