1
0
mirror of https://github.com/esphome/esphome.git synced 2026-02-08 08:41:59 +00:00
This commit is contained in:
J. Nick Koston
2025-12-25 16:03:12 -10:00
parent ca652b2065
commit cae7163741

View File

@@ -695,8 +695,11 @@ inline char *int8_to_str(char *buf, int8_t val) {
if (v >= 100) {
*buf++ = '1'; // int8 max is 128, so hundreds digit is always 1
v -= 100;
}
if (v >= 10) {
// Must write tens digit (even if 0) after hundreds
int tens = v / 10;
*buf++ = '0' + tens;
v -= tens * 10;
} else if (v >= 10) {
int tens = v / 10;
*buf++ = '0' + tens;
v -= tens * 10;