Skip to content

Stuck after run for over 3 minutes #13

Description

@mayorhao

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions