src/eric7/MicroPython/Devices/RP2Devices.py

branch
eric7
changeset 11051
e8a7be10b76c
parent 11034
7b8a21fd2d58
child 11090
f5f5f5803935
--- a/src/eric7/MicroPython/Devices/RP2Devices.py	Tue Nov 12 19:26:31 2024 +0100
+++ b/src/eric7/MicroPython/Devices/RP2Devices.py	Tue Nov 19 16:08:15 2024 +0100
@@ -451,6 +451,10 @@
     try:
         import network
         if hasattr(network, 'WLAN'):
+            wifi = network.WLAN(network.STA_IF)
+            if not wifi.active():
+                wifi.active(True)
+                wifi.active(False)
             return True, 'picow'
     except ImportError:
         try:
@@ -476,6 +480,10 @@
             else:
                 # pimoroni firmware loaded but no pico wireless present
                 return False, ""
+        if b"Failed to start CYW43" in out:
+            # network module present but no CYW43 chip
+            # (pimoroni firmware has everything)
+            return False, ""
         return ast.literal_eval(out.decode("utf-8"))
 
     def hasWifiCountry(self):
@@ -1467,8 +1475,12 @@
     try:
         import bluetooth
         if hasattr(bluetooth, 'BLE'):
+            ble = bluetooth.BLE()
+            if not ble.active():
+                ble.active(True)
+                ble.active(False)
             return True
-    except ImportError:
+    except (ImportError, OSError):
         pass
 
     return False

eric ide

mercurial