Skip to content

Commit

Permalink
Additional changes for the calibration recipes
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Mar 29, 2024
1 parent 4085613 commit 0322e08
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 263 deletions.
23 changes: 21 additions & 2 deletions src/gort/devices/enclosure.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,13 @@ async def restart(self):

await GortDeviceSet.restart(self) # type: ignore

async def status(self):
async def status(self, get_registers: bool = False):
"""Retrieves the status of the power outlet."""

reply: ActorReply = await self.actor.commands.status(timeout=5)
reply: ActorReply = await self.actor.commands.status(
no_registers=(not get_registers),
timeout=5,
)

return reply.flatten()

Expand Down Expand Up @@ -191,6 +194,22 @@ async def close(self, park_telescopes: bool = True, force: bool = False):
await self.actor.commands.dome.commands.close(force=force)
self.write_to_log("Enclosure is now closed.", level="info")

async def is_open(self):
"""Returns :obj:`True` if the enclosure is open."""

status = await self.status()
labels = status["dome_status_labels"]

return "OPEN" in labels and "MOVING" not in labels

async def is_closed(self):
"""Returns :obj:`True` if the enclosure is closed."""

status = await self.status()
labels = status["dome_status_labels"]

return "CLOSED" in labels and "MOVING" not in labels

async def stop(self):
"""Stop the enclosure dome."""

Expand Down
Loading

0 comments on commit 0322e08

Please sign in to comment.