Reverse back to thread
This commit is contained in:
		
							parent
							
								
									f06503b6fb
								
							
						
					
					
						commit
						135f69bec5
					
				
					 1 changed files with 5 additions and 3 deletions
				
			
		|  | @ -1,4 +1,4 @@ | ||||||
| import asyncio | import threading | ||||||
| import time | import time | ||||||
| from typing import Optional, Tuple | from typing import Optional, Tuple | ||||||
| 
 | 
 | ||||||
|  | @ -47,7 +47,9 @@ class JoyCon: | ||||||
|         self._setup_sensors() |         self._setup_sensors() | ||||||
| 
 | 
 | ||||||
|         # start talking with the joycon in a daemon thread |         # start talking with the joycon in a daemon thread | ||||||
|         asyncio.run(self._update_input_report()) |         self._update_input_report_thread = threading.Thread(target=self._update_input_report) | ||||||
|  |         self._update_input_report_thread.setDaemon(True) | ||||||
|  |         self._update_input_report_thread.start() | ||||||
| 
 | 
 | ||||||
|     def _open(self, vendor_id, product_id, serial): |     def _open(self, vendor_id, product_id, serial): | ||||||
|         try: |         try: | ||||||
|  | @ -113,7 +115,7 @@ class JoyCon: | ||||||
| 
 | 
 | ||||||
|         return report[7:size + 7] |         return report[7:size + 7] | ||||||
| 
 | 
 | ||||||
|     async def _update_input_report(self):  # daemon thread |     def _update_input_report(self):  # daemon thread | ||||||
|         try: |         try: | ||||||
|             while self._joycon_device: |             while self._joycon_device: | ||||||
|                 report = [0] |                 report = [0] | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue