diff options
| author | sommersoft <sommersoft@gmail.com> | 2020-06-03 17:39:31 -0500 |
|---|---|---|
| committer | sommersoft <sommersoft@gmail.com> | 2020-06-03 17:39:31 -0500 |
| commit | cf9da5982996f0eab8b0cb1ff4559050533db905 (patch) | |
| tree | cf474c00da0d867909a28e36c4c941546429b464 | |
| parent | 660081ece233b7c9caaa15fd63dcdeba50081443 (diff) | |
tools/cpboard.py: update pyserial usage to match 3.x version
| -rw-r--r-- | tools/cpboard.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/tools/cpboard.py b/tools/cpboard.py index 7bb6daaeb..8c60077c2 100644 --- a/tools/cpboard.py +++ b/tools/cpboard.py @@ -73,8 +73,8 @@ class REPL: return self.board.serial def read(self): - if self.serial.inWaiting(): - data = self.serial.read(self.serial.inWaiting()) + if self.serial.in_waiting: + data = self.serial.read(self.serial.in_waiting) else: data = b'' self.session += data @@ -86,7 +86,7 @@ class REPL: while True: if data.endswith(ending): break - elif self.serial.inWaiting() > 0: + elif self.serial.in_waiting > 0: new_data = self.serial.read(1) data += new_data self.session += new_data @@ -401,7 +401,10 @@ class CPboard: delayed = False for attempt in range(wait + 1): try: - self.serial = serial.Serial(self.device, baudrate=self.baudrate, timeout=self.timeout, write_timeout=self.timeout, interCharTimeout=1) + self.serial = serial.Serial(self.device, baudrate=self.baudrate, + timeout=self.timeout, + inter_byte_timeout=10, + write_timeout=self.timeout) break except (OSError, IOError): # Py2 and Py3 have different errors if wait == 0: |
