mirror of
https://github.com/esphome/esphome.git
synced 2026-08-31 01:56:01 +00:00
Merge branch 'esp32-tracker-parser-cleanup' into esp32-tracker-retire-scanner-listener
This commit is contained in:
@@ -8,7 +8,6 @@
|
||||
|
||||
#ifndef CONFIG_ESP_HOSTED_ENABLE_BT_BLUEDROID
|
||||
#include <esp_bt.h>
|
||||
#include <esp_mac.h>
|
||||
#else
|
||||
#include "esphome/components/watchdog/watchdog.h"
|
||||
#include <cinttypes>
|
||||
@@ -676,27 +675,25 @@ void ESP32BLE::gattc_event_handler(esp_gattc_cb_event_t event, esp_gatt_if_t gat
|
||||
#endif
|
||||
|
||||
void ESP32BLE::get_mac_msb_first(uint8_t out[6]) {
|
||||
#ifdef CONFIG_ESP_HOSTED_ENABLE_BT_BLUEDROID
|
||||
// The adapter MAC lives in the remote chip's efuse, so only the running
|
||||
// stack knows it.
|
||||
// The running stack owns the address (on hosted controllers it lives in
|
||||
// the remote chip's efuse); null before init becomes all-zero.
|
||||
const uint8_t *mac = esp_bt_dev_get_address();
|
||||
if (mac != nullptr) {
|
||||
memcpy(out, mac, 6);
|
||||
} else {
|
||||
memset(out, 0, 6);
|
||||
}
|
||||
#else
|
||||
// IDF owns the BT-offset derivation (base + 2 with four universal MACs,
|
||||
// base + 1 with two); works before the BT stack is up.
|
||||
esp_read_mac(out, ESP_MAC_BT);
|
||||
#endif
|
||||
}
|
||||
|
||||
float ESP32BLE::get_setup_priority() const { return setup_priority::BLUETOOTH; }
|
||||
|
||||
void ESP32BLE::dump_config() {
|
||||
const uint8_t *mac_address = esp_bt_dev_get_address();
|
||||
if (mac_address) {
|
||||
uint8_t mac_address[6];
|
||||
this->get_mac_msb_first(mac_address);
|
||||
bool mac_known = false;
|
||||
for (uint8_t b : mac_address)
|
||||
mac_known |= b != 0;
|
||||
if (mac_known) {
|
||||
const char *io_capability_s;
|
||||
switch (this->io_cap_) {
|
||||
case ESP_IO_CAP_OUT:
|
||||
|
||||
@@ -108,8 +108,7 @@ class ESP32BLE final : public Component {
|
||||
void setup() override;
|
||||
void loop() override;
|
||||
void dump_config() override;
|
||||
/// Adapter MAC in printable (MSB-first) order. Hosted controllers only
|
||||
/// know it once the stack is up; all-zero means unavailable.
|
||||
/// Adapter MAC in printable (MSB-first) order; all-zero until the stack is up.
|
||||
void get_mac_msb_first(uint8_t out[6]);
|
||||
float get_setup_priority() const override;
|
||||
void set_name(const char *name) { this->name_ = name; }
|
||||
|
||||
Reference in New Issue
Block a user