From 059a5eebdd30fc9c53109c0701340a5c9464f584 Mon Sep 17 00:00:00 2001 From: HuangRui Date: Thu, 12 Feb 2015 22:43:48 +0800 Subject: [PATCH] wifi.ap.setip() can set ip address now, fixed #199. --- app/modules/wifi.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/modules/wifi.c b/app/modules/wifi.c index 4acdd304..635625c6 100644 --- a/app/modules/wifi.c +++ b/app/modules/wifi.c @@ -256,8 +256,19 @@ static int wifi_setip( lua_State* L, uint8_t mode ) ip = parse_key(L, "gateway"); if(ip!=0) 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; }