Limit show CO2 index within 4 character number (max = 9999)

This commit is contained in:
Phat Nguyen
2024-03-24 07:43:40 +07:00
parent 063612e08f
commit e47096feac
2 changed files with 9 additions and 1 deletions

View File

@ -1453,6 +1453,10 @@ static void displayShowDashboard(String err) {
/** Show CO2 value */
u8g2.setFont(u8g2_font_t0_22b_tf);
if (co2Ppm > 0) {
int val = 9999;
if (co2Ppm < 10000) {
val = co2Ppm;
}
sprintf(strBuf, "%d", co2Ppm);
} else {
sprintf(strBuf, "%s", "-");