Commits

Trammell Hudson  committed e00e8b8

allow negative values and longer timeouts

  • Participants
  • Parent commits e3a8f7a

Comments (0)

Files changed (1)

 class MDC:
 	def __init__(self, tty):
 		self.file = tty
-		self.port = serial.Serial(tty, timeout=1)
+		self.port = serial.Serial(tty, timeout=10)
 		self.axis = -1
 		self.channels = {}
-		self.re = re.compile('^(.*?)=([0-9]+):([0-9]+)')
+		self.re = re.compile('^(.*?)=(-?[0-9]+):(-?[0-9]+)')
 		self.thread = threading.Thread(target = self.startup)
 		self.thread.daemon = True
 		self.thread.start()
 
 		# if we haven't had the axes assigned, ignore all
 		# the data from the serial port
+		if 1 not in self.channels:
+			return
+		if 2 not in self.channels:
+			return
 		c1 = self.channels[1]
 		c2 = self.channels[2]
-		if not c1 or not c2:
-			return
 		
 		if type == 'C':
 			counts[c1] = x1