WiFi: ARP gratuitous API for wifi station mode by d-a-v · Pull Request #6889 · esp8266/Arduino (original) (raw)

Just looking at the code and I think this is probably not optimal to use.

bool ESP8266WiFiSTAClass::stationKeepAliveEnabled () { return _keepStationAliveUs != 0; }

void ESP8266WiFiSTAClass::stationKeepAliveStop () { _keepStationAliveUs = -1; // will be set to 0 at recurrent call }

bool ESP8266WiFiSTAClass::stationKeepAliveSetupMs (int ms) { if (_keepStationAliveUs != 0 || ms <= 0) return false; [...]

So on other words, you can only change the value by calling stop and then wait for the next scheduled interval before you can even set a new value.
Worst case scenario is to wait for as long as the previous set interval.
It would make sense to set the interval to anything > 0 and if you want to stop it, call the stop function.
Now you just have to poll as long as you receive false to set a new interval.

Also I do miss to send (or restart the scheduler) when a wifi connection to the AP is established.
That's the most important one to send these ARP packets. If it was set to for example 10 seconds and you make a connection right after the scheduler tried sending these ARP packets, you may be unable to make a connection to another host, for about 10 seconds after successful wifi connection was established.