eric6/MicroPython/MicroPythonDevices.py

changeset 8038
73ec029d4107
parent 8024
e0eb1d5922a5
child 8051
b78279548993
--- a/eric6/MicroPython/MicroPythonDevices.py	Sun Jan 31 17:47:01 2021 +0100
+++ b/eric6/MicroPython/MicroPythonDevices.py	Sun Jan 31 17:47:55 2021 +0100
@@ -13,6 +13,8 @@
 
 from PyQt5.QtCore import pyqtSlot, QObject
 
+from E5Gui.E5Application import e5App
+
 import UI.PixmapCache
 import Preferences
 
@@ -32,6 +34,7 @@
         ],
         "description": "ESP8266, ESP32",
         "icon": "esp32Device",
+        "port_description": "",
     },
     
     "circuitpython": {
@@ -67,6 +70,7 @@
         ],
         "description": "CircuitPython Board",
         "icon": "circuitPythonDevice",
+        "port_description": "",
     },
     
     "bbc_microbit": {
@@ -75,6 +79,7 @@
         ],
         "description": "BBC micro:bit",
         "icon": "microbitDevice",
+        "port_description": "BBC micro:bit CMSIS-DAP",
     },
     
     "calliope": {
@@ -83,6 +88,7 @@
         ],
         "description": "Calliope mini",
         "icon": "calliope_mini",
+        "port_description": "DAPLink CMSIS-DAP",
     },
     
     "pyboard": {
@@ -93,6 +99,7 @@
         ],
         "description": "PyBoard",
         "icon": "micropython48",
+        "port_description": "",
     },
 }
 
@@ -139,6 +146,14 @@
         for board in SupportedBoards:
             if ((vid, pid) in SupportedBoards[board]["ids"] or
                     (vid, None) in SupportedBoards[board]["ids"]):
+                if board in ("bbc_microbit", "calliope"):
+                    # both boards have the same VID and PID
+                    # try to differentiate based on port description
+                    if (
+                        port.description().strip() !=
+                        SupportedBoards[board]["port_description"]
+                    ):
+                        continue
                 foundDevices.append(
                     (board, SupportedBoards[board]["description"],
                      port.portName()))
@@ -429,3 +444,11 @@
         @rtype str
         """
         return ""
+    
+    def downloadFirmware(self):
+        """
+        Public method to download the device firmware.
+        """
+        url = self.getFirmwareUrl()
+        if url:
+            e5App().getObject("UserInterface").launchHelpViewer(url)

eric ide

mercurial