added baudrate setting
This commit is contained in:
		
							parent
							
								
									a72aa16333
								
							
						
					
					
						commit
						6b8187c2a4
					
				
							
								
								
									
										6
									
								
								main.py
								
								
								
								
							
							
						
						
									
										6
									
								
								main.py
								
								
								
								
							| 
						 | 
					@ -14,13 +14,13 @@ rfm = adafruit_rfm9x.RFM9x(spi, CS, RESET, 868.0, baudrate=20000000)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
addr = '/tmp/rfmtty'
 | 
					addr = '/tmp/rfmtty'
 | 
				
			||||||
addr_client = '/tmp/rfmtty_client'
 | 
					addr_client = '/tmp/rfmtty_client'
 | 
				
			||||||
 | 
					baudrate = 115200
 | 
				
			||||||
 | 
					
 | 
				
			||||||
cmd=['/usr/bin/socat','-d','-d','PTY,link=%s,raw,echo=0' %
 | 
					cmd=['/usr/bin/socat','-d','-d','PTY,link=%s,rawer,baud=%d' %(addr, baudrate), 'PTY,link=%s,rawer,baud=%d' %(addr_client, baudrate)]
 | 
				
			||||||
        addr, 'PTY,link=%s,raw,echo=0' % addr_client]
 | 
					 | 
				
			||||||
socat_proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
 | 
					socat_proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
 | 
				
			||||||
time.sleep(1)
 | 
					time.sleep(1)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ser = serial.serial_for_url(addr)
 | 
					ser = serial.Serial(addr, baudrate=baudrate)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
packet_len = 120
 | 
					packet_len = 120
 | 
				
			||||||
while True:
 | 
					while True:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue