The fake Galil can now handle 'MG _LFH' and 'MG _LFR' to get limit switch states.
This commit is contained in:
@ -28,6 +28,8 @@ class GalilMotor(object):
|
||||
self.targetSteps = self.currentSteps
|
||||
self.configDone = False
|
||||
self.switches = 44
|
||||
self.fwdlim = 1
|
||||
self.revlim = 1
|
||||
self.stopcode = 0
|
||||
self.stopCallback = None
|
||||
self.moveCallback = None
|
||||
@ -144,6 +146,8 @@ class GalilMotor(object):
|
||||
self.motorState = "STOPPED"
|
||||
self.stopcode = 1
|
||||
self.switches = 44 # stopped, both limits clear
|
||||
self.fwdlim = 1
|
||||
self.revlim = 1
|
||||
elif t >= (t1 + t2):
|
||||
# Ramp Down
|
||||
dt = t - (t1 + t2)
|
||||
@ -173,16 +177,22 @@ class GalilMotor(object):
|
||||
self.motorState = "STOPPED"
|
||||
self.stopcode = 1
|
||||
self.switches = 44 # stopped, both limits clear
|
||||
self.fwdlim = 1
|
||||
self.revlim = 1
|
||||
elif self.targetSteps < self.motorStartSteps:
|
||||
self.currentSteps = self.motorStartSteps - int(s)
|
||||
if self.currentSteps <= self.targetSteps:
|
||||
self.motorState = "STOPPED"
|
||||
self.stopcode = 1
|
||||
self.switches = 44 # stopped, both limits clear
|
||||
self.fwdlim = 1
|
||||
self.revlim = 1
|
||||
else:
|
||||
self.motorState = "STOPPED"
|
||||
self.stopcode = 1
|
||||
self.switches = 44 # stopped, both limits clear
|
||||
self.fwdlim = 1
|
||||
self.revlim = 1
|
||||
currentPosition = self.getPosition()
|
||||
if not self.moveCallback == None:
|
||||
self.moveCallback(self)
|
||||
@ -191,12 +201,16 @@ class GalilMotor(object):
|
||||
self.motorState = "STOPPED"
|
||||
self.stopcode = 2 # stopped by forward limit
|
||||
self.switches = 44 - 8 # stopped, reverse limit clear
|
||||
self.fwdlim = 0
|
||||
self.revlim = 1
|
||||
pass
|
||||
if self.targetSteps < self.motorStartSteps and currentPosition <= self.lowerLim:
|
||||
# Reverse Limit
|
||||
self.motorState = "STOPPED"
|
||||
self.stopcode = 3 # stopped by reverse limit
|
||||
self.switches = 44 - 4 # stopped, forward limit clear
|
||||
self.fwdlim = 1
|
||||
self.revlim = 0
|
||||
pass
|
||||
if self.motorState == "STOPPED":
|
||||
print "Axis %s stopped at:" % self.axis, currentPosition
|
||||
@ -242,6 +256,10 @@ class GalilMotor(object):
|
||||
response = self.decel
|
||||
elif arg == "TS":
|
||||
response = self.switches
|
||||
elif arg == "LF":
|
||||
response = self.fwdlim
|
||||
elif arg == "LR":
|
||||
response = self.revlim
|
||||
elif arg == "SC":
|
||||
response = self.stopcode
|
||||
elif arg == "MO":
|
||||
@ -283,6 +301,8 @@ class GalilMotor(object):
|
||||
self.motorState = "STOPPED"
|
||||
self.stopcode = 4
|
||||
self.switches = 44
|
||||
self.fwdlim = 1
|
||||
self.revlim = 1
|
||||
return True
|
||||
|
||||
def doCommandBG(self, arg):
|
||||
@ -290,6 +310,8 @@ class GalilMotor(object):
|
||||
self.motorState = "MOVING"
|
||||
self.stopcode = 0
|
||||
self.switches = 140 # moving, both limits clear
|
||||
self.fwdlim = 1
|
||||
self.revlim = 1
|
||||
self.motorStartTime = time.time()
|
||||
self.motorStartSteps = self.currentSteps
|
||||
return True
|
||||
|
Reference in New Issue
Block a user