Skip to content
Snippets Groups Projects
Commit 536a943d authored by kpetersn's avatar kpetersn
Browse files

Modified the transform to only update the dmov PV for the soft motor when the...

Modified the transform to only update the dmov PV for the soft motor when the soft motor is tweaked.

git-svn-id: https://subversion.xray.aps.anl.gov/kmp/transform/trunk@317 f095f811-4e88-6c84-d33e-e382bdb4531c
parent 840062a2
No related branches found
No related tags found
No related merge requests found
......@@ -99,9 +99,14 @@ class transform:
# soft motor VAL (monitor for move request detection)
self.tm_val = []
self.tm_dict = {}
self.tm_keys = []
for tm in (tm1, tm2, tm3):
tempStr = "%s.VAL" % tm
self.tm_val.append( epics.PV(tempStr, callback=self.driveCallback, connection_callback=self.connectionCallback) )
self.tm_dict[tempStr] = 0
self.tm_keys.append(tempStr)
print self.tm_dict
# soft motor STOP (monitor for stop request detection)
self.tm_stop = []
......@@ -127,7 +132,7 @@ class transform:
### Callback functions (to be called when PV values change--only set flags that are watched in main loop)
def driveCallback(self, **kw):
#!print "driveCallback:\n", " ", kw['pvname'], kw['value']
print "driveCallback:\n", " ", kw['pvname'], kw['value']
#!print "_ updateReadbackFlag =", self.updateReadbackFlag
#!print "_ dmovChangeFlag =", self.dmovChangeFlag
......@@ -144,6 +149,9 @@ class transform:
self.moveSoftMotorFlag = True
self.softMotorInitiatedMove = True
#!print " move real motors because NOT syncing"
# Set sotf-move indicator
self.tm_dict[ kw['pvname'] ] = 1
print self.tm_dict
else:
#!print " not moving real motors because a sync is in progress or initializing"
pass
......@@ -158,7 +166,7 @@ class transform:
self.stopMotorsFlag = True
def dmovCallback(self, **kw):
print "dmovCallback:\n", " ", kw['pvname'], kw['value']
#!print "dmovCallback:\n", " ", kw['pvname'], kw['value']
self.dmovChangeFlag = True
def connectionCallback(self, **kw):
......@@ -237,8 +245,10 @@ class transform:
# Write the soft (transformed) dmovs
for i in range(len(self.tm_dmov)):
print "setting dmov for tm%i to %i" % (i, dmov)
self.tm_dmov[i].put(dmov)
# Only update the dmov of a soft-motor that is tweaked
if self.tm_dict[self.tm_keys[i]] == 1:
print "setting dmov for tm%i to %i" % (i, dmov)
self.tm_dmov[i].put(dmov)
### Sanity check
#!print "soft motor initiated move?", self.softMotorInitiatedMove
......@@ -248,6 +258,10 @@ class transform:
# Update readback positions only happens first if readback occurs before sync in main loop
self.updateReadbackFlag = True
self.syncSoftTargetFlag = True
# Reset the softMotor move indicators
print "resetting softMove indicators"
for i in range(len(self.tm_dmov)):
self.tm_dict[self.tm_keys[i]] = 0
self.dmovChangeFlag = False
......@@ -268,7 +282,9 @@ class transform:
#!print "Actually changing the real motor target positions"
self.m_val[i].put(m_positions[i])
# also manually the dmov since this needs to be in sync very quickly
self.tm_dmov[i].put(0)
# only update dmovs for soft motors that were manually moved.
if self.tm_dict[self.tm_keys[i]] == 1:
self.tm_dmov[i].put(0)
self.moveSoftMotorFlag = False
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment