def sread(self, expect='^cmd$', wait=0):
     _d = None
     exp = re.compile(expect)
     line = self.serial.readline().rstrip()
     tag_steps = re.compile('^p_.*$')
     tag_horizontal = re.compile('^h_.*$')
     tag_equatorial = re.compile('^e_.*$')
     _count = 0
     while (not exp.match(line) and _count <= wait):
         if tag_steps.match(line):
             resp = line.replace("p_", '')
             _d = resp.split(' ')
             logging.debug("Steps: (%s, %s)" % (_d[0], _d[1]))
         elif tag_horizontal.match(line):
             resp = line.replace("h_", '')
             _d = resp.split(' ')
             self.pos_received.emit(_d[0], _d[1])
             logging.debug(
                 "PosH: (%s / %s)" %
                 (coords.deg_2_degStr(360.0 - coords.radStr_2_deg(_d[0])),
                  coords.deg_2_degStr(coords.radStr_2_deg(_d[1]))))
         elif tag_equatorial.match(line):
             resp = line.replace("e_", '')
             _d = resp.split(' ')
             self.pos_e_received.emit(_d[0], _d[1])
             logging.debug("PosE: (%s / %s)" % ( \
                 coords.hour_2_hourStr(coords.rad_2_hour(coords.degStr_2_rad(coords.radStr_2_degStr(_d[0])))), \
                 coords.deg_2_degStr(coords.radStr_2_deg(_d[1])) ))
         if line == '':
             _count += 1
         else:
             print("__debug__: %s" % line)
         line = self.serial.readline().rstrip()
     return line
 def sread(self, expect='^cmd$', wait=0):
     _d = None
     exp = re.compile(expect)
     line = self.serial.readline().rstrip()
     tag_steps = re.compile('^p_.*$')
     tag_horizontal = re.compile('^h_.*$')
     tag_equatorial = re.compile('^e_.*$')
     _count = 0
     while(not exp.match(line) and _count <= wait):
         if tag_steps.match(line):
             resp = line.replace("p_", '')
             _d = resp.split(' ')
             logging.debug("Steps: (%s, %s)" % (_d[0], _d[1]))
         elif tag_horizontal.match(line):
             resp = line.replace("h_", '')
             _d = resp.split(' ')
             self.pos_received.emit(_d[0], _d[1])
             logging.debug("PosH: (%s / %s)" % ( coords.deg_2_degStr( 360.0 - coords.radStr_2_deg(_d[0])), coords.deg_2_degStr( coords.radStr_2_deg(_d[1])) ))
         elif tag_equatorial.match(line):
             resp = line.replace("e_", '')
             _d = resp.split(' ')
             self.pos_e_received.emit(_d[0], _d[1])
             logging.debug("PosE: (%s / %s)" % ( \
                 coords.hour_2_hourStr(coords.rad_2_hour(coords.degStr_2_rad(coords.radStr_2_degStr(_d[0])))), \
                 coords.deg_2_degStr(coords.radStr_2_deg(_d[1])) ))
         if line == '':
             _count += 1
         else:
             print("__debug__: %s" % line)
         line = self.serial.readline().rstrip()
     return line
Esempio n. 3
0
 def pos_received(self, x, y):
     logging.debug("%s,%s" % (x, y))
     self.pos = (x, y)
     self.ui.posHorizontal.setText("%s" % _fromUtf8(
         coords.deg_2_degStr(360.0 - coords.radStr_2_deg(self.pos[0]))))
     self.ui.posVertical.setText(
         "%s" % _fromUtf8(coords.radStr_2_degStr(self.pos[1])))
	def pos_received(self, x, y):
		logging.debug("%s,%s" % (x, y))
		self.pos = (x, y)
		self.ui.posHorizontal.setText("%s" % _fromUtf8(coords.deg_2_degStr(360.0 - coords.radStr_2_deg(self.pos[0]))))
		self.ui.posVertical.setText("%s" % _fromUtf8(coords.radStr_2_degStr(self.pos[1])))