From 17eed21eb3414c48acf360e48b296f941a118d28 Mon Sep 17 00:00:00 2001 From: simon Date: Sun, 23 Oct 2022 16:35:01 +0700 Subject: [PATCH] fix inaccurate sensor startup sleep --- aqi_monitor_py/sensor/sensor_sds011.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/aqi_monitor_py/sensor/sensor_sds011.py b/aqi_monitor_py/sensor/sensor_sds011.py index e3ab986..b3b99be 100644 --- a/aqi_monitor_py/sensor/sensor_sds011.py +++ b/aqi_monitor_py/sensor/sensor_sds011.py @@ -32,7 +32,9 @@ class SDS: def startup(self): """activate and set mode""" self.pm.active = 1 - sleep(0.5) + while self.pm.active.get("value") != 1: + sleep(0.5) + self.pm.mode = simple_sds011.MODE_PASSIVE print("warm up sensor") sleep(20)