Skip to content

Commit

Permalink
Sensor recording improvement (#1277)
Browse files Browse the repository at this point in the history
* If the reading thread dies on then the thread dies and doesn't start back up, so just add exception here.
  • Loading branch information
wtgee committed May 24, 2024
1 parent 4ab8d1f commit 8e90d13
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/panoptes/pocs/utils/service/power.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ def record_readings():
power_board.logger.info(f'Setting up power recording {record_interval=}')
while True:
time.sleep(record_interval)
power_board.record(collection_name='power')
try:
power_board.record(collection_name='power')
except Exception as e:
power_board.logger.warning(f'Could not get power record: {e}')

# Create a thread to record the readings at an interval.
power_thread = Thread(target=record_readings)
Expand Down
5 changes: 4 additions & 1 deletion src/panoptes/pocs/utils/service/weather.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ def record_readings():
weather_station.logger.info(f'Setting up weather recording {record_interval=}')
while True:
time.sleep(record_interval)
weather_station.record()
try:
weather_station.record()
except Exception as e:
weather_station.logger.warning(f'Could not get weather record: {e}')

# Create a thread to record the readings at an interval
weather_thread = Thread(target=record_readings)
Expand Down

0 comments on commit 8e90d13

Please sign in to comment.