diff --git a/radio/src/strhelpers.cpp b/radio/src/strhelpers.cpp index 1ebc326fd..8dc14d4ba 100644 --- a/radio/src/strhelpers.cpp +++ b/radio/src/strhelpers.cpp @@ -452,10 +452,11 @@ char * strAppendUnsigned(char * dest, uint32_t value, uint8_t digits, uint8_t ra } } uint8_t idx = digits; - while(idx > 0) { + while (idx > 0) { + div_t qr = div(value, radix); uint32_t rem = value % radix; - dest[--idx] = (rem >= 10 ? 'A'-10 : '0') + rem; - value /= radix; + dest[--idx] = (qr.rem >= 10 ? 'A' - 10 : '0') + qr.rem; + value = qr.quot; } dest[digits] = '\0'; return &dest[digits];