added baudrate setting

This commit is contained in:
Paul 2024-01-08 17:52:28 +01:00
parent a72aa16333
commit 6b8187c2a4
1 changed files with 3 additions and 3 deletions

View File

@ -14,13 +14,13 @@ rfm = adafruit_rfm9x.RFM9x(spi, CS, RESET, 868.0, baudrate=20000000)
addr = '/tmp/rfmtty'
addr_client = '/tmp/rfmtty_client'
baudrate = 115200
cmd=['/usr/bin/socat','-d','-d','PTY,link=%s,raw,echo=0' %
addr, 'PTY,link=%s,raw,echo=0' % addr_client]
cmd=['/usr/bin/socat','-d','-d','PTY,link=%s,rawer,baud=%d' %(addr, baudrate), 'PTY,link=%s,rawer,baud=%d' %(addr_client, baudrate)]
socat_proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
time.sleep(1)
ser = serial.serial_for_url(addr)
ser = serial.Serial(addr, baudrate=baudrate)
packet_len = 120
while True: