src/eric7/MicroPython/Devices/MicrobitDevices.py

branch
eric7
changeset 11177
f511038a0061
parent 11167
a3f5af773bc7
child 11186
c2d18aefef6b
--- a/src/eric7/MicroPython/Devices/MicrobitDevices.py	Tue Mar 18 18:32:29 2025 +0100
+++ b/src/eric7/MicroPython/Devices/MicrobitDevices.py	Thu Mar 20 11:54:57 2025 +0100
@@ -73,7 +73,8 @@
         """
         super().setConnected(connected)
 
-        self._deviceData["local_mip"] = False
+        if self._deviceData:
+            self._deviceData["local_mip"] = False
 
         if self.hasCircuitPython():
             self._submitMode = "paste"
@@ -281,20 +282,22 @@
             # BBC micro:bit
             if firmware:
                 deviceDirectories = FileSystemUtilities.findVolume(
-                    "MAINTENANCE", findAll=True
+                    "MAINTENANCE", findAll=True, markerFile="DETAILS.TXT"
                 )
             else:
                 deviceDirectories = FileSystemUtilities.findVolume(
-                    "MICROBIT", findAll=True
+                    "MICROBIT", findAll=True, markerFile="DETAILS.TXT"
                 )
         else:
             # Calliope mini
             if firmware:
                 deviceDirectories = FileSystemUtilities.findVolume(
-                    "MAINTENANCE", findAll=True
+                    "MAINTENANCE", findAll=True, markerFile="DETAILS.TXT"
                 )
             else:
-                deviceDirectories = FileSystemUtilities.findVolume("MINI", findAll=True)
+                deviceDirectories = FileSystemUtilities.findVolume(
+                    "MINI", findAll=True, markerFile="DETAILS.TXT"
+                )
         if len(deviceDirectories) == 0:
             if self.getDeviceType() == "bbc_microbit":
                 # BBC micro:bit is not ready or not mounted
@@ -968,6 +971,21 @@
         return True
 
 
+    def getBoardInformation(self):
+        """
+        Public method to get some information data of the connected board.
+
+        @return dictionary containing the determined data
+        @rtype dict
+        """
+        res = super().getBoardInformation()
+        with contextlib.suppress(KeyError):
+            if res["mc_temp_c"] is not None:
+                res["mc_temp_c"] = res["mc_temp_c"] / 100  # due to integer support only
+
+        return res
+
+
 def createDevice(microPythonWidget, deviceType, _vid, _pid, _boardName, serialNumber):
     """
     Function to instantiate a MicroPython device object.

eric ide

mercurial