Просмотр исходного кода

Add user invisible kconfig for bt mac offset

Closes https://github.com/espressif/esp-idf/issues/5320
Wei Tian Hua 5 лет назад
Родитель
Сommit
6572959fd3
2 измененных файлов с 7 добавлено и 4 удалено
  1. 5 0
      components/esp_common/Kconfig
  2. 2 4
      components/esp_common/src/mac_addr.c

+ 5 - 0
components/esp_common/Kconfig

@@ -224,6 +224,11 @@ menu "Common ESP-related"
     config ESP_MAC_ADDR_UNIVERSE_BT
         bool
 
+    config ESP_MAC_ADDR_UNIVERSE_BT_OFFSET
+        int
+        default 2 if ESP32_UNIVERSAL_MAC_ADDRESSES_FOUR
+        default 1 if ESP32_UNIVERSAL_MAC_ADDRESSES_TWO
+
     config ESP_MAC_ADDR_UNIVERSE_ETH
         bool
 

+ 2 - 4
components/esp_common/src/mac_addr.c

@@ -185,11 +185,9 @@ esp_err_t esp_read_mac(uint8_t* mac, esp_mac_type_t type)
 #endif
         break;
     case ESP_MAC_BT:
-        memcpy(mac, efuse_mac, 6);
 #if CONFIG_ESP_MAC_ADDR_UNIVERSE_BT
-        mac[5] += 2;
-#else
-        mac[5] += 1;
+        memcpy(mac, efuse_mac, 6);
+        mac[5] += CONFIG_ESP_MAC_ADDR_UNIVERSE_BT_OFFSET;
 #endif
         break;
     case ESP_MAC_ETH: