kopia lustrzana https://github.com/meshtastic/firmware
Build message in printBytes, to not spam BLE log (#4843)
rodzic
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)
|
||||
{
|
||||
LOG_DEBUG("%s: ", label);
|
||||
for (size_t i = 0; i < numbytes; i++)
|
||||
LOG_DEBUG("%02x ", p[i]);
|
||||
LOG_DEBUG("\n");
|
||||
char *messageBuffer;
|
||||
int labelSize = strlen(label);
|
||||
if (labelSize < 100 && numbytes < 64) {
|
||||
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)
|
||||
|
|
Ładowanie…
Reference in New Issue