OSError: no available NIC after Soft-Reset
-
Hello,
i have a problem, hopefully you can help me.
After a soft-reset (CTRL-D in REPL), i get the error that there is no available NIC when using the urequest.post command. After a hard-reset everything is working fine.
Propably the re-initialization of the wifi interface is not done right?import machine import os from network import WLAN import time import pycom import urequests pycom.heartbeat(False) uart = machine.UART(0, baudrate=115200) os.dupterm(uart) wlan = WLAN() if machine.reset_cause() != machine.SOFT_RESET: print('Init Wlan',end='') wlan.mode(WLAN.STA) print(' done') if wlan.isconnected(): print('Already connected to WiFi network.') print(wlan.ssid()) else: nets = wlan.scan() net_to_use=[] pw=[] for net in nets: if net.ssid =='Malle16': net_to_use=net pw='123456' if net_to_use==[]: for net in nets: if net.ssid =='FRITZ!WLAN Repeater N/G': net_to_use=net pw='123456' if net_to_use==[]: for net in nets: if net.ssid =='Outdoor': net_to_use=net pw='456' wlan.connect(net_to_use.ssid, auth=(net_to_use.sec, pw), timeout=10000) while not wlan.isconnected(): time.sleep_ms(500) print('.', end='') print(' connected.') print("IP address: " + wlan.ifconfig()[0]) print('-----------------------------') print('boot.py finished') machine.main('main.py')
payload="status,volk={0} wert={1:0.2f} {2}".format(Volk_Nummer,Status,t) response = urequests.post(db, data=payload) print('---- Influxdb Update OK ----') time.sleep(20