1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-19 19:52:20 +01:00

[api] Dump bytes fields as hex instead of unreadable string (#9288)

This commit is contained in:
Jesse Hills
2025-07-02 13:36:15 +12:00
committed by GitHub
parent 04a46de237
commit 6a096c1d5a
4 changed files with 34 additions and 15 deletions

View File

@@ -348,6 +348,8 @@ std::string format_hex_pretty(const uint16_t *data, size_t length);
std::string format_hex_pretty(const std::vector<uint8_t> &data);
/// Format the vector \p data in pretty-printed, human-readable hex.
std::string format_hex_pretty(const std::vector<uint16_t> &data);
/// Format the string \p data in pretty-printed, human-readable hex.
std::string format_hex_pretty(const std::string &data);
/// Format an unsigned integer in pretty-printed, human-readable hex, starting with the most significant byte.
template<typename T, enable_if_t<std::is_unsigned<T>::value, int> = 0> std::string format_hex_pretty(T val) {
val = convert_big_endian(val);