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

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