Merge pull request #37 from tneele/master
Improve performance: read more data from serial port at once
This commit is contained in:
commit
50a5cb9203
@ -30,7 +30,7 @@ class SerialReader(object):
|
|||||||
"""
|
"""
|
||||||
with serial.Serial(**self.serial_settings) as serial_handle:
|
with serial.Serial(**self.serial_settings) as serial_handle:
|
||||||
while True:
|
while True:
|
||||||
data = serial_handle.readline()
|
data = serial_handle.read(max(1, min(1024, serial_handle.in_waiting)))
|
||||||
self.telegram_buffer.append(data.decode('ascii'))
|
self.telegram_buffer.append(data.decode('ascii'))
|
||||||
|
|
||||||
for telegram in self.telegram_buffer.get_all():
|
for telegram in self.telegram_buffer.get_all():
|
||||||
|
Loading…
Reference in New Issue
Block a user