重现步骤
连接WIFI正常,连接网口失败
期待结果和实际结果
在K230开发版,插入一个USB转网口的转换器,通过网线与交换机连接,尝试连接网络失败
软硬件版本信息
01科技K230 windows 烧镜像 mispython环境 IDE 4.0.7
错误日志
Traceback (most recent call last):
File "", line 636, in
File "", line 215, in network_use_wlan
RuntimeError: LAN interface is not active.
MPY: soft reboot
CanMV v1.2.2(based on Micropython e00a144) on 2024-12-18; k230_canmv_01studio with K230
尝试解决过程
交换机有四个口
尝试指定LAN口 a=network.LAN(0) a=network.LAN(1) a=network.LAN(2)
补充材料
def network_use_wlan(is_wlan=False):
if is_wlan:
sta=network.WLAN(0)
sta.connect("qingyun","qingyunrobot")
print(sta.status())
while sta.ifconfig()[0] == '0.0.0.0':
os.exitpoint()
print(sta.ifconfig())
ip = sta.ifconfig()[0]
return ip
else:
a=network.LAN()
if not a.active():
raise RuntimeError("LAN interface is not active.")
a.ifconfig("dhcp")
print(a.ifconfig())
ip = a.ifconfig()[0]
return ip