MicroPython Interface eric7

Thu, 17 Apr 2025 18:15:32 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 17 Apr 2025 18:15:32 +0200
branch
eric7
changeset 11224
65b341cfab55
parent 11223
bcdb5a20ddc7
child 11225
b28460e1877e

MicroPython Interface
- Changed the board information scripts to work with MPy on nrf52 boards.

src/eric7/MicroPython/Devices/DeviceBase.py file | annotate | diff | comparison | revisions
--- a/src/eric7/MicroPython/Devices/DeviceBase.py	Thu Apr 17 11:49:45 2025 +0200
+++ b/src/eric7/MicroPython/Devices/DeviceBase.py	Thu Apr 17 18:15:32 2025 +0200
@@ -1223,7 +1223,7 @@
         @rtype dict
         @exception OSError raised to indicate an issue with the device
         """
-        commands = [  # needs to be splitted for boards with low memory
+        commands = [  # needs to be split for boards with low memory
             """def get_device_data():
     res = {}
 
@@ -1346,7 +1346,7 @@
         @return list of command strings to be executed
         @rtype list of str
         """
-        return [  # needs to be splitted for boards with low memory
+        return [  # needs to be split for boards with low memory
             """def get_board_info():
     res = {}
 
@@ -1458,10 +1458,13 @@
 
     try:
         import machine as mc
-        if isinstance(mc.freq(), tuple):
-            res['mc_frequency_mhz'] = mc.freq()[0] / 1000000.0
-        else:
-           res['mc_frequency_mhz'] = mc.freq() / 1000000.0
+        try:
+            if isinstance(mc.freq(), tuple):
+                res['mc_frequency_mhz'] = mc.freq()[0] / 1000000.0
+            else:
+               res['mc_frequency_mhz'] = mc.freq() / 1000000.0
+        except NotImplementedError:
+            res['mc_frequency_mhz'] = None
         res['mc_id'] = mc.unique_id()
     except ImportError:
         try:
@@ -1470,8 +1473,9 @@
             res['mc_temp_c'] = mc.cpu.temperature
             res['mc_id'] = mc.cpu.uid
         except ImportError:
-            res['mc_frequency'] = None
-            res['mc_temp'] = None
+            res['mc_frequency_mhz'] = None
+            res['mc_temp_c'] = None
+            res['mc_id'] = ''
     if 'mc_id' in res:
         res['mc_id'] = ':'.join('{0:02X}'.format(x) for x in res['mc_id'])
 

eric ide

mercurial