From c0e67507f515f25c5410cf68a78eef55b8b76328 Mon Sep 17 00:00:00 2001 From: Wilfred Tyler Gee Date: Mon, 13 May 2024 17:34:35 -1000 Subject: [PATCH] POCS wait status (#1268) * The `pocs.wait` method calls `status` so there are updates. * Slightly longer wait delay if we know it is not dark. This could be improved. --- src/panoptes/pocs/core.py | 10 ++++++---- src/panoptes/pocs/state/states/default/ready.py | 8 ++++++-- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/panoptes/pocs/core.py b/src/panoptes/pocs/core.py index 8de9e78fe..8950d4fd4 100644 --- a/src/panoptes/pocs/core.py +++ b/src/panoptes/pocs/core.py @@ -583,14 +583,16 @@ def wait(self, delay=None): if delay is None: # pragma: no cover delay = self.get_config('wait_delay', default=2.5) - sleep_timer = CountdownTimer(delay, name='POCSWait') - self.logger.info(f'Starting a wait timer of {delay} seconds') + timer_name = 'POCSWait' + sleep_timer = CountdownTimer(delay, name=timer_name) + self.logger.info(f'Starting {timer_name} timer of {delay} seconds') while not sleep_timer.expired() and not self.interrupted: - self.logger.debug(f'Wait timer: {sleep_timer.time_left():.02f} / {delay:.02f}') + self.logger.debug(f'POCS status: {self.status}') + self.logger.debug(f'{timer_name}: {sleep_timer.time_left():.02f} / {delay:.02f}') sleep_timer.sleep(max_sleep=30) is_expired = sleep_timer.expired() - self.logger.debug(f'Leaving wait timer: expired={is_expired}') + self.logger.debug(f'Leaving wait timer: {is_expired}') return is_expired ################################################################################################ diff --git a/src/panoptes/pocs/state/states/default/ready.py b/src/panoptes/pocs/state/states/default/ready.py index 4a61013f6..fdf4d29fa 100644 --- a/src/panoptes/pocs/state/states/default/ready.py +++ b/src/panoptes/pocs/state/states/default/ready.py @@ -13,11 +13,15 @@ def on_enter(event_data): pocs.next_state = 'scheduling' # Wait until it's safe to proceed. - wait_delay = pocs.get_config('wait_delay', default=180) # seconds - # TODO separate check for disk space, which will never break this loop. disk_space_checks = ['free_space_root', 'free_space_images'] while pocs.is_safe(park_if_not_safe=False, ignore=disk_space_checks) is False: + if pocs.is_dark() is False: + # TODO figure out how long until sunset and wait until then. + wait_delay = 10 * 60 # 10 minutes + else: + wait_delay = pocs.get_config('wait_delay', default=180) # seconds + pocs.wait(delay=wait_delay) pocs.say("Ok, I'm all set up and ready to go!")