Remove superfluous trailing white space from Python files
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
# PID : Protocol Identifier, 0 for MODBUS, (2 Bytes)
|
# PID : Protocol Identifier, 0 for MODBUS, (2 Bytes)
|
||||||
# len : Number of bytes following the len field, (2 Bytes)
|
# len : Number of bytes following the len field, (2 Bytes)
|
||||||
# UID : Unit Identifier (1 Byte)
|
# UID : Unit Identifier (1 Byte)
|
||||||
#
|
#
|
||||||
# MODBUS TCP/IP ADU
|
# MODBUS TCP/IP ADU
|
||||||
# ADU = [MBAP][PDU]
|
# ADU = [MBAP][PDU]
|
||||||
# MBAP = [TID][PID][len][UID]
|
# MBAP = [TID][PID][len][UID]
|
||||||
@@ -28,7 +28,7 @@ sys.stdout = os.fdopen(sys.stdout.fileno(), 'w',0)
|
|||||||
|
|
||||||
# Debug flags
|
# Debug flags
|
||||||
INFO = 1
|
INFO = 1
|
||||||
COMS = 2
|
COMS = 2
|
||||||
RREG = 4
|
RREG = 4
|
||||||
WREG = 8
|
WREG = 8
|
||||||
RCOIL = 16
|
RCOIL = 16
|
||||||
@@ -191,7 +191,7 @@ class Fermi_Prot(LineReceiver):
|
|||||||
self.RegVal[uid][a] = n
|
self.RegVal[uid][a] = n
|
||||||
i += 1
|
i += 1
|
||||||
return
|
return
|
||||||
|
|
||||||
def rawDataReceived(self, ADU):
|
def rawDataReceived(self, ADU):
|
||||||
self.debug(COMS, "Received ADU ", ADU.encode('hex'))
|
self.debug(COMS, "Received ADU ", ADU.encode('hex'))
|
||||||
self.ADU = ADU
|
self.ADU = ADU
|
||||||
@@ -238,7 +238,7 @@ class Fermi_Prot(LineReceiver):
|
|||||||
self.debug(WCOIL, 'wcoil:OA=%d, OV=%X' % (OA,OV))
|
self.debug(WCOIL, 'wcoil:OA=%d, OV=%X' % (OA,OV))
|
||||||
# TODO This really just toggles IDLE speed so it's only correct for OA=2 (ie coil 3)
|
# TODO This really just toggles IDLE speed so it's only correct for OA=2 (ie coil 3)
|
||||||
self.FermiCoil[uid][OA] ^= OV
|
self.FermiCoil[uid][OA] ^= OV
|
||||||
if (OA == CSTART):
|
if (OA == CSTART):
|
||||||
self.debug(INFO, "START")
|
self.debug(INFO, "START")
|
||||||
self.RegVal[uid][10] |= (_RUN|_LEV)
|
self.RegVal[uid][10] |= (_RUN|_LEV)
|
||||||
self.debug(INFO, 'RUNNING, LEVITATING')
|
self.debug(INFO, 'RUNNING, LEVITATING')
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class GalilController(object):
|
|||||||
def write(self, response):
|
def write(self, response):
|
||||||
#print "Device Response: %s" % response
|
#print "Device Response: %s" % response
|
||||||
self.response.append(response)
|
self.response.append(response)
|
||||||
|
|
||||||
def doIteration(self, now):
|
def doIteration(self, now):
|
||||||
#print "DoIteration"
|
#print "DoIteration"
|
||||||
# pass to motors
|
# pass to motors
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class GalilProtocol(Protocol):
|
|||||||
print "connectionMade: connection number", self.factory.numProtocols
|
print "connectionMade: connection number", self.factory.numProtocols
|
||||||
if self.factory.numProtocols > 2:
|
if self.factory.numProtocols > 2:
|
||||||
print "Too many connections - rejecting"
|
print "Too many connections - rejecting"
|
||||||
self.transport.write("Too many connections, try later\r\n")
|
self.transport.write("Too many connections, try later\r\n")
|
||||||
self.transport.loseConnection()
|
self.transport.loseConnection()
|
||||||
'''else:
|
'''else:
|
||||||
self.transport.write("Welcome connection %d\r\n" % self.factory.numProtocols)'''
|
self.transport.write("Welcome connection %d\r\n" % self.factory.numProtocols)'''
|
||||||
@@ -60,7 +60,7 @@ class GalilProtocol(Protocol):
|
|||||||
self.response = self.response[:-1]
|
self.response = self.response[:-1]
|
||||||
if len(self.response) > 0 and self.response[-1] != ":":
|
if len(self.response) > 0 and self.response[-1] != ":":
|
||||||
self.response = self.response + ":"
|
self.response = self.response + ":"
|
||||||
if len(self.response) == 0:
|
if len(self.response) == 0:
|
||||||
self.response = self.response + ":"
|
self.response = self.response + ":"
|
||||||
if len(self.response) > 0:
|
if len(self.response) > 0:
|
||||||
#print "Protocol Response: %s" % self.response
|
#print "Protocol Response: %s" % self.response
|
||||||
@@ -68,7 +68,7 @@ class GalilProtocol(Protocol):
|
|||||||
self.response = ""
|
self.response = ""
|
||||||
else:
|
else:
|
||||||
self.pdu = self.pdu + c
|
self.pdu = self.pdu + c
|
||||||
|
|
||||||
class GalilFactory(ServerFactory):
|
class GalilFactory(ServerFactory):
|
||||||
"""Factory object used by the Twisted Infrastructure to create a Protocol
|
"""Factory object used by the Twisted Infrastructure to create a Protocol
|
||||||
object for incomming connections"""
|
object for incomming connections"""
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class CubicPowderSample:
|
|||||||
self.wavelength = 0.0
|
self.wavelength = 0.0
|
||||||
print "theta = %g, wl = %g, mEv = %g" % (angle, self.wavelength, self.mEv)
|
print "theta = %g, wl = %g, mEv = %g" % (angle, self.wavelength, self.mEv)
|
||||||
|
|
||||||
|
|
||||||
def atod(self, the_aspacing, h, k, l):
|
def atod(self, the_aspacing, h, k, l):
|
||||||
result = math.sqrt(the_aspacing**2 /(h**2 + k**2 + l**2))
|
result = math.sqrt(the_aspacing**2 /(h**2 + k**2 + l**2))
|
||||||
return result
|
return result
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class HidenProtocol(Protocol):
|
|||||||
print "connectionMade:", self.factory.numProtocols
|
print "connectionMade:", self.factory.numProtocols
|
||||||
if self.factory.numProtocols > 2:
|
if self.factory.numProtocols > 2:
|
||||||
print "Too many connections - rejecting"
|
print "Too many connections - rejecting"
|
||||||
self.transport.write("Too many connections, try later" + self.term)
|
self.transport.write("Too many connections, try later" + self.term)
|
||||||
self.transport.loseConnection()
|
self.transport.loseConnection()
|
||||||
else:
|
else:
|
||||||
self.transport.write(("Welcome connection %d" % self.factory.numProtocols) + self.term)
|
self.transport.write(("Welcome connection %d" % self.factory.numProtocols) + self.term)
|
||||||
@@ -58,7 +58,7 @@ class HidenProtocol(Protocol):
|
|||||||
self.response = ""
|
self.response = ""
|
||||||
else:
|
else:
|
||||||
self.pdu = self.pdu + c
|
self.pdu = self.pdu + c
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
class TestDevice:
|
class TestDevice:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ class HidenXCS(HidenDevice):
|
|||||||
if self.DigitalOut[2] and (self.AnalogIn[0] + self.AnalogIn[1] + self.AnalogIn[2]) > 0:
|
if self.DigitalOut[2] and (self.AnalogIn[0] + self.AnalogIn[1] + self.AnalogIn[2]) > 0:
|
||||||
self.humidity = 100.0
|
self.humidity = 100.0
|
||||||
self.humidity *= self.AnalogIn[1]
|
self.humidity *= self.AnalogIn[1]
|
||||||
self.humidity /= (self.AnalogIn[0] + self.AnalogIn[1] + self.AnalogIn[2])
|
self.humidity /= (self.AnalogIn[0] + self.AnalogIn[1] + self.AnalogIn[2])
|
||||||
|
|
||||||
def doCommandAOUT(self, cmd, args):
|
def doCommandAOUT(self, cmd, args):
|
||||||
idx = int(args[0])
|
idx = int(args[0])
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class PfeifferProtocol(Protocol):
|
|||||||
print "connectionMade:", self.factory.numProtocols
|
print "connectionMade:", self.factory.numProtocols
|
||||||
if self.factory.numProtocols > 2:
|
if self.factory.numProtocols > 2:
|
||||||
print "Too many connections - rejecting"
|
print "Too many connections - rejecting"
|
||||||
self.transport.write("Too many connections, try later" + self.term)
|
self.transport.write("Too many connections, try later" + self.term)
|
||||||
self.transport.loseConnection()
|
self.transport.loseConnection()
|
||||||
else:
|
else:
|
||||||
self.transport.write(("Welcome connection %d" % self.factory.numProtocols) + self.term)
|
self.transport.write(("Welcome connection %d" % self.factory.numProtocols) + self.term)
|
||||||
@@ -54,7 +54,7 @@ class PfeifferProtocol(Protocol):
|
|||||||
self.response = ""
|
self.response = ""
|
||||||
else:
|
else:
|
||||||
self.pdu = self.pdu + c
|
self.pdu = self.pdu + c
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
class TestDevice:
|
class TestDevice:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|||||||
@@ -185,14 +185,14 @@ class Lakeshore336(LakeshoreDevice):
|
|||||||
def doQueryALARM(self, cmd, args):
|
def doQueryALARM(self, cmd, args):
|
||||||
if len(args) > 0:
|
if len(args) > 0:
|
||||||
idx = ord(args[0]) - 64
|
idx = ord(args[0]) - 64
|
||||||
if idx in self.ALARM:
|
if idx in self.ALARM:
|
||||||
self.write(self.ALARM[idx])
|
self.write(self.ALARM[idx])
|
||||||
else:
|
else:
|
||||||
self.write("0,1,500.0,0.0,0")
|
self.write("0,1,500.0,0.0,0")
|
||||||
def doQueryALARMST(self, cmd, args):
|
def doQueryALARMST(self, cmd, args):
|
||||||
if len(args) > 0:
|
if len(args) > 0:
|
||||||
idx = ord(args[0]) - 64
|
idx = ord(args[0]) - 64
|
||||||
if idx in self.ALARMST:
|
if idx in self.ALARMST:
|
||||||
self.write(self.ALARMST[idx])
|
self.write(self.ALARMST[idx])
|
||||||
else:
|
else:
|
||||||
self.write("0,0")
|
self.write("0,0")
|
||||||
@@ -273,7 +273,7 @@ class Lakeshore336(LakeshoreDevice):
|
|||||||
self.write("%f" % self.COMM)
|
self.write("%f" % self.COMM)
|
||||||
def doQueryCRDG(self, cmd, args):
|
def doQueryCRDG(self, cmd, args):
|
||||||
idx = ord(args[0]) - 64
|
idx = ord(args[0]) - 64
|
||||||
if idx in self.KRDG:
|
if idx in self.KRDG:
|
||||||
if self.RANDOM > 0:
|
if self.RANDOM > 0:
|
||||||
self.write("%f" % (self.KRDG[idx] - 273.15 + random.uniform(-self.RANDOM, self.RANDOM)))
|
self.write("%f" % (self.KRDG[idx] - 273.15 + random.uniform(-self.RANDOM, self.RANDOM)))
|
||||||
else:
|
else:
|
||||||
@@ -339,8 +339,8 @@ class Lakeshore336(LakeshoreDevice):
|
|||||||
for key in keys:
|
for key in keys:
|
||||||
self.FILTER[key] = params
|
self.FILTER[key] = params
|
||||||
def doQueryFILTER(self, cmd, args):
|
def doQueryFILTER(self, cmd, args):
|
||||||
idx = int(args[0])
|
idx = int(args[0])
|
||||||
if idx in self.FILTER:
|
if idx in self.FILTER:
|
||||||
self.write(self.FILTER[idx])
|
self.write(self.FILTER[idx])
|
||||||
else:
|
else:
|
||||||
raise IndexError
|
raise IndexError
|
||||||
@@ -358,7 +358,7 @@ class Lakeshore336(LakeshoreDevice):
|
|||||||
self.IEEE = args[0]
|
self.IEEE = args[0]
|
||||||
def doQueryINCRV(self, cmd, args):
|
def doQueryINCRV(self, cmd, args):
|
||||||
idx = ord(args[0]) - 64
|
idx = ord(args[0]) - 64
|
||||||
if idx in self.INCRV:
|
if idx in self.INCRV:
|
||||||
self.write(self.INCRV[idx])
|
self.write(self.INCRV[idx])
|
||||||
else:
|
else:
|
||||||
self.write("0")
|
self.write("0")
|
||||||
@@ -370,7 +370,7 @@ class Lakeshore336(LakeshoreDevice):
|
|||||||
self.INCRV[key] = args[1]
|
self.INCRV[key] = args[1]
|
||||||
def doQueryINTYPE(self, cmd, args):
|
def doQueryINTYPE(self, cmd, args):
|
||||||
idx = ord(args[0]) - 64
|
idx = ord(args[0]) - 64
|
||||||
if idx in self.INTYPE:
|
if idx in self.INTYPE:
|
||||||
self.write(self.INTYPE[idx])
|
self.write(self.INTYPE[idx])
|
||||||
else:
|
else:
|
||||||
self.write("0")
|
self.write("0")
|
||||||
@@ -385,7 +385,7 @@ class Lakeshore336(LakeshoreDevice):
|
|||||||
self.KEYST = 0
|
self.KEYST = 0
|
||||||
def doQueryKRDG(self, cmd, args):
|
def doQueryKRDG(self, cmd, args):
|
||||||
idx = ord(args[0]) - 64
|
idx = ord(args[0]) - 64
|
||||||
if idx in self.KRDG:
|
if idx in self.KRDG:
|
||||||
if self.RANDOM > 0:
|
if self.RANDOM > 0:
|
||||||
self.write("%f" % (self.KRDG[idx] + random.uniform(-self.RANDOM, self.RANDOM)))
|
self.write("%f" % (self.KRDG[idx] + random.uniform(-self.RANDOM, self.RANDOM)))
|
||||||
else:
|
else:
|
||||||
@@ -504,7 +504,7 @@ class Lakeshore336(LakeshoreDevice):
|
|||||||
self.write("%f" % val)
|
self.write("%f" % val)
|
||||||
def doCommandSETP(self, cmd, args):
|
def doCommandSETP(self, cmd, args):
|
||||||
idx = int(args[0])
|
idx = int(args[0])
|
||||||
val = float(args[1])
|
val = float(args[1])
|
||||||
if (val >= 0.0 and val <= 500.0):
|
if (val >= 0.0 and val <= 500.0):
|
||||||
self.TARGET[idx] = val
|
self.TARGET[idx] = val
|
||||||
if self.RAMP_ON[idx] == 0:
|
if self.RAMP_ON[idx] == 0:
|
||||||
|
|||||||
@@ -185,14 +185,14 @@ class Lakeshore340(LakeshoreDevice):
|
|||||||
def doQueryALARM(self, cmd, args):
|
def doQueryALARM(self, cmd, args):
|
||||||
if len(args) > 0:
|
if len(args) > 0:
|
||||||
idx = ord(args[0]) - 64
|
idx = ord(args[0]) - 64
|
||||||
if idx in self.ALARM:
|
if idx in self.ALARM:
|
||||||
self.write(self.ALARM[idx])
|
self.write(self.ALARM[idx])
|
||||||
else:
|
else:
|
||||||
self.write("0,1,500.0,0.0,0")
|
self.write("0,1,500.0,0.0,0")
|
||||||
def doQueryALARMST(self, cmd, args):
|
def doQueryALARMST(self, cmd, args):
|
||||||
if len(args) > 0:
|
if len(args) > 0:
|
||||||
idx = ord(args[0]) - 64
|
idx = ord(args[0]) - 64
|
||||||
if idx in self.ALARMST:
|
if idx in self.ALARMST:
|
||||||
self.write(self.ALARMST[idx])
|
self.write(self.ALARMST[idx])
|
||||||
else:
|
else:
|
||||||
self.write("0,0")
|
self.write("0,0")
|
||||||
@@ -273,7 +273,7 @@ class Lakeshore340(LakeshoreDevice):
|
|||||||
self.write("%f" % self.COMM)
|
self.write("%f" % self.COMM)
|
||||||
def doQueryCRDG(self, cmd, args):
|
def doQueryCRDG(self, cmd, args):
|
||||||
idx = ord(args[0]) - 64
|
idx = ord(args[0]) - 64
|
||||||
if idx in self.KRDG:
|
if idx in self.KRDG:
|
||||||
if self.RANDOM > 0:
|
if self.RANDOM > 0:
|
||||||
self.write("%f" % (self.KRDG[idx] - 273.15 + random.uniform(-self.RANDOM, self.RANDOM)))
|
self.write("%f" % (self.KRDG[idx] - 273.15 + random.uniform(-self.RANDOM, self.RANDOM)))
|
||||||
else:
|
else:
|
||||||
@@ -354,8 +354,8 @@ class Lakeshore340(LakeshoreDevice):
|
|||||||
for key in keys:
|
for key in keys:
|
||||||
self.FILTER[key] = params
|
self.FILTER[key] = params
|
||||||
def doQueryFILTER(self, cmd, args):
|
def doQueryFILTER(self, cmd, args):
|
||||||
idx = int(args[0])
|
idx = int(args[0])
|
||||||
if idx in self.FILTER:
|
if idx in self.FILTER:
|
||||||
self.write(self.FILTER[idx])
|
self.write(self.FILTER[idx])
|
||||||
else:
|
else:
|
||||||
raise IndexError
|
raise IndexError
|
||||||
@@ -373,7 +373,7 @@ class Lakeshore340(LakeshoreDevice):
|
|||||||
self.IEEE = args[0]
|
self.IEEE = args[0]
|
||||||
def doQueryINCRV(self, cmd, args):
|
def doQueryINCRV(self, cmd, args):
|
||||||
idx = ord(args[0]) - 64
|
idx = ord(args[0]) - 64
|
||||||
if idx in self.INCRV:
|
if idx in self.INCRV:
|
||||||
self.write(self.INCRV[idx])
|
self.write(self.INCRV[idx])
|
||||||
else:
|
else:
|
||||||
self.write("0")
|
self.write("0")
|
||||||
@@ -385,19 +385,19 @@ class Lakeshore340(LakeshoreDevice):
|
|||||||
self.INCRV[key] = args[1]
|
self.INCRV[key] = args[1]
|
||||||
def doQueryINTYPE(self, cmd, args):
|
def doQueryINTYPE(self, cmd, args):
|
||||||
idx = ord(args[0]) - 64
|
idx = ord(args[0]) - 64
|
||||||
if idx in self.INTYPE:
|
if idx in self.INTYPE:
|
||||||
self.write(self.INTYPE[idx])
|
self.write(self.INTYPE[idx])
|
||||||
else:
|
else:
|
||||||
self.write("0")
|
self.write("0")
|
||||||
def doQueryINSET(self, cmd, args):
|
def doQueryINSET(self, cmd, args):
|
||||||
idx = ord(args[0])
|
idx = ord(args[0])
|
||||||
if idx in self.INSET:
|
if idx in self.INSET:
|
||||||
self.write(self.INSET[idx])
|
self.write(self.INSET[idx])
|
||||||
else:
|
else:
|
||||||
self.write("0,0")
|
self.write("0,0")
|
||||||
def doCommandINSET(self, cmd, args):
|
def doCommandINSET(self, cmd, args):
|
||||||
if len(args) > 0:
|
if len(args) > 0:
|
||||||
idx = ord(args[0])
|
idx = ord(args[0])
|
||||||
if idx in self.INSET:
|
if idx in self.INSET:
|
||||||
self.INSET[idx] = ",".join(args[1:])
|
self.INSET[idx] = ",".join(args[1:])
|
||||||
def doCommandINTYPE(self, cmd, args):
|
def doCommandINTYPE(self, cmd, args):
|
||||||
@@ -411,7 +411,7 @@ class Lakeshore340(LakeshoreDevice):
|
|||||||
self.KEYST = 0
|
self.KEYST = 0
|
||||||
def doQueryKRDG(self, cmd, args):
|
def doQueryKRDG(self, cmd, args):
|
||||||
idx = ord(args[0]) - 64
|
idx = ord(args[0]) - 64
|
||||||
if idx in self.KRDG:
|
if idx in self.KRDG:
|
||||||
if self.RANDOM > 0:
|
if self.RANDOM > 0:
|
||||||
self.write("%f" % (self.KRDG[idx] + random.uniform(-self.RANDOM, self.RANDOM)))
|
self.write("%f" % (self.KRDG[idx] + random.uniform(-self.RANDOM, self.RANDOM)))
|
||||||
else:
|
else:
|
||||||
@@ -517,7 +517,7 @@ class Lakeshore340(LakeshoreDevice):
|
|||||||
self.write("%f" % val)
|
self.write("%f" % val)
|
||||||
def doCommandSETP(self, cmd, args):
|
def doCommandSETP(self, cmd, args):
|
||||||
idx = int(args[0])
|
idx = int(args[0])
|
||||||
val = float(args[1])
|
val = float(args[1])
|
||||||
if (val >= 0.0 and val <= 500.0):
|
if (val >= 0.0 and val <= 500.0):
|
||||||
self.TARGET[idx] = val
|
self.TARGET[idx] = val
|
||||||
if self.RAMP_ON[idx] == 0:
|
if self.RAMP_ON[idx] == 0:
|
||||||
|
|||||||
@@ -177,14 +177,14 @@ class Lakeshore370(LakeshoreDevice):
|
|||||||
for key in keys:
|
for key in keys:
|
||||||
self.ALARM[key] = params
|
self.ALARM[key] = params
|
||||||
def doQueryALARM(self, cmd, args):
|
def doQueryALARM(self, cmd, args):
|
||||||
idx = int(args[0])
|
idx = int(args[0])
|
||||||
if idx in self.ALARM:
|
if idx in self.ALARM:
|
||||||
self.write(self.ALARM[idx])
|
self.write(self.ALARM[idx])
|
||||||
else:
|
else:
|
||||||
self.write("0,1,500.0,0.0,0")
|
self.write("0,1,500.0,0.0,0")
|
||||||
def doQueryALARMST(self, cmd, args):
|
def doQueryALARMST(self, cmd, args):
|
||||||
idx = int(args[0])
|
idx = int(args[0])
|
||||||
if idx in self.ALARMST:
|
if idx in self.ALARMST:
|
||||||
self.write(self.ALARMST[idx])
|
self.write(self.ALARMST[idx])
|
||||||
else:
|
else:
|
||||||
self.write("0,0")
|
self.write("0,0")
|
||||||
@@ -309,8 +309,8 @@ class Lakeshore370(LakeshoreDevice):
|
|||||||
for key in keys:
|
for key in keys:
|
||||||
self.FILTER[key] = params
|
self.FILTER[key] = params
|
||||||
def doQueryFILTER(self, cmd, args):
|
def doQueryFILTER(self, cmd, args):
|
||||||
idx = int(args[0])
|
idx = int(args[0])
|
||||||
if idx in self.FILTER:
|
if idx in self.FILTER:
|
||||||
self.write(self.FILTER[idx])
|
self.write(self.FILTER[idx])
|
||||||
else:
|
else:
|
||||||
raise IndexError
|
raise IndexError
|
||||||
@@ -339,8 +339,8 @@ class Lakeshore370(LakeshoreDevice):
|
|||||||
def doCommandIEEE(self, cmd, args):
|
def doCommandIEEE(self, cmd, args):
|
||||||
self.IEEE = args[0]
|
self.IEEE = args[0]
|
||||||
def doQueryINSET(self, cmd, args):
|
def doQueryINSET(self, cmd, args):
|
||||||
idx = int(args[0])
|
idx = int(args[0])
|
||||||
if idx in self.INSET:
|
if idx in self.INSET:
|
||||||
self.write(self.INSET[idx])
|
self.write(self.INSET[idx])
|
||||||
else:
|
else:
|
||||||
self.write("0")
|
self.write("0")
|
||||||
@@ -414,8 +414,8 @@ class Lakeshore370(LakeshoreDevice):
|
|||||||
response = "%d" % self.RAMP_ST
|
response = "%d" % self.RAMP_ST
|
||||||
self.write(response)
|
self.write(response)
|
||||||
def doQueryRDGK(self, cmd, args):
|
def doQueryRDGK(self, cmd, args):
|
||||||
idx = int(args[0])
|
idx = int(args[0])
|
||||||
if idx in self.KRDG:
|
if idx in self.KRDG:
|
||||||
if self.RANDOM > 0:
|
if self.RANDOM > 0:
|
||||||
self.write("%f" % (self.KRDG[idx] + random.uniform(-self.RANDOM, self.RANDOM)))
|
self.write("%f" % (self.KRDG[idx] + random.uniform(-self.RANDOM, self.RANDOM)))
|
||||||
else:
|
else:
|
||||||
@@ -452,7 +452,7 @@ class Lakeshore370(LakeshoreDevice):
|
|||||||
self.write("%f" % val)
|
self.write("%f" % val)
|
||||||
def doCommandSETP(self, cmd, args):
|
def doCommandSETP(self, cmd, args):
|
||||||
idx = 1
|
idx = 1
|
||||||
val = float(args[0])
|
val = float(args[0])
|
||||||
if (val >= 0.0 and val <= 500.0):
|
if (val >= 0.0 and val <= 500.0):
|
||||||
self.TARGET[idx] = val
|
self.TARGET[idx] = val
|
||||||
if self.RAMP_ON[idx] == 0:
|
if self.RAMP_ON[idx] == 0:
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ class LakeshoreProtocol(Protocol):
|
|||||||
print "connectionMade:", self.factory.numProtocols
|
print "connectionMade:", self.factory.numProtocols
|
||||||
if self.factory.numProtocols > 2:
|
if self.factory.numProtocols > 2:
|
||||||
print "Too many connections - rejecting"
|
print "Too many connections - rejecting"
|
||||||
self.transport.write("Too many connections, try later" + self.term)
|
self.transport.write("Too many connections, try later" + self.term)
|
||||||
self.transport.loseConnection()
|
self.transport.loseConnection()
|
||||||
else:
|
else:
|
||||||
self.transport.write(("Welcome connection %d" % self.factory.numProtocols) + self.term)
|
self.transport.write(("Welcome connection %d" % self.factory.numProtocols) + self.term)
|
||||||
@@ -55,7 +55,7 @@ class LakeshoreProtocol(Protocol):
|
|||||||
self.response = ""
|
self.response = ""
|
||||||
else:
|
else:
|
||||||
self.pdu = self.pdu + c
|
self.pdu = self.pdu + c
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
class TestDevice:
|
class TestDevice:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class MercuryProtocol(Protocol):
|
|||||||
print "connectionMade:", self.factory.numProtocols
|
print "connectionMade:", self.factory.numProtocols
|
||||||
if self.factory.numProtocols > 2:
|
if self.factory.numProtocols > 2:
|
||||||
print "Too many connections - rejecting"
|
print "Too many connections - rejecting"
|
||||||
self.transport.write("Too many connections, try later" + self.term)
|
self.transport.write("Too many connections, try later" + self.term)
|
||||||
self.transport.loseConnection()
|
self.transport.loseConnection()
|
||||||
else:
|
else:
|
||||||
self.transport.write(("Welcome connection %d" % self.factory.numProtocols) + self.term)
|
self.transport.write(("Welcome connection %d" % self.factory.numProtocols) + self.term)
|
||||||
@@ -59,7 +59,7 @@ class MercuryProtocol(Protocol):
|
|||||||
self.response = ""
|
self.response = ""
|
||||||
else:
|
else:
|
||||||
self.pdu = self.pdu + c
|
self.pdu = self.pdu + c
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
class TestDevice:
|
class TestDevice:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|||||||
@@ -319,7 +319,7 @@ class Baker(Able):
|
|||||||
def cb0(result, *args, **kw):
|
def cb0(result, *args, **kw):
|
||||||
if debug:
|
if debug:
|
||||||
print "\nMercury:", result.short_tree()
|
print "\nMercury:", result.short_tree()
|
||||||
self.deferred.callback(result)
|
self.deferred.callback(result)
|
||||||
if "mercury_scpi" in config.sections() and config.get("mercury_scpi", "enabled"):
|
if "mercury_scpi" in config.sections() and config.get("mercury_scpi", "enabled"):
|
||||||
self.deferred = defer.Deferred()
|
self.deferred = defer.Deferred()
|
||||||
d = self.load_hipadaba("/sample/%s" % config.get("mercury_scpi", "name"))
|
d = self.load_hipadaba("/sample/%s" % config.get("mercury_scpi", "name"))
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
# The compare_deploy.py uses FILEMAP.TXT from the staging tree produced by the "./deploySICS.sh -n"
|
# The compare_deploy.py uses FILEMAP.TXT from the staging tree produced by the "./deploySICS.sh -n"
|
||||||
# The compare_deploy.py path is to what *is* deployed on echidna
|
# The compare_deploy.py path is to what *is* deployed on echidna
|
||||||
# The untracked files may be manually deployed and missing from MANIFEST.TXT
|
# The untracked files may be manually deployed and missing from MANIFEST.TXT
|
||||||
# The untracked files may be new, modified, test or junk
|
# The untracked files may be new, modified, test or junk
|
||||||
# You can then "gvim -d " then cut/paste lines emitted under "Changed Files:" (or diff)
|
# You can then "gvim -d " then cut/paste lines emitted under "Changed Files:" (or diff)
|
||||||
#
|
#
|
||||||
import os
|
import os
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ inst_test_sockoffset = {
|
|||||||
'echidna' : 0,
|
'echidna' : 0,
|
||||||
'wombat' : 100,
|
'wombat' : 100,
|
||||||
'kowari' : 200,
|
'kowari' : 200,
|
||||||
'dingo' : 300,
|
'dingo' : 300,
|
||||||
'quokka' : 400,
|
'quokka' : 400,
|
||||||
'platypus' : 500,
|
'platypus' : 500,
|
||||||
'pelican' : 600,
|
'pelican' : 600,
|
||||||
@@ -37,7 +37,7 @@ inst_test_sockoffset = {
|
|||||||
'emu' : 1100
|
'emu' : 1100
|
||||||
}
|
}
|
||||||
|
|
||||||
deflt_dir = '/usr/local/sics/server'
|
deflt_dir = '/usr/local/sics/server'
|
||||||
deflt_sockoffset = 'none'
|
deflt_sockoffset = 'none'
|
||||||
deflt_user = inst_user
|
deflt_user = inst_user
|
||||||
sics_killer = inst_user
|
sics_killer = inst_user
|
||||||
@@ -66,7 +66,7 @@ def start_cmd(server, args):
|
|||||||
'fakedev': 'SICS_SIMULATION=fakedev%s' % soffset,
|
'fakedev': 'SICS_SIMULATION=fakedev%s' % soffset,
|
||||||
'scriptval': 'SICS_SIMULATION=script_validator%s' % soffset
|
'scriptval': 'SICS_SIMULATION=script_validator%s' % soffset
|
||||||
}
|
}
|
||||||
# Set SICS_SIMULATION environment variable
|
# Set SICS_SIMULATION environment variable
|
||||||
if (server == 'scriptval'):
|
if (server == 'scriptval'):
|
||||||
SIMENV = sicsenv['scriptval']
|
SIMENV = sicsenv['scriptval']
|
||||||
else:
|
else:
|
||||||
@@ -111,7 +111,7 @@ def stop_cmd(server, args):
|
|||||||
return
|
return
|
||||||
if status_fn(server, args) != (0,0):
|
if status_fn(server, args) != (0,0):
|
||||||
print 'Failed to stop %s' % server
|
print 'Failed to stop %s' % server
|
||||||
print "Fragging PID %d with default KILL" % (pid)
|
print "Fragging PID %d with default KILL" % (pid)
|
||||||
subprocess.call(shlex.split('sudo -u %s /bin/kill %d' %
|
subprocess.call(shlex.split('sudo -u %s /bin/kill %d' %
|
||||||
(sics_killer, pid)))
|
(sics_killer, pid)))
|
||||||
else:
|
else:
|
||||||
@@ -215,7 +215,7 @@ def main(**kwargs):
|
|||||||
help= args_dir_help % (server_port['sics']['server'] +
|
help= args_dir_help % (server_port['sics']['server'] +
|
||||||
inst_test_sockoffset[inst_name]),
|
inst_test_sockoffset[inst_name]),
|
||||||
action='store_true')
|
action='store_true')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
# By default don't launch script validator in development environments.
|
# By default don't launch script validator in development environments.
|
||||||
if args.dev:
|
if args.dev:
|
||||||
if args.scriptval:
|
if args.scriptval:
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class Screen(CursesStdIO):
|
|||||||
self.redisplayLines()
|
self.redisplayLines()
|
||||||
|
|
||||||
def redisplayLines(self):
|
def redisplayLines(self):
|
||||||
""" method for redisplaying lines
|
""" method for redisplaying lines
|
||||||
based on internal list of lines """
|
based on internal list of lines """
|
||||||
|
|
||||||
self.stdscr.clear()
|
self.stdscr.clear()
|
||||||
@@ -60,7 +60,7 @@ class Screen(CursesStdIO):
|
|||||||
i = 0
|
i = 0
|
||||||
index = len(self.lines) - 1
|
index = len(self.lines) - 1
|
||||||
while i < (self.rows - 3) and index >= 0:
|
while i < (self.rows - 3) and index >= 0:
|
||||||
self.stdscr.addstr(self.rows - 3 - i, 0, self.lines[index],
|
self.stdscr.addstr(self.rows - 3 - i, 0, self.lines[index],
|
||||||
curses.color_pair(2))
|
curses.color_pair(2))
|
||||||
i = i + 1
|
i = i + 1
|
||||||
index = index - 1
|
index = index - 1
|
||||||
@@ -68,7 +68,7 @@ class Screen(CursesStdIO):
|
|||||||
|
|
||||||
def paintStatus(self, text):
|
def paintStatus(self, text):
|
||||||
if len(text) > self.cols: raise TextTooLongError
|
if len(text) > self.cols: raise TextTooLongError
|
||||||
self.stdscr.addstr(self.rows-2,0,text + ' ' * (self.cols-len(text)),
|
self.stdscr.addstr(self.rows-2,0,text + ' ' * (self.cols-len(text)),
|
||||||
curses.color_pair(1))
|
curses.color_pair(1))
|
||||||
# move cursor to input line
|
# move cursor to input line
|
||||||
self.stdscr.move(self.rows-1, self.cols-1)
|
self.stdscr.move(self.rows-1, self.cols-1)
|
||||||
@@ -106,7 +106,7 @@ class Screen(CursesStdIO):
|
|||||||
return
|
return
|
||||||
self.searchText = self.searchText + chr(c)
|
self.searchText = self.searchText + chr(c)
|
||||||
|
|
||||||
self.stdscr.addstr(self.rows-1, 0,
|
self.stdscr.addstr(self.rows-1, 0,
|
||||||
self.searchText + (' ' * (
|
self.searchText + (' ' * (
|
||||||
self.cols-len(self.searchText)-2)))
|
self.cols-len(self.searchText)-2)))
|
||||||
self.stdscr.move(self.rows-1, len(self.searchText))
|
self.stdscr.move(self.rows-1, len(self.searchText))
|
||||||
|
|||||||
Reference in New Issue
Block a user