[wifi] Fix error message when no custom MAC is set (#7515)

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
#ifdef USE_ESP32
#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_table.h"
#endif
@ -713,10 +711,11 @@ void set_mac_address(uint8_t *mac) { esp_base_mac_addr_set(mac); }
bool has_custom_mac_address() {
#ifdef USE_ESP32
uint8_t mac[6];
#if defined(CONFIG_SOC_IEEE802154_SUPPORTED) || defined(USE_ESP32_IGNORE_EFUSE_MAC_CRC)
return (esp_efuse_read_field_blob(ESP_EFUSE_MAC_CUSTOM, mac, 48) == ESP_OK) && mac_address_is_valid(mac);
// 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
return (esp_efuse_read_field_blob(ESP_EFUSE_USER_DATA_MAC_CUSTOM, mac, 48) == ESP_OK) && mac_address_is_valid(mac);
#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
#else
return false;