messages to client

This commit is contained in:
Holler Mirko
2024-08-22 16:21:58 +02:00
committed by wakonig_k
parent e03b3b84e0
commit 17d4fcb8db
2 changed files with 12 additions and 3 deletions

View File

@@ -138,7 +138,7 @@ class GalilController(Controller):
"""
return bool(float(self.socket_put_and_receive("MG allaxref").strip()))
def drive_axis_to_limit(self, axis_Id_numeric: int, direction: str) -> None:
def drive_axis_to_limit(self, axis_Id_numeric: int, direction: str, verbose=0) -> None:
"""
Drive an axis to the limit in a specified direction.
@@ -159,9 +159,12 @@ class GalilController(Controller):
time.sleep(0.1)
self.socket_put_confirmed("XQ#FES")
time.sleep(0.1)
self.get_device_manager().connector.send_client_info("my_message", scope="drive axis to limit")
while self.is_axis_moving(None, axis_Id_numeric):
print("waiting...")
time.sleep(0.01)
if verbose:
self.get_device_manager().connector.send_client_info("my_message", scope="drive axis to limit")
time.sleep(1)
axis_Id = self.axis_Id_numeric_to_alpha(axis_Id_numeric)
# check if we actually hit the limit
@@ -175,6 +178,12 @@ class GalilController(Controller):
else:
print("Limit reached.")
def get_device_manager(self):
for axis in self._axis:
if hasattr(axis, "device_manager") and axis.device_manager:
return axis.device_manager
raise BECConfigError("Could not access the device_manager")
def find_reference(self, axis_Id_numeric: int) -> None:
"""
Find the reference of an axis.

View File

@@ -411,7 +411,7 @@ class OMNYGalilMotor(Device, PositionerBase):
Args:
direction (str): Direction in which the axis should be driven to the limit. Either 'forward' or 'reverse'.
"""
self.controller.drive_axis_to_limit(self.axis_Id_numeric, direction)
self.controller.drive_axis_to_limit(self.axis_Id_numeric, direction, verbose=1)
#now force position read to cache
val = self.readback.read()
self._run_subs(sub_type=self.SUB_READBACK, value=val, timestamp=time.time())