Merge pull request #740 from MichaelDvP/dev

fix render_value float, leading zeros to decimals
This commit is contained in:
Proddy
2022-11-10 06:36:37 -05:00
committed by GitHub

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;