From f4ac176d771981a23bcf8c9bebdca6d1d5f17289 Mon Sep 17 00:00:00 2001 From: Stijn Tintel Date: Tue, 8 Aug 2023 01:45:50 +0300 Subject: [PATCH] core: read ESP32 MAC address from eFuse if IEEE802.15.4 is supported (#5176) --- esphome/core/helpers.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/esphome/core/helpers.cpp b/esphome/core/helpers.cpp index 0bc762fd0d..c65928556a 100644 --- a/esphome/core/helpers.cpp +++ b/esphome/core/helpers.cpp @@ -38,7 +38,7 @@ #include "esp32/rom/crc.h" #endif -#ifdef USE_ESP32_IGNORE_EFUSE_MAC_CRC +#if defined(CONFIG_SOC_IEEE802154_SUPPORTED) || defined(USE_ESP32_IGNORE_EFUSE_MAC_CRC) #include "esp_efuse.h" #include "esp_efuse_table.h" #endif @@ -540,7 +540,9 @@ bool HighFrequencyLoopRequester::is_high_frequency() { return num_requests > 0; void get_mac_address_raw(uint8_t *mac) { // NOLINT(readability-non-const-parameter) #if defined(USE_ESP32) -#if defined(USE_ESP32_IGNORE_EFUSE_MAC_CRC) +#if defined(CONFIG_SOC_IEEE802154_SUPPORTED) || defined(USE_ESP32_IGNORE_EFUSE_MAC_CRC) + // When CONFIG_SOC_IEEE802154_SUPPORTED is defined, esp_efuse_mac_get_default + // returns the 802.15.4 EUI-64 address. Read directly from eFuse instead. // On some devices, the MAC address that is burnt into EFuse does not // match the CRC that goes along with it. For those devices, this // work-around reads and uses the MAC address as-is from EFuse,