0

ESP32 TIMEOUT?
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

ESP32 TIMEOUT?

by IntenseDejaVu on Mon Jan 28, 2019 3:09 pm

Hi guys
Recentlly i've been playing around with esp32 ( Huzzah 32), making a webserver for local ON/OFF switches
Everything is working fine, however after some time, the device becames inacessible, looks like it looses connection to the wifi.

If I run everything, esp32 starts a html server, ifim switching anything for 10 minutes, works like a charm. However if i don't make any change during 5 minutes or more, next time i try to acess it via Web, it simply doesn't answers to it.

I maybe guessing that is something related to time out? maybe? No activity so it loses connection to my AP? ( esp32 is a client of my Wifi at home) My loop just stucks on the modsocket so i can't do a constant "Ping" to the wifi so it registers any activity... Has anybody experiencied this? workarounds?

Thanks
André

IntenseDejaVu
 
Posts: 2
Joined: Thu Jan 24, 2019 12:37 pm

Re: ESP32 TIMEOUT?

by adafruit_support_mike on Tue Jan 29, 2019 12:36 am

Make sure you have code to check the connection status, and to reconnect if necessary.

Wireless connections are far more susceptible to noise and interference than wired connections. The question isn't "will the connection drop?", it's "when will the connection drop?"

Generally speaking, it's a good idea to have the code check the network connection at regular intervals to increase the chance that the link will be good when you need it. The exact amount of time between checks depends on your project, how much power you want to use, etc.

It's an even better idea to check the network connection before calling any function that will only work if the connection is good. I can't say it's mandatory because code without such checking will compile and run, but it's pretty much guaranteed to hang sooner or later.

adafruit_support_mike
 
Posts: 58483
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.