Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stuck after run for over 3 minutes #13

Open
mayorhao opened this issue Feb 23, 2023 · 0 comments
Open

Stuck after run for over 3 minutes #13

mayorhao opened this issue Feb 23, 2023 · 0 comments

Comments

@mayorhao
Copy link

mayorhao commented Feb 23, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant