[esp32] Add `ignore_efuse_custom_mac` config var (#7527)

This commit is contained in:
Keith Burzinski 2024-10-02 03:27:46 -05:00 committed by GitHub
parent d00e0eb2d6
commit 0d80286bb3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 1 deletions

View file

@ -13,6 +13,7 @@ from esphome.const import (
CONF_COMPONENTS, CONF_COMPONENTS,
CONF_ESPHOME, CONF_ESPHOME,
CONF_FRAMEWORK, CONF_FRAMEWORK,
CONF_IGNORE_EFUSE_CUSTOM_MAC,
CONF_IGNORE_EFUSE_MAC_CRC, CONF_IGNORE_EFUSE_MAC_CRC,
CONF_NAME, CONF_NAME,
CONF_PATH, CONF_PATH,
@ -401,6 +402,9 @@ ESP_IDF_FRAMEWORK_SCHEMA = cv.All(
}, },
cv.Optional(CONF_ADVANCED, default={}): cv.Schema( cv.Optional(CONF_ADVANCED, default={}): cv.Schema(
{ {
cv.Optional(
CONF_IGNORE_EFUSE_CUSTOM_MAC, default=False
): cv.boolean,
cv.Optional(CONF_IGNORE_EFUSE_MAC_CRC, default=False): cv.boolean, cv.Optional(CONF_IGNORE_EFUSE_MAC_CRC, default=False): cv.boolean,
} }
), ),
@ -526,6 +530,8 @@ async def to_code(config):
for name, value in conf[CONF_SDKCONFIG_OPTIONS].items(): for name, value in conf[CONF_SDKCONFIG_OPTIONS].items():
add_idf_sdkconfig_option(name, RawSdkconfigValue(value)) add_idf_sdkconfig_option(name, RawSdkconfigValue(value))
if conf[CONF_ADVANCED][CONF_IGNORE_EFUSE_CUSTOM_MAC]:
cg.add_define("USE_ESP32_IGNORE_EFUSE_CUSTOM_MAC")
if conf[CONF_ADVANCED][CONF_IGNORE_EFUSE_MAC_CRC]: if conf[CONF_ADVANCED][CONF_IGNORE_EFUSE_MAC_CRC]:
cg.add_define("USE_ESP32_IGNORE_EFUSE_MAC_CRC") cg.add_define("USE_ESP32_IGNORE_EFUSE_MAC_CRC")
if (framework_ver.major, framework_ver.minor) >= (4, 4): if (framework_ver.major, framework_ver.minor) >= (4, 4):

View file

@ -376,6 +376,7 @@ CONF_IDLE_ACTION = "idle_action"
CONF_IDLE_LEVEL = "idle_level" CONF_IDLE_LEVEL = "idle_level"
CONF_IDLE_TIME = "idle_time" CONF_IDLE_TIME = "idle_time"
CONF_IF = "if" CONF_IF = "if"
CONF_IGNORE_EFUSE_CUSTOM_MAC = "ignore_efuse_custom_mac"
CONF_IGNORE_EFUSE_MAC_CRC = "ignore_efuse_mac_crc" CONF_IGNORE_EFUSE_MAC_CRC = "ignore_efuse_mac_crc"
CONF_IGNORE_OUT_OF_RANGE = "ignore_out_of_range" CONF_IGNORE_OUT_OF_RANGE = "ignore_out_of_range"
CONF_IGNORE_PIN_VALIDATION_ERROR = "ignore_pin_validation_error" CONF_IGNORE_PIN_VALIDATION_ERROR = "ignore_pin_validation_error"

View file

@ -709,7 +709,7 @@ void set_mac_address(uint8_t *mac) { esp_base_mac_addr_set(mac); }
#endif #endif
bool has_custom_mac_address() { bool has_custom_mac_address() {
#ifdef USE_ESP32 #if defined(USE_ESP32) && !defined(USE_ESP32_IGNORE_EFUSE_CUSTOM_MAC)
uint8_t mac[6]; uint8_t mac[6];
// do not use 'esp_efuse_mac_get_custom(mac)' because it drops an error in the logs whenever it fails // do not use 'esp_efuse_mac_get_custom(mac)' because it drops an error in the logs whenever it fails
#ifndef USE_ESP32_VARIANT_ESP32 #ifndef USE_ESP32_VARIANT_ESP32