pyomyo icon indicating copy to clipboard operation
pyomyo copied to clipboard

Stuck after run for over 3 minutes

Open mayorhao opened this issue 2 years ago • 0 comments

Hi guys, I wonder did anyone encountered with after run self.run method for minutes, no data came out then. I have done some debugger work, and found that it's the line c = self.ser.read() in the method recv_packet of the BT class stuck. Any ideas? Is the device disconnected after certain time?

def recv_packet(self):
  n = self.ser.inWaiting() # Windows fix
  
  while True:
	  c = self.ser.read()
	  if not c:
		  return None
  
	  ret = self.proc_byte(ord(c))
	  if ret:
		  if ret.typ == 0x80:
			  self.handle_event(ret)
			  # Windows fix
			  if n >= 5096:
				  print("Clearning",n)
				  self.ser.flushInput()
			  # End of Windows fix
		  return ret

mayorhao avatar Feb 23 '23 19:02 mayorhao