Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@RafaelLyra8
Copy link
Collaborator

@RafaelLyra8 RafaelLyra8 commented Dec 12, 2025

This PR implements the EPICSNState class in order to be able to use it with Enum values.

)

zoom = self.getObjectByRole("zoom")
calibration_x = zoom.getProperty("mm_per_pixel_x")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to this file will cause a conflict with the bluesky branch


def init(self):
super().init()
low_limit = self.get_property("low_limit", "")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the limits should be in the EPICSActuator class. And if they are not set, the class should get the values directly from the PV.

try:
with gevent.Timeout(timeout, exception=TimeoutError):
while (
self.setpoint != EPICSActuator.get_value(self) and not self._wait_task.is_set()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The EPICSActuator could be generalize to accept strings, and this wait_ready method could be removed.

self._nominal_limits = limits
self.emit("limitsChanged", (self._nominal_limits,))

def update_limits(self, limits=None):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name should be standardized with the one in EPICSMotor that is called get_limits. And maybe set in the EPICSActuator

value = EPICSActuator.get_value(self)
return self.value_to_enum(value)

def set_limits(self, limits=(None, None)):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be in the EPICSActuator

@RafaelLyra8 RafaelLyra8 changed the title Lnls zoom Implement EPICSNState Class Dec 15, 2025
Pedro Benetton added 10 commits December 18, 2025 17:06
Delete example xml file (which does not make sense here), fix the
imports from other classes, adjust the zoom limits to what is
currently being used in the beamline (1 to 8), and delete the
get_value function which was poorly implemented, and already
inherited from EPICSNState class
This is done in order to account for the value_to_enum, that needs
to be called for the values of the Zoom object. Combined with a
proper polling setting, this updates the frontend when a zoom
value is altered from outside MXCuBE4
In the parent class, AbstractNState, the functions set_limits and
update_limits raise a NotImplementedError. Because LNLSZoom is a
class that is an N state but has limits, the limits must be set
manually. This is why the limits are defined at init (and not at
the configuration file) and also set with specific functions at
the LNLSZoom class. There could be a way to set these limits in the
configuration file, but I could not find that.
This can be done because all NState objetcs also use these funcions
and because limits can be defined in configuration files
Default value is used if any of them was not defined. This is the
case e.g. for all EPICSMotors, which inhetir from the EPICSActuator
class.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants