From dfd9d79db2908e41a673068be2ae74b14e92e0fa Mon Sep 17 00:00:00 2001 From: Alejandro Casanova Date: Wed, 28 Jan 2026 10:16:44 +0100 Subject: [PATCH] feat: improve hex printing consistency and add leading zeros only to reach full bytes --- ArduinoLog.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ArduinoLog.cpp b/ArduinoLog.cpp index f8ae7e8..48fdfc6 100644 --- a/ArduinoLog.cpp +++ b/ArduinoLog.cpp @@ -196,11 +196,11 @@ void Logging::printFormat(const char format, va_list *args) { { _logOutput->print("0x"); //_logOutput->print(va_arg(*args, int), HEX); - uint16_t h = (uint16_t) va_arg( *args, int ); - if (h<0xFFF) _logOutput->print('0'); - if (h<0xFF ) _logOutput->print('0'); - if (h<0xF ) _logOutput->print('0'); - _logOutput->print(h,HEX); + uint16_t h = (uint16_t) va_arg( *args, int ); + if (h <= 0xF) _logOutput->print('0'); + else if (h <= 0xFF); // Do nothing + else if (h <= 0xFFF) _logOutput->print('0'); + _logOutput->print(h,HEX); } else if (format == 'p') {