sta_if.isconnected() unexpectedly returns false
Posted: Sun Aug 11, 2019 3:17 am
MicroPython v1.11-223-g71ba86b4c
In my main processing loop seen below, I check between every loop iteration to verify there is a valid Wi-Fi connection:
I'm about 15 feet away from a Ubiquiti UAP-AC-PRO access point and I have a very good connection. I do get faint signals from some of my neighbor's Wi-Fi networks, but the 2.4GHz band in my area isn't very saturated, not like you would see at an apartment complex or anything like that. Still, calls to sta_if.isconnected() are returning false for some reason and my program keeps reconnecting to my Wi-Fi network. Roughly 10 times in the last 24 hours. Any ideas on what might be causing this? Also, what does "ets_task" stand for and what is the other information on those "ets_task" lines?
I am connected to the ESP from my PC directly via USB and I'm also powering the ESP via a reliable desktop power supply just to be sure there isn't a USB power issue.
In my main processing loop seen below, I check between every loop iteration to verify there is a valid Wi-Fi connection:
Code: Select all
async def main_loop():
sta_if = network.WLAN(network.STA_IF)
sock = None
poller = None
while True:
try:
# This continuously try to create a Wi-Fi connection
while not sta_if.isconnected():
# connect to wifi
# This loop continuously tries to initialize the socket and poller
while sta_if.isconnected() and (sock is None or poller is None):
# initialize sock
# initialize poller
# This continuously polls the socket
while sta_if.isconnected() and sock and poller:
await uasyncio.sleep(0)
events = poller.poll(10)
for s, flags in events:
# process event
except Exception as e:
# handle error
Code: Select all
#7 ets_task(4020f4d0, 28, 3fff9038, 10)
connecting to the manseekingknowledge_test Wi-Fi network
running for 4658 seconds: connected to the manseekingknowledge_test Wi-Fi network
#8 ets_task(4020f4d0, 28, 3fff9038, 10)
connecting to the manseekingknowledge_test Wi-Fi network
running for 6605 seconds: connected to the manseekingknowledge_test Wi-Fi network
#9 ets_task(4020f4d0, 28, 3fff9038, 10)
connecting to the manseekingknowledge_test Wi-Fi network
running for 6910 seconds: connected to the manseekingknowledge_test Wi-Fi network
#10 ets_task(4020f4d0, 28, 3fff9038, 10)
connecting to the manseekingknowledge_test Wi-Fi network
running for 7806 seconds: connected to the manseekingknowledge_test Wi-Fi network
#11 ets_task(4020f4d0, 28, 3fff9038, 10)
connecting to the manseekingknowledge_test Wi-Fi network
running for 21411 seconds: connected to the manseekingknowledge_test Wi-Fi network
#12 ets_task(4020f4d0, 28, 3fff9038, 10)
connecting to the manseekingknowledge_test Wi-Fi network
running for 35288 seconds: connected to the manseekingknowledge_test Wi-Fi network
#13 ets_task(4020f4d0, 28, 3fff9038, 10)
connecting to the manseekingknowledge_test Wi-Fi network
running for 36769 seconds: connected to the manseekingknowledge_test Wi-Fi network
#14 ets_task(4020f4d0, 28, 3fff9038, 10)
connecting to the manseekingknowledge_test Wi-Fi network
running for 39043 seconds: connected to the manseekingknowledge_test Wi-Fi network
#15 ets_task(4020f4d0, 28, 3fff9038, 10)
connecting to the manseekingknowledge_test Wi-Fi network
running for 52228 seconds: connected to the manseekingknowledge_test Wi-Fi network
#16 ets_task(4020f4d0, 28, 3fff9038, 10)
connecting to the manseekingknowledge_test Wi-Fi network
running for 55125 seconds: connected to the manseekingknowledge_test Wi-Fi network