Skip to content

Commit

Permalink
Prevent opening dome for cal in unsafe weather
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Aug 28, 2024
1 parent 7e5979c commit 56d98c6
Showing 1 changed file with 23 additions and 14 deletions.
37 changes: 23 additions & 14 deletions src/gort/overwatcher/calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,20 +550,29 @@ async def run_calibration(self, calibration: Calibration):
dome_current = await self.overwatcher.gort.enclosure.is_open()
needs_dome_change = dome_new != dome_current

if needs_dome_change and not self.overwatcher.state.enabled:
await self._fail_calibration(
calibration,
f"Cannot move dome for {name!r}. Overwatcher is disabled.",
level="error",
)
return

if dome == "open" and not dome_current:
await notify("Opening the dome for calibration.")
await self.overwatcher.gort.enclosure.open()
elif dome == "closed" and dome_current:
await notify("Closing the dome for calibration.")
await self.overwatcher.gort.enclosure.close()
if needs_dome_change:
if not self.overwatcher.state.enabled:
await self._fail_calibration(
calibration,
f"Cannot move dome for {name!r}. Overwatcher is disabled.",
level="error",
)
return

if dome == "open" and not self.overwatcher.state.safe:
await self._fail_calibration(
calibration,
f"Cannot move dome for {name!r}. Weather is not safe.",
level="warning",
)
return

if dome == "open" and not dome_current:
await notify("Opening the dome for calibration.")
await self.overwatcher.gort.enclosure.open()
elif dome == "closed" and dome_current:
await notify("Closing the dome for calibration.")
await self.overwatcher.gort.enclosure.close()

await notify(f"Running recipe {recipe!r} for calibration {name!r}.")
await self.overwatcher.gort.execute_recipe(recipe)
Expand Down

0 comments on commit 56d98c6

Please sign in to comment.