Use avg value for display and led bar

This commit is contained in:
samuelbles07
2024-11-10 04:13:58 +07:00
parent a513943cba
commit a30535f75f
4 changed files with 24 additions and 17 deletions
+4 -3
View File
@@ -86,7 +86,7 @@ bool StateMachine::sensorhandleLeds(void) {
*/
int StateMachine::co2handleLeds(void) {
int totalUsed = ag->ledBar.getNumberOfLeds();
int co2Value = value.get(Measurements::CO2);
int co2Value = round(value.getAverage(Measurements::CO2));
if (co2Value <= 700) {
/** G; 1 */
ag->ledBar.setColor(RGB_COLOR_G, ag->ledBar.getNumberOfLeds() - 1);
@@ -171,9 +171,10 @@ int StateMachine::co2handleLeds(void) {
*/
int StateMachine::pm25handleLeds(void) {
int totalUsed = ag->ledBar.getNumberOfLeds();
int pm25Value = value.get(Measurements::PM25);
int pm25Value = round(value.getFloat(Measurements::PM25));
if (config.hasSensorSHT && config.isPMCorrectionEnabled()) {
pm25Value = (int)value.getCorrectedPM25(*ag, config);
pm25Value = round(value.getCorrectedPM25(*ag, config, true));
}
if (pm25Value <= 5) {