Forráskód Böngészése

Possible fix for pySerial API change in #32

kmpm 8 éve
szülő
commit
df716cc874
1 módosított fájl, 7 hozzáadás és 1 törlés
  1. 7 1
      lib/uploader.py

+ 7 - 1
lib/uploader.py

@@ -46,12 +46,18 @@ class Uploader(object):
 
             # Wait for the string to be sent before switching baud
             time.sleep(0.1)
-            self._port.setBaudrate(baud)
+            self.set_baudrate(baud)
 
             # Get in sync again
             sync()
 
         self.line_number = 0
+    
+    def set_baudrate(self, baud):
+        try:
+            self._port.setBaudrate(baud)
+        except AttributeError:
+            self._port.baudrate = baud
 
     def expect(self, exp='> ', timeout=TIMEOUT):
         """will wait for exp to be returned from nodemcu or timeout"""