Merge pull request #209 from nodemcu/dev

wifi.ap.setip() can set ip address now, fixed #199.
This commit is contained in:
Vowstar 2015-02-12 23:29:10 +08:00
commit 3b80bc443d
1 changed files with 13 additions and 2 deletions

View File

@ -256,8 +256,19 @@ static int wifi_setip( lua_State* L, uint8_t mode )
ip = parse_key(L, "gateway"); ip = parse_key(L, "gateway");
if(ip!=0) if(ip!=0)
pTempIp.gw.addr = ip; pTempIp.gw.addr = ip;
wifi_station_dhcpc_stop();
lua_pushboolean(L,wifi_set_ip_info(mode, &pTempIp)); if(STATION_IF == mode)
{
wifi_station_dhcpc_stop();
lua_pushboolean(L,wifi_set_ip_info(mode, &pTempIp));
}
else
{
wifi_softap_dhcps_stop();
lua_pushboolean(L,wifi_set_ip_info(mode, &pTempIp));
wifi_softap_dhcps_start();
}
return 1; return 1;
} }