[wifi] Fix error message when no custom MAC is set (#7515)
Some checks are pending
CI / Check flake8 (push) Blocked by required conditions
CI / Check pylint (push) Blocked by required conditions
CI / Check black (push) Blocked by required conditions
CI / Create common environment (push) Waiting to run
CI / Check pyupgrade (push) Blocked by required conditions
CI / Run script/ci-custom (push) Blocked by required conditions
CI / Run pytest (push) Blocked by required conditions
CI / Check clang-format (push) Blocked by required conditions
CI / Run script/clang-tidy for ESP32 Arduino 1/4 (push) Blocked by required conditions
CI / Run script/clang-tidy for ESP32 Arduino 2/4 (push) Blocked by required conditions
CI / Run script/clang-tidy for ESP32 Arduino 3/4 (push) Blocked by required conditions
CI / Run script/clang-tidy for ESP32 Arduino 4/4 (push) Blocked by required conditions
CI / Run script/clang-tidy for ESP32 IDF (push) Blocked by required conditions
CI / Run script/clang-tidy for ESP8266 (push) Blocked by required conditions
CI / list-components (push) Blocked by required conditions
CI / Component test (push) Blocked by required conditions
CI / Split components for testing into 20 groups maximum (push) Blocked by required conditions
CI / Test split components (push) Blocked by required conditions
CI / CI Status (push) Blocked by required conditions

This commit is contained in:
Keith Burzinski 2024-10-01 21:33:35 -05:00 committed by GitHub
parent 215f26fbe4
commit d00e0eb2d6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -44,9 +44,7 @@
#endif #endif
#ifdef USE_ESP32 #ifdef USE_ESP32
#include "esp32/rom/crc.h" #include "esp32/rom/crc.h"
#endif
#if defined(CONFIG_SOC_IEEE802154_SUPPORTED) || defined(USE_ESP32_IGNORE_EFUSE_MAC_CRC)
#include "esp_efuse.h" #include "esp_efuse.h"
#include "esp_efuse_table.h" #include "esp_efuse_table.h"
#endif #endif
@ -713,10 +711,11 @@ void set_mac_address(uint8_t *mac) { esp_base_mac_addr_set(mac); }
bool has_custom_mac_address() { bool has_custom_mac_address() {
#ifdef USE_ESP32 #ifdef USE_ESP32
uint8_t mac[6]; uint8_t mac[6];
#if defined(CONFIG_SOC_IEEE802154_SUPPORTED) || defined(USE_ESP32_IGNORE_EFUSE_MAC_CRC) // do not use 'esp_efuse_mac_get_custom(mac)' because it drops an error in the logs whenever it fails
return (esp_efuse_read_field_blob(ESP_EFUSE_MAC_CUSTOM, mac, 48) == ESP_OK) && mac_address_is_valid(mac); #ifndef USE_ESP32_VARIANT_ESP32
return (esp_efuse_read_field_blob(ESP_EFUSE_USER_DATA_MAC_CUSTOM, mac, 48) == ESP_OK) && mac_address_is_valid(mac);
#else #else
return (esp_efuse_mac_get_custom(mac) == ESP_OK) && mac_address_is_valid(mac); return (esp_efuse_read_field_blob(ESP_EFUSE_MAC_CUSTOM, mac, 48) == ESP_OK) && mac_address_is_valid(mac);
#endif #endif
#else #else
return false; return false;