更新C5的wifi配网错误提示
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user