I'm using a sketch like this:
WiFi.config(IP, Gate, Subnet);
WiFi.begin (ssid, pass);
//-- somewhere below I want to drop the static IP configuration and obtain IP with DHCP.
WiFi.disconnect ();
WiFi.begin (ssid, pass). //ssid and pass are the same as above.
But IP is not changing. It seems that WiFi hasn't been reconnected. How to drop static IP configuration without restart? I'm using nodemcu v3 with esp8266 -12e.