Replaced exception pass with log warning
authorPhil Howard <phil@gadgetoid.com>
Tue, 20 Aug 2019 15:34:23 +0000 (16:34 +0100)
committerPhil Howard <phil@gadgetoid.com>
Tue, 20 Aug 2019 15:34:23 +0000 (16:34 +0100)
examples/all-in-one.py

index 85a9a155ce8e7c12860f64c3e394cc0bfabe056b..eef99c36b7eea36846073685af9f371823e5642b 100755 (executable)
@@ -102,7 +102,7 @@ factor = 0.8
 cpu_temps = [get_cpu_temperature()] * 5
 
 delay = 0.5  # Debounce the proximity tap
 cpu_temps = [get_cpu_temperature()] * 5
 
 delay = 0.5  # Debounce the proximity tap
-mode = 0  # The starting mode
+mode = 0     # The starting mode
 last_page = 0
 light = 1
 
 last_page = 0
 light = 1
 
@@ -194,7 +194,7 @@ try:
             try:
                 data = pms5003.read()
             except pmsReadTimeoutError:
             try:
                 data = pms5003.read()
             except pmsReadTimeoutError:
-                pass
+                logging.warn("Failed to read PMS5003")
             else:
                 data = data.pm_ug_per_m3(1.0)
                 display_text(variables[mode], data, unit)
             else:
                 data = data.pm_ug_per_m3(1.0)
                 display_text(variables[mode], data, unit)
@@ -205,7 +205,7 @@ try:
             try:
                 data = pms5003.read()
             except pmsReadTimeoutError:
             try:
                 data = pms5003.read()
             except pmsReadTimeoutError:
-                pass
+                logging.warn("Failed to read PMS5003")
             else:
                 data = data.pm_ug_per_m3(2.5)
                 display_text(variables[mode], data, unit)
             else:
                 data = data.pm_ug_per_m3(2.5)
                 display_text(variables[mode], data, unit)
@@ -216,7 +216,7 @@ try:
             try:
                 data = pms5003.read()
             except pmsReadTimeoutError:
             try:
                 data = pms5003.read()
             except pmsReadTimeoutError:
-                pass
+                logging.warn("Failed to read PMS5003")
             else:
                 data = data.pm_ug_per_m3(10)
                 display_text(variables[mode], data, unit)
             else:
                 data = data.pm_ug_per_m3(10)
                 display_text(variables[mode], data, unit)