Commit 37c4adf9 authored by kpetersn's avatar kpetersn
Browse files

Added support for reading group status string

git-svn-id: https://subversion.xray.aps.anl.gov/kmp/HexapodSrc/trunk@7 f095f811-4e88-6c84-d33e-e382bdb4531c
parent b657bd09
......@@ -42,6 +42,15 @@ class hxp_poller:
print "self.socketID", self.socketID
# Connect to the PV that holds the group status int & string
pv = "%s:hxp:grpStatus" % self.prefix
self.groupStatusChan = CaChannel.CaChannel(pv)
self.groupStatusChan.searchw()
pv = "%s:hxp:grpStatusStr" % self.prefix
self.groupStatusStrChan = CaChannel.CaChannel(pv)
self.groupStatusStrChan.searchw()
# Connect to the PVs that will hold the positions
for i in range(6):
index = i + 1
......@@ -64,13 +73,19 @@ class hxp_poller:
# Initialize the last position array
self.last_pos_array = self.getCurrentPositions()
# Initialize the last status var
# Initialize the status vars
self.last_hxp_status = self.getStatus()
self.hxp_status_str = self.getStatusString(self.last_hxp_status)
#print "status string response: ", self.hxp_status_str
# Initialize the status PVs
#print self.last_hxp_status
self.groupStatusChan.putw(self.last_hxp_status)
self.groupStatusStrChan.putw(self.hxp_status_str)
# Initialize the PVs
for i in range(6):
self.motorValChan[i].putw( self.last_pos_array[i] )
def __del__(self):
# Disconnect from the XPS
......@@ -97,7 +112,11 @@ class hxp_poller:
def getStatus(self):
# Get the status of the HEXAPOD group, integer is returned
val = self.XPS.GroupStatusGet(self.socketID, self.GROUP_NAME)
return val
return val[1]
def getStatusString(self, statusCode):
val = self.XPS.GroupStatusStringGet(self.socketID, statusCode)
return val[1]
def main(self):
#
......@@ -124,7 +143,7 @@ class hxp_poller:
# reset the stoppingMotor flag
self.stoppingMotor = -1
# Get the positions
pos_array = self.getCurrentPositions()
......@@ -141,25 +160,24 @@ class hxp_poller:
# Store position array for comparison next iteration
self.last_pos_array = pos_array[:]
# temporarily disable the setting of the status
### Get the status
##hxp_status = self.getStatus()
### Get the group status
hxp_status = self.getStatus()
### Check to see if status has changed
##if hxp_status != self.last_hxp_status:
## print hxp_status
## # Convert status into dinp
## if hxp_status[1] == 44:
## dmov = 0
## else:
## dmov = 1
## # eventually do this more efficiently with a dfanout record
## for i in range(6):
## self.motorDinpChan[i].putw( dmov )
if hxp_status != self.last_hxp_status:
print "hxp_status =", hxp_status
### Get the group status string
self.hxp_status_str = self.getStatusString(hxp_status)
# update the PVs only when the status actually changes
self.GroupStatusChan.putw(hxp_status)
self.GroupStatusStrChan.putw(self.hxp_status_str)
### Store status for comparison next iteration
##self.last_hxp_status = hxp_status
# this could probably be done in the above if statement
self.last_hxp_status = hxp_status
# Sleep for a little while
# NO
time.sleep(0.10)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment