1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-29 06:04:01 +00:00

[core] Optimize MAC address formatting to eliminate sprintf dependency (#10713)

This commit is contained in:
J. Nick Koston
2025-09-14 16:50:38 -05:00
committed by GitHub
parent 10a665b864
commit 9c85a7eff3
3 changed files with 40 additions and 8 deletions

View File

@@ -682,7 +682,9 @@ void EthernetComponent::get_eth_mac_address_raw(uint8_t *mac) {
std::string EthernetComponent::get_eth_mac_address_pretty() {
uint8_t mac[6];
get_eth_mac_address_raw(mac);
return str_snprintf("%02X:%02X:%02X:%02X:%02X:%02X", 17, mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]);
char buf[18];
format_mac_addr_upper(mac, buf);
return std::string(buf);
}
eth_duplex_t EthernetComponent::get_duplex_mode() {