mirror of
https://github.com/esphome/esphome.git
synced 2026-09-15 00:58:40 +00:00
cleanup
This commit is contained in:
@@ -87,7 +87,7 @@ void MDNSComponent::compile_records_(StaticVector<MDNSService, MDNS_SERVICE_COUN
|
||||
}
|
||||
txt_records.push_back({MDNS_STR(TXT_VERSION), MDNS_STR(VALUE_VERSION)});
|
||||
|
||||
// MAC address: passed as parameter from setup(), lives in caller's stack frame
|
||||
// MAC address: passed from caller (either member buffer or stack buffer depending on USE_MDNS_STORE_SERVICES)
|
||||
txt_records.push_back({MDNS_STR(TXT_MAC), MDNS_STR(mac_address_buf)});
|
||||
|
||||
#ifdef USE_ESP8266
|
||||
|
||||
@@ -71,13 +71,14 @@ class MDNSComponent : public Component {
|
||||
protected:
|
||||
/// Common setup logic called by all platform-specific setup() implementations
|
||||
void on_setup_(char *mac_address_buf) {
|
||||
#if defined(USE_API) && defined(USE_MDNS_STORE_SERVICES)
|
||||
// Populate MAC address buffer once during setup (only needed if storing services)
|
||||
get_mac_address_into_buffer(std::span<char, MAC_ADDRESS_BUFFER_SIZE>(this->mac_address_));
|
||||
#endif
|
||||
|
||||
#ifdef USE_MDNS_STORE_SERVICES
|
||||
#ifdef USE_API
|
||||
// Copy to member buffer for storage
|
||||
std::memcpy(this->mac_address_, mac_address_buf, MAC_ADDRESS_BUFFER_SIZE);
|
||||
this->compile_records_(this->services_, this->mac_address_);
|
||||
#else
|
||||
this->compile_records_(this->services_, mac_address_buf);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user