Skip to content

Commit

Permalink
Catch failed readings and retry in M5Stack ENVIII example
Browse files Browse the repository at this point in the history
  • Loading branch information
vickash committed Oct 8, 2023
1 parent b0cd622 commit 52db645
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions examples/advanced/m5_env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@
qmp_reading = qmp.read
sht_reading = sht.read

# Retry immediately if either failed.
next unless (sht_reading && qmp_reading)

# Warn if large gap between temperature readings.
difference = (qmp_reading[:temperature] - sht_reading[:temperature]).abs
if (difference > TOLERANCE)
Expand Down

0 comments on commit 52db645

Please sign in to comment.