From 1a121048a1b766f52bd783311da670e00b6fcfcb Mon Sep 17 00:00:00 2001 From: dahanzimin <353767514@qq.com> Date: Mon, 19 Jan 2026 15:31:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0C5=E7=9A=84wifi=E9=85=8D?= =?UTF-8?q?=E7=BD=91=E9=94=99=E8=AF=AF=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../default_src/micropython/origin/build/lib/mixiot.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/boards/default_src/micropython/origin/build/lib/mixiot.py b/boards/default_src/micropython/origin/build/lib/mixiot.py index 15f5c1f1..6cbf09c6 100644 --- a/boards/default_src/micropython/origin/build/lib/mixiot.py +++ b/boards/default_src/micropython/origin/build/lib/mixiot.py @@ -11,8 +11,10 @@ WILL_TOPIC = '9d634e1a156dc0c1611eb4c3cff57276' def wlan_connect(ssid='MYSSID', password='MYPASS', timeout=10): import network wlan = network.WLAN(network.STA_IF) - if not wlan.active() or not wlan.isconnected(): + if not wlan.active(): wlan.active(True) + time.sleep(0.5) + if not wlan.isconnected(): print('connecting to:', ssid, end ="") try: wlan.connect(ssid, password) @@ -26,7 +28,11 @@ def wlan_connect(ssid='MYSSID', password='MYPASS', timeout=10): if _num > timeout: wlan.active(False) print('') - raise RuntimeError("WiFi connection timeout, Please check only 2.4G supported name and password") + import os + if 'c5' in os.uname().machine.lower(): + raise RuntimeError("WiFi connection timeout. Please check the SSID and password") + else: + raise RuntimeError("WiFi connection timeout, Please check the SSID and password (only 2.4GHz networks are supported)") print('\nnetwork config:', wlan.ifconfig()) return wlan