Skip to content

Commit

Permalink
Merge pull request #359 from vshekar/prevent-direct-omega-move
Browse files Browse the repository at this point in the history
Moving omega is done by server and only in SA
  • Loading branch information
vshekar authored Feb 21, 2024
2 parents 2f18cce + e0b479d commit 5d416ef
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
8 changes: 8 additions & 0 deletions daq_macros.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,14 @@ def abortBS():
except super_state_machine.errors.TransitionError:
logger.error("caught BS")

def move_omega(omega, relative=True):
"""Moves omega by a certain amount"""
if gov_robot.state.get() == "SA":
if relative:
RE(bps.mvr(samplexyz.omega, omega))
else:
RE(bps.mv(samplexyz.omega, omega))

def changeImageCenterLowMag(x,y,czoom):
zoom = int(czoom)
zoomMinXRBV = getPvDesc("lowMagZoomMinXRBV")
Expand Down
3 changes: 2 additions & 1 deletion daq_main_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ def setGovState(state):
setSlit1X,
setSlit1Y,
testRobot,
setGovState]
setGovState,
move_omega]

whitelisted_functions: "Dict[str, Callable]" = {
func.__name__: func for func in functions
Expand Down
13 changes: 6 additions & 7 deletions gui/control_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2688,8 +2688,9 @@ def dewarViewToggleCheckCB(self):

def moveOmegaCB(self):
self.send_to_server(
"mvaDescriptor",
["omega", float(self.sampleOmegaMoveLedit.getEntry().text())],
"move_omega",
[float(self.sampleOmegaMoveLedit.getEntry().text())],
{"relative": False}
)

def moveEnergyCB(self):
Expand Down Expand Up @@ -2780,16 +2781,15 @@ def moveDetDistCB(self):

def omegaTweakNegCB(self):
tv = float(self.omegaTweakVal_ledit.text())
tweakVal = 0.0 - tv
if self.controlEnabled():
self.omegaTweak_pv.put(tweakVal)
self.send_to_server("move_omega", [-tv])
else:
self.popupServerMessage("You don't have control")

def omegaTweakPosCB(self):
tv = float(self.omegaTweakVal_ledit.text())
if self.controlEnabled():
self.omegaTweak_pv.put(tv)
self.send_to_server("move_omega", [tv])
else:
self.popupServerMessage("You don't have control")

Expand Down Expand Up @@ -2824,9 +2824,8 @@ def focusTweakCB(self, tv):
self.popupServerMessage("You don't have control")

def omegaTweakCB(self, tv):
tvf = float(tv)
if self.controlEnabled():
self.omegaTweak_pv.put(tvf)
self.send_to_server("move_omega", [float(tv)])
time.sleep(0.05)
else:
self.popupServerMessage("You don't have control")
Expand Down

0 comments on commit 5d416ef

Please sign in to comment.