Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/all-in-one.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def get_cpu_temperature():
try:
data = pms5003.read()
except pmsReadTimeoutError:
logging.warn("Failed to read PMS5003")
logging.warning("Failed to read PMS5003")
else:
data = float(data.pm_ug_per_m3(1.0))
display_text(variables[mode], data, unit)
Expand All @@ -209,7 +209,7 @@ def get_cpu_temperature():
try:
data = pms5003.read()
except pmsReadTimeoutError:
logging.warn("Failed to read PMS5003")
logging.warning("Failed to read PMS5003")
else:
data = float(data.pm_ug_per_m3(2.5))
display_text(variables[mode], data, unit)
Expand All @@ -220,7 +220,7 @@ def get_cpu_temperature():
try:
data = pms5003.read()
except pmsReadTimeoutError:
logging.warn("Failed to read PMS5003")
logging.warning("Failed to read PMS5003")
else:
data = float(data.pm_ug_per_m3(10))
display_text(variables[mode], data, unit)
Expand Down
12 changes: 6 additions & 6 deletions examples/combined.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import ltr559

from bme280 import BME280
from pms5003 import PMS5003, ReadTimeoutError as pmsReadTimeoutError
from pms5003 import PMS5003, ReadTimeoutError as pmsReadTimeoutError, SerialTimeoutError
from enviroplus import gas
from subprocess import PIPE, Popen
from PIL import Image
Expand Down Expand Up @@ -276,7 +276,7 @@ def main():
try:
data = pms5003.read()
except pmsReadTimeoutError:
logging.warn("Failed to read PMS5003")
logging.warning("Failed to read PMS5003")
else:
data = float(data.pm_ug_per_m3(1.0))
display_text(variables[mode], data, unit)
Expand All @@ -287,7 +287,7 @@ def main():
try:
data = pms5003.read()
except pmsReadTimeoutError:
logging.warn("Failed to read PMS5003")
logging.warning("Failed to read PMS5003")
else:
data = float(data.pm_ug_per_m3(2.5))
display_text(variables[mode], data, unit)
Expand All @@ -298,7 +298,7 @@ def main():
try:
data = pms5003.read()
except pmsReadTimeoutError:
logging.warn("Failed to read PMS5003")
logging.warning("Failed to read PMS5003")
else:
data = float(data.pm_ug_per_m3(10))
display_text(variables[mode], data, unit)
Expand Down Expand Up @@ -331,8 +331,8 @@ def main():
pms_data = None
try:
pms_data = pms5003.read()
except pmsReadTimeoutError:
logging.warn("Failed to read PMS5003")
except (SerialTimeoutError, pmsReadTimeoutError):
logging.warning("Failed to read PMS5003")
else:
save_data(7, float(pms_data.pm_ug_per_m3(1.0)))
save_data(8, float(pms_data.pm_ug_per_m3(2.5)))
Expand Down