temp: Don't exit on errors
Make the script slightly more robust by not stopping the monitoring when an exception is raised.
This commit is contained in:
parent
37b58a1529
commit
115eecde4f
|
@ -26,6 +26,7 @@ temperature_filtered = -1
|
||||||
# Ignore the first 5 seconds
|
# Ignore the first 5 seconds
|
||||||
last_report = time.ticks_ms() + 5000
|
last_report = time.ticks_ms() + 5000
|
||||||
while True:
|
while True:
|
||||||
|
try:
|
||||||
raw_value = cs1237.read()
|
raw_value = cs1237.read()
|
||||||
value = float(raw_value) / (2**24 - 1)
|
value = float(raw_value) / (2**24 - 1)
|
||||||
|
|
||||||
|
@ -48,3 +49,5 @@ while True:
|
||||||
if elapsed >= 200 or elapsed < 0:
|
if elapsed >= 200 or elapsed < 0:
|
||||||
print(f"{temperature:.6f},{temperature_filtered:.6f}")
|
print(f"{temperature:.6f},{temperature_filtered:.6f}")
|
||||||
last_report = now
|
last_report = now
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Error {e}")
|
||||||
|
|
Loading…
Reference in a new issue