ESP32 Wi-Fi ON/OFF Issue

surajnagulamalyala
Posts: 24
Joined: Tue Jul 27, 2021 2:18 pm

ESP32 Wi-Fi ON/OFF Issue

Postby surajnagulamalyala » Tue Apr 26, 2022 6:18 am

Hi Team,

Greetings of the day !

Presently am working on ESP32 module, am using Wi-Fi interface in my application, my application should run in low power mode to consume less current so for that purpose am keeping my Wi-Fi in modem sleep mode and am using Wi-Fi interface mainly to connect to HTTP (webpage) from mobile through Static IP generated from my application code, where the problem comes is ...

a) When am turning of Wi-Fi connection in mobile directly, my application control hangs (Code structs at some point), observed LED indication suddenly stops when I turn off my mobile Wi-Fi directly, I Simulated this condition for many times observed the same issue
what could be the problem and how to overcome this issue ?
b) Is there any Solution/function to handle in software ? suggest me good idea to come out of these issue ?
c) Is this function useful ?
esp_err_tesp_wifi_set_inactive_time(wifi_interface_tifx, uint16_t sec).
d) How can I call this function from Arduino IDE ?

username
Posts: 536
Joined: Thu May 03, 2018 1:18 pm

Re: ESP32 Wi-Fi ON/OFF Issue

Postby username » Wed Apr 27, 2022 2:25 am

The problem is that the connection was not closed first.
The way I got around that issue was every 30 seconds I send a "Heart Beat" character to the web page, when it gets this character it simply sends back a reply. If (on the esp32) side I do not get a reply I close the connection. Likewise on the webpage side, if I do not get the "heartbeat" after 30 seconds I throw up a popup stating we lost connection to the ESP32.

Who is online

Users browsing this forum: Google [Bot], pepgra and 144 guests