Skip to content

Commit

Permalink
Continue debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelldls committed Jun 11, 2024
1 parent 653f36c commit ab353e0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ classifiers = [
]
description = "FastCS support for the ThorLabs MFF (Motorized Filter Flipper)"
dependencies = [
"fastcs",
"FastCS@git+https://github.com/DiamondLightSource/FastCS.git",
"typer",
] # Add project dependencies here, e.g. ["click", "numpy"]
dynamic = ["version"]
Expand Down
12 changes: 8 additions & 4 deletions src/thorlabs_mff_fastcs/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,15 @@ class ResponseCache:
def check_expired(self, time_step):
if self._last_update is None:
return True
return self.last_update - datetime.now() > time_step
delta_t = datetime.now() - self._last_update
return delta_t.total_seconds() > time_step

def update_response(self, response):
self.response = response
self.last_update = datetime.now()
self._response = response
self._last_update = datetime.now()

def get_response(self):
return self._response


cache = ResponseCache()
Expand Down Expand Up @@ -115,7 +119,7 @@ async def update(
)
cache.update_response(response)
else:
response = cache.response
response = cache.get_response()
else:
response = await controller.conn.send_query(
self.cmd(),
Expand Down

0 comments on commit ab353e0

Please sign in to comment.