This commit is contained in:
J. Nick Koston
2025-11-23 22:42:07 -06:00
parent 39a4a0bf10
commit b8719319fe
2 changed files with 7 additions and 6 deletions
+1 -1
View File
@@ -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
+6 -5
View File
@@ -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
}