]> Pileus Git - ~andy/csm213a-hw/commitdiff
Flush pending input data from device
authorAndy Spencer <andy753421@gmail.com>
Mon, 3 Feb 2014 08:02:52 +0000 (08:02 +0000)
committerAndy Spencer <andy753421@gmail.com>
Mon, 3 Feb 2014 08:02:52 +0000 (08:02 +0000)
vis/device.py

index ba4678709df6b8872c022b805e9f490b5c79171d..f1766f0f57726b6e9c9121ad70281973fbcc27fa 100644 (file)
@@ -32,6 +32,7 @@ class Device:
                                bytesize = self.config.databits, \
                                stopbits = self.config.stopbits, \
                                timeout  = 0)
                                bytesize = self.config.databits, \
                                stopbits = self.config.stopbits, \
                                timeout  = 0)
+                       self.serial.flushInput()
                except Exception as ex:
                        return str(ex)
 
                except Exception as ex:
                        return str(ex)
 
@@ -69,7 +70,7 @@ class Device:
                        else:
                                self.inbuf.append(char)
                        if count > limit:
                        else:
                                self.inbuf.append(char)
                        if count > limit:
-                               print("Eror: exceeded read limit")
+                               print("Error: exceeded read limit")
                                break
                        count += 1
                return items
                                break
                        count += 1
                return items