fix render_value float, leading zeros to decimals

This commit is contained in:
MichaelDvP
2022-11-10 12:17:05 +01:00
parent 551497bfeb
commit aeee37fdae

View File

@@ -262,6 +262,11 @@ char * Helpers::render_value(char * result, const float value, const int8_t form
*result++ = '.';
int32_t decimal = abs((int32_t)((value - whole) * p[format]));
for (int8_t i = 1; i < format; i++) {
if (decimal < p[i]) {
*result++ = '0'; // add leading zeros
}
}
itoa(decimal, result, 10);
return ret;