Skip to content

Commit

Permalink
Use CLU model for lvmecp in websocket server
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Jan 13, 2024
1 parent 8c12161 commit 3c997ce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
### ✨ Improved

* `SpectrographSet.reset` now accepts `full=True` which performs additional checks and opens/closes the shutter and hartmann doors as needed. `reset` with `full=True` is run automatically during the `cleanup` recipe.
* The GORT websocket now uses the CLU model for `lvmecp` instead of asking the PLC to report its status on each call to `WebsocketServer.enclosure_status()`.


## 0.7.1 - December 20, 2023
Expand Down
12 changes: 10 additions & 2 deletions src/gort/websocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,12 @@ async def start(self):
"""Start the server and AMQP client."""

# self.gort.add_reply_callback(self._handle_reply)

await self.gort.init()

# Add lvmecp to models.
await self.gort.models.add_actor("lvmecp")

self.websocket_server = await serve(
self._handle_websocket_connection,
*self.wparams,
Expand Down Expand Up @@ -181,8 +185,12 @@ async def enclosure_status(
):
"""Returns the enclosure status."""

# status = await self.gort.enclosure.status()
status = {}
# Use the model instead of actively polling for the status except
# if info is missing.
if self.gort.models["lvmecp"]["registers"].value is None:
await self.gort.enclosure.status()

status = self.gort.models["lvmecp"].flatten()

await self.reply_to_client(client, command_id, status)

Expand Down

0 comments on commit 3c997ce

Please sign in to comment.