mirror of
https://github.com/meshtastic/firmware.git
synced 2025-06-09 06:32:06 +00:00
Build message in printBytes, to not spam BLE log (#4843)
This commit is contained in:
parent
428a567078
commit
c39d270f40
@ -60,10 +60,17 @@ char *strnstr(const char *s, const char *find, size_t slen)
|
|||||||
|
|
||||||
void printBytes(const char *label, const uint8_t *p, size_t numbytes)
|
void printBytes(const char *label, const uint8_t *p, size_t numbytes)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("%s: ", label);
|
char *messageBuffer;
|
||||||
for (size_t i = 0; i < numbytes; i++)
|
int labelSize = strlen(label);
|
||||||
LOG_DEBUG("%02x ", p[i]);
|
if (labelSize < 100 && numbytes < 64) {
|
||||||
LOG_DEBUG("\n");
|
messageBuffer = new char[labelSize + (numbytes * 3) + 2];
|
||||||
|
strncpy(messageBuffer, label, labelSize);
|
||||||
|
for (size_t i = 0; i < numbytes; i++)
|
||||||
|
snprintf(messageBuffer + labelSize + i * 3, 4, " %02x", p[i]);
|
||||||
|
strcpy(messageBuffer + labelSize + numbytes * 3, "\n");
|
||||||
|
LOG_DEBUG(messageBuffer);
|
||||||
|
delete messageBuffer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool memfll(const uint8_t *mem, uint8_t find, size_t numbytes)
|
bool memfll(const uint8_t *mem, uint8_t find, size_t numbytes)
|
||||||
|
Loading…
Reference in New Issue
Block a user