From da16093032a765e8fc9988c00056620bddcf4629 Mon Sep 17 00:00:00 2001 From: nur Date: Sat, 26 Dec 2020 19:37:22 +0800 Subject: [PATCH] Fix sending SENSEAIR_INVALID_RESPONSE --- Source/zcl_app.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Source/zcl_app.c b/Source/zcl_app.c index dc92b3a..911d544 100644 --- a/Source/zcl_app.c +++ b/Source/zcl_app.c @@ -308,13 +308,17 @@ static void zclApp_ReadSensors(void) { switch (sensorType) { case SENSEAIR: SenseAir_Read(&co2); - zclApp_Sensors.CO2_PPM = co2; - zclApp_Sensors.CO2 = (double)co2 / 1000000.0; + if (co2 != SENSEAIR_INVALID_RESPONSE) { + zclApp_Sensors.CO2_PPM = co2; + zclApp_Sensors.CO2 = (double)co2 / 1000000.0; + } break; case MHZ19: MHZ19_Read(&co2); - zclApp_Sensors.CO2_PPM = co2; - zclApp_Sensors.CO2 = (double)co2 / 1000000.0; + if (co2 != SENSEAIR_INVALID_RESPONSE) { + zclApp_Sensors.CO2_PPM = co2; + zclApp_Sensors.CO2 = (double)co2 / 1000000.0; + } break; default: