Skip to content

Commit

Permalink
Fix type error causing compilation error
Browse files Browse the repository at this point in the history
  • Loading branch information
lewisxhe committed Apr 6, 2024
1 parent eeb0424 commit 007ecd8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/SensorWireHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,29 +88,29 @@ void SensorWireHelper::dumpDevices(TwoWire &w, Stream &serial, int first, int la
void SensorWireHelper::hexdump(uint8_t *data, size_t len, Stream &serial)
{
size_t rem_len = len;
for (int i = 0; i < len; i += 16) {
for (size_t i = 0; i < len; i += 16) {
char str[80];
snprintf(str, 80, "%07x ", i);
size_t line_len = 16;
if (rem_len < line_len) {
line_len = rem_len;
}
for (int j = 0; j < line_len; j++) {
for (size_t j = 0; j < line_len; j++) {
snprintf(&str[8 + j * 3], 80, "%02x ", data[i + j]);
}
for (int j = line_len; j < 16; j++) {
for (size_t j = line_len; j < 16; j++) {
snprintf(&str[8 + j * 3], 80, " ");
}
str[56] = '|';
str[57] = ' ';
for (int j = 0; j < line_len; j++) {
for (size_t j = 0; j < line_len; j++) {
char c = data[i + j];
if ((c < ' ') || (c > '~')) {
c = '.';
}
snprintf(&str[58 + j], 80, "%c", c);
}
for (int j = line_len; j < 16; j++) {
for (size_t j = line_len; j < 16; j++) {
snprintf(&str[58 + j], 80, " ");
}
serial.println(str);
Expand Down

0 comments on commit 007ecd8

Please sign in to comment.