From c6a9edf8c7fdf0df8da46a5c9930748309e7cf89 Mon Sep 17 00:00:00 2001 From: Jonathan Bennett Date: Fri, 9 Aug 2024 01:43:13 -0500 Subject: [PATCH] Move printBytes to meshUtils (#4424) --- src/mesh/Router.cpp | 9 +-------- src/meshUtils.cpp | 8 ++++++++ src/meshUtils.h | 2 ++ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/mesh/Router.cpp b/src/mesh/Router.cpp index 87fcfe1b6..79095805d 100644 --- a/src/mesh/Router.cpp +++ b/src/mesh/Router.cpp @@ -7,6 +7,7 @@ #include "configuration.h" #include "main.h" #include "mesh-pb-constants.h" +#include "meshUtils.h" #include "modules/RoutingModule.h" #if !MESHTASTIC_EXCLUDE_MQTT #include "mqtt/MQTT.h" @@ -188,14 +189,6 @@ ErrorCode Router::sendLocal(meshtastic_MeshPacket *p, RxSource src) } } -void printBytes(const char *label, const uint8_t *p, size_t numbytes) -{ - LOG_DEBUG("%s: ", label); - for (size_t i = 0; i < numbytes; i++) - LOG_DEBUG("%02x ", p[i]); - LOG_DEBUG("\n"); -} - /** * Send a packet on a suitable interface. This routine will * later free() the packet to pool. This routine is not allowed to stall. diff --git a/src/meshUtils.cpp b/src/meshUtils.cpp index 59d4e6714..86d237129 100644 --- a/src/meshUtils.cpp +++ b/src/meshUtils.cpp @@ -56,4 +56,12 @@ char *strnstr(const char *s, const char *find, size_t slen) s--; } return ((char *)s); +} + +void printBytes(const char *label, const uint8_t *p, size_t numbytes) +{ + LOG_DEBUG("%s: ", label); + for (size_t i = 0; i < numbytes; i++) + LOG_DEBUG("%02x ", p[i]); + LOG_DEBUG("\n"); } \ No newline at end of file diff --git a/src/meshUtils.h b/src/meshUtils.h index e32ef230a..9dfe9b558 100644 --- a/src/meshUtils.h +++ b/src/meshUtils.h @@ -1,4 +1,6 @@ #pragma once +#include "DebugConfiguration.h" +#include /// C++ v17+ clamp function, limits a given value to a range defined by lo and hi template constexpr const T &clamp(const T &v, const T &lo, const T &hi)