Merge remote-tracking branch 'upstream/api-dump-progmem' into integration

This commit is contained in:
J. Nick Koston
2026-03-19 12:41:04 -10:00
2 changed files with 8 additions and 20 deletions
+4 -10
View File
@@ -60,53 +60,47 @@ class MessageDumpHelper {
// Helper functions to reduce code duplication in dump methods
// field_name parameters are PROGMEM pointers (flash on ESP8266, regular pointers on other platforms)
// NOLINT: not all overloads are used in every build (depends on enabled components)
// NOLINTNEXTLINE(clang-diagnostic-unused-function)
// Not all overloads are used in every build (depends on enabled components)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
static void dump_field(DumpBuffer &out, const char *field_name, int32_t value, int indent = 2) {
append_field_prefix(out, field_name, indent);
out.set_pos(buf_append_printf(out.data(), DumpBuffer::CAPACITY, out.pos(), "%" PRId32 "\n", value));
}
// NOLINTNEXTLINE(clang-diagnostic-unused-function)
static void dump_field(DumpBuffer &out, const char *field_name, uint32_t value, int indent = 2) {
append_field_prefix(out, field_name, indent);
out.set_pos(buf_append_printf(out.data(), DumpBuffer::CAPACITY, out.pos(), "%" PRIu32 "\n", value));
}
// NOLINTNEXTLINE(clang-diagnostic-unused-function)
static void dump_field(DumpBuffer &out, const char *field_name, float value, int indent = 2) {
append_field_prefix(out, field_name, indent);
out.set_pos(buf_append_printf(out.data(), DumpBuffer::CAPACITY, out.pos(), "%g\n", value));
}
// NOLINTNEXTLINE(clang-diagnostic-unused-function)
static void dump_field(DumpBuffer &out, const char *field_name, uint64_t value, int indent = 2) {
append_field_prefix(out, field_name, indent);
out.set_pos(buf_append_printf(out.data(), DumpBuffer::CAPACITY, out.pos(), "%" PRIu64 "\n", value));
}
// NOLINTNEXTLINE(clang-diagnostic-unused-function)
static void dump_field(DumpBuffer &out, const char *field_name, bool value, int indent = 2) {
append_field_prefix(out, field_name, indent);
out.append(YESNO(value));
out.append("\n");
}
// NOLINTNEXTLINE(clang-diagnostic-unused-function)
static void dump_field(DumpBuffer &out, const char *field_name, const std::string &value, int indent = 2) {
append_field_prefix(out, field_name, indent);
out.append("'").append(value.c_str()).append("'");
out.append("\n");
}
// NOLINTNEXTLINE(clang-diagnostic-unused-function)
static void dump_field(DumpBuffer &out, const char *field_name, StringRef value, int indent = 2) {
append_field_prefix(out, field_name, indent);
append_quoted_string(out, value);
out.append("\n");
}
// NOLINTNEXTLINE(clang-diagnostic-unused-function)
static void dump_field(DumpBuffer &out, const char *field_name, const char *value, int indent = 2) {
append_field_prefix(out, field_name, indent);
out.append("'").append(value).append("'");
@@ -123,13 +117,13 @@ template<typename T> static void dump_field(DumpBuffer &out, const char *field_n
// Helper for bytes fields - uses stack buffer to avoid heap allocation
// Buffer sized for 160 bytes of data (480 chars with separators) to fit typical log buffer
// field_name is a PROGMEM pointer (flash on ESP8266, regular pointer on other platforms)
// NOLINTNEXTLINE(clang-diagnostic-unused-function)
static void dump_bytes_field(DumpBuffer &out, const char *field_name, const uint8_t *data, size_t len, int indent = 2) {
char hex_buf[format_hex_pretty_size(160)];
append_field_prefix(out, field_name, indent);
format_hex_pretty_to(hex_buf, data, len);
out.append(hex_buf).append("\n");
}
#pragma GCC diagnostic pop
template<> const char *proto_enum_to_string<enums::SerialProxyPortType>(enums::SerialProxyPortType value) {
switch (value) {
+4 -10
View File
@@ -2752,53 +2752,47 @@ class MessageDumpHelper {
// Helper functions to reduce code duplication in dump methods
// field_name parameters are PROGMEM pointers (flash on ESP8266, regular pointers on other platforms)
// NOLINT: not all overloads are used in every build (depends on enabled components)
// NOLINTNEXTLINE(clang-diagnostic-unused-function)
// Not all overloads are used in every build (depends on enabled components)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function"
static void dump_field(DumpBuffer &out, const char *field_name, int32_t value, int indent = 2) {
append_field_prefix(out, field_name, indent);
out.set_pos(buf_append_printf(out.data(), DumpBuffer::CAPACITY, out.pos(), "%" PRId32 "\\n", value));
}
// NOLINTNEXTLINE(clang-diagnostic-unused-function)
static void dump_field(DumpBuffer &out, const char *field_name, uint32_t value, int indent = 2) {
append_field_prefix(out, field_name, indent);
out.set_pos(buf_append_printf(out.data(), DumpBuffer::CAPACITY, out.pos(), "%" PRIu32 "\\n", value));
}
// NOLINTNEXTLINE(clang-diagnostic-unused-function)
static void dump_field(DumpBuffer &out, const char *field_name, float value, int indent = 2) {
append_field_prefix(out, field_name, indent);
out.set_pos(buf_append_printf(out.data(), DumpBuffer::CAPACITY, out.pos(), "%g\\n", value));
}
// NOLINTNEXTLINE(clang-diagnostic-unused-function)
static void dump_field(DumpBuffer &out, const char *field_name, uint64_t value, int indent = 2) {
append_field_prefix(out, field_name, indent);
out.set_pos(buf_append_printf(out.data(), DumpBuffer::CAPACITY, out.pos(), "%" PRIu64 "\\n", value));
}
// NOLINTNEXTLINE(clang-diagnostic-unused-function)
static void dump_field(DumpBuffer &out, const char *field_name, bool value, int indent = 2) {
append_field_prefix(out, field_name, indent);
out.append(YESNO(value));
out.append("\\n");
}
// NOLINTNEXTLINE(clang-diagnostic-unused-function)
static void dump_field(DumpBuffer &out, const char *field_name, const std::string &value, int indent = 2) {
append_field_prefix(out, field_name, indent);
out.append("'").append(value.c_str()).append("'");
out.append("\\n");
}
// NOLINTNEXTLINE(clang-diagnostic-unused-function)
static void dump_field(DumpBuffer &out, const char *field_name, StringRef value, int indent = 2) {
append_field_prefix(out, field_name, indent);
append_quoted_string(out, value);
out.append("\\n");
}
// NOLINTNEXTLINE(clang-diagnostic-unused-function)
static void dump_field(DumpBuffer &out, const char *field_name, const char *value, int indent = 2) {
append_field_prefix(out, field_name, indent);
out.append("'").append(value).append("'");
@@ -2815,13 +2809,13 @@ template<typename T> static void dump_field(DumpBuffer &out, const char *field_n
// Helper for bytes fields - uses stack buffer to avoid heap allocation
// Buffer sized for 160 bytes of data (480 chars with separators) to fit typical log buffer
// field_name is a PROGMEM pointer (flash on ESP8266, regular pointer on other platforms)
// NOLINTNEXTLINE(clang-diagnostic-unused-function)
static void dump_bytes_field(DumpBuffer &out, const char *field_name, const uint8_t *data, size_t len, int indent = 2) {
char hex_buf[format_hex_pretty_size(160)];
append_field_prefix(out, field_name, indent);
format_hex_pretty_to(hex_buf, data, len);
out.append(hex_buf).append("\\n");
}
#pragma GCC diagnostic pop
"""