Fix extra space in non-decimal numbers

Fix extra space in non-decimal numbers (#16365)
This commit is contained in:
Theo Arends 2022-08-28 14:51:32 +02:00
parent 5b1b4d11de
commit 212cbe7d85

View File

@ -335,7 +335,8 @@ int32_t ext_vsnprintf_P(char * out_buf, size_t buf_len, const char * fmt_P, va_l
if (isnan(number) || isinf(number)) {
new_val_str = "null";
} else {
dtostrf(*(float*)cur_val, (decimals + 2), decimals, hex);
uint32_t len = (decimals) ? decimals +2 : 1;
dtostrf(*(float*)cur_val, len, decimals, hex);
if (truncate) {
uint32_t last = strlen(hex) - 1;