File tree Expand file tree Collapse file tree 3 files changed +13
-13
lines changed Expand file tree Collapse file tree 3 files changed +13
-13
lines changed Original file line number Diff line number Diff line change 4
4
5
5
__author__ = "Lucio Rossi <l.rossi@arduino.cc>, Giovanni Bruno <g.bruno@arduino.cc>"
6
6
__license__ = "MPL 2.0"
7
- __version__ = "1.1.1 "
7
+ __version__ = "1.1.2 "
8
8
__maintainer__ = "Lucio Rossi <l.rossi@arduino.cc>, Giovanni Bruno <g.bruno@arduino.cc>"
9
9
__required_firmware_version__ = "1.1.0"
10
10
Original file line number Diff line number Diff line change @@ -278,8 +278,7 @@ def _flush_uart():
278
278
Empties the UART buffer
279
279
:return:
280
280
"""
281
- while uart .any ():
282
- uart .read (1 )
281
+ uart .read (uart .any ())
283
282
284
283
def _begin_update_thread (self ):
285
284
"""
@@ -647,21 +646,22 @@ def _update(self, delay_=1):
647
646
self .set_behaviour (2 )
648
647
if not ArduinoAlvik ._update_thread_running :
649
648
break
650
- if self ._read_message ():
651
- self ._parse_message ()
649
+ self ._read_message ()
652
650
sleep_ms (delay_ )
653
651
654
- def _read_message (self ) -> bool :
652
+ def _read_message (self ) -> None :
655
653
"""
656
654
Read a message from the uC
657
655
:return: True if a message terminator was reached
658
656
"""
659
- while uart .any ():
660
- b = uart .read (1 )[0 ]
661
- self ._packeter .buffer .push (b )
662
- if b == self ._packeter .end_index and self ._packeter .checkPayload ():
663
- return True
664
- return False
657
+ buf = bytearray (uart .any ())
658
+ uart .readinto (buf )
659
+ if len (buf ):
660
+ uart .readinto (buf )
661
+ for b in buf :
662
+ self ._packeter .buffer .push (b )
663
+ if b == self ._packeter .end_index and self ._packeter .checkPayload ():
664
+ self ._parse_message ()
665
665
666
666
def _parse_message (self ) -> int :
667
667
"""
Original file line number Diff line number Diff line change 13
13
[" github:arduino/ucPack-mpy" , " 0.1.7" ],
14
14
[" github:arduino/arduino-runtime-mpy" , " 0.4.0" ]
15
15
],
16
- "version" : " 1.1.1 "
16
+ "version" : " 1.1.2 "
17
17
}
You can’t perform that action at this time.
0 commit comments