As the title says... Chat on...

User avatar
By Eyal
#63940 I set a static IP, so there is no need to access the gateway. Furthermore I only send (from the esp) UDP packets which are allowed to be lost.

Nevertheless, if I disconnect the a/p from the server (my gw) then after a few minutes I only get to status 3. When I reconnect the server the status soon progresses to 5 (STA_GOTIP).

I expected that once I associate with the a/p I instantly progress to STA_GOTIP status.

Why is this important? My app reads a sensor and sends a packet in under 500ms (usually). As it is now, when the server is down, a long timeout is incurred (about 5 seconds) which drains the battery 10 times faster.

The timeout is required to deal with intermittent a/p connection failures, but is unacceptable as a regular event.

I could run something like this
Code: Select allwifi.sta.disconnect()
wifi.sta.setip({ip="192.168.2.30",netmask="255.255.255.0",gateway="192.168.2.7"})
wifi.sta.config("SSID", "PASS", 1)
wifi.setmode(wifi.STATION)
wifi.sta.autoconnect(1)


and I can then check that everything is set:
Code: Select allprint(wifi.sta.status(), wifi.sta.getip())
=wifi.sta.getconfig()


The status shows 3 when the gateway is disconnected.

TIA