src/eric7/MicroPython/CircuitPythonDevices.py

branch
eric7
changeset 9751
606ac0e26533
parent 9749
5d409223cf3f
child 9752
2b9546c0cbd9
--- a/src/eric7/MicroPython/CircuitPythonDevices.py	Thu Feb 09 09:55:57 2023 +0100
+++ b/src/eric7/MicroPython/CircuitPythonDevices.py	Sat Feb 11 16:59:50 2023 +0100
@@ -363,15 +363,15 @@
                     line = f.readline()
                 cpyVersionStr = line.split(";")[0].split()[2]
                 cpyVersion = Globals.versionToTuple(cpyVersionStr)
-        if cpyVersion == (0, 0, 0) and self.microPython.isConnected():
+        if (
+            cpyVersion == (0, 0, 0)
+            and self._deviceData
+            and self._deviceData["mpy_version"] != "unknown"
+        ):
             # drive is not mounted or 'boot_out.txt' is missing but the device
             # is connected via the serial console
-            interface = self.microPython.commandsInterface()
-            if interface is not None:
-                impInfo = interface.getImplementation()
-                if impInfo["version"] != "unknown":
-                    cpyVersionStr = impInfo["version"]
-                    cpyVersion = Globals.versionToTuple(cpyVersionStr)
+            cpyVersionStr = self._deviceData["mpy_version"]
+            cpyVersion = Globals.versionToTuple(cpyVersionStr)
 
         msg = self.tr(
             "<h4>CircuitPython Version Information</h4>"
@@ -475,7 +475,7 @@
         ]
 
 
-def createDevice(microPythonWidget, deviceType, vid, pid, boardName):
+def createDevice(microPythonWidget, deviceType, vid, pid, boardName, serialNumber):
     """
     Function to instantiate a MicroPython device object.
 
@@ -489,6 +489,8 @@
     @type int
     @param boardName name of the board
     @type str
+    @param serialNumber serial number of the board
+    @type str
     @return reference to the instantiated device object
     @rtype CircuitPythonDevice
     """

eric ide

mercurial