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