/// © MiroZ 2024

#include <stdint.h>
#include <Arduino.h>

static const char *TAG  = "utils";

void dump_bytes(const void *data, uint32_t len)
{
	char c[128] = {0};
	char b[32];

	uint8_t *pt = (uint8_t*)data;
	bool hasMore = false;
	for (int n = 0; n < len; n++)
	{
		sprintf(b, "%02x ", *pt++);
		strcat(c, b);
		hasMore = true;
		if ((n + 1) % 8 == 0)
		{
			ESP_LOGI(TAG, "%s", c);
			c[0] = 0;
			hasMore = false;
		}
	}
	if (hasMore)
		ESP_LOGI(TAG, "%s", c);
}
