diff --git a/app/Makefile b/app/Makefile index ad9a71c2..e221d9f3 100644 --- a/app/Makefile +++ b/app/Makefile @@ -168,7 +168,7 @@ $(BINODIR)/%.bin: $(IMAGEODIR)/%.out ../tools/esptool.py elf2image $< -o $(FIRMWAREDIR) flash: - ../tools/esptool.py -p $(PORT) write_flash 0x00000 ../bin/0x00000.bin 0x10000 ../bin/0x10000.bin + ../tools/esptool.py -p $(PORT) write_flash 0x00000 $(FIRMWAREDIR)0x00000.bin 0x10000 $(FIRMWAREDIR)0x10000.bin .PHONY: FORCE FORCE: diff --git a/app/modules/wifi.c b/app/modules/wifi.c index 16df2fa0..e1bf6ea4 100644 --- a/app/modules/wifi.c +++ b/app/modules/wifi.c @@ -182,12 +182,11 @@ static int wifi_getip( lua_State* L, uint8_t mode ) } else { c_sprintf(temp, "%d.%d.%d.%d", IP2STR(&pTempIp.ip) ); lua_pushstring( L, temp ); - // c_sprintf(temp, "%d.%d.%d.%d", IP2STR(&pTempIp.netmask) ); - // lua_pushstring( L, temp ); - // c_sprintf(temp, "%d.%d.%d.%d", IP2STR(&pTempIp.gw) ); - // lua_pushstring( L, temp ); - // return 3; - return 1; + c_sprintf(temp, "%d.%d.%d.%d", IP2STR(&pTempIp.netmask) ); + lua_pushstring( L, temp ); + c_sprintf(temp, "%d.%d.%d.%d", IP2STR(&pTempIp.gw) ); + lua_pushstring( L, temp ); + return 3; } } @@ -216,24 +215,6 @@ static int wifi_getbroadcast( lua_State* L, uint8_t mode ) } -// Lua: netmask = wifi.xx.getnetmask() -static int wifi_getnetmask( lua_State* L, uint8_t mode ) -{ - struct ip_info pTempIp; - char temp[64]; - wifi_get_ip_info(mode, &pTempIp); - if(pTempIp.ip.addr==0){ - lua_pushnil(L); - return 1; - } else { - c_sprintf(temp, "%d.%d.%d.%d", IP2STR(&pTempIp.netmask) ); - lua_pushstring( L, temp ); - return 1; - } -} - - - static uint32_t parse_key(lua_State* L, const char * key){ lua_getfield(L, 1, key); if( lua_isstring(L, -1) ) // deal with the ip/netmask/gw string @@ -309,17 +290,11 @@ static int wifi_station_setip( lua_State* L ){ return wifi_setip(L, STATION_IF); } -// Lua: wifi.sta.getnetmask() -static int wifi_station_getnetmask( lua_State* L ){ - return wifi_getnetmask(L, STATION_IF); -} - // Lua: wifi.sta.getbroadcast() static int wifi_station_getbroadcast( lua_State* L ){ return wifi_getbroadcast(L, STATION_IF); } - // Lua: wifi.sta.config(ssid, password) static int wifi_station_config( lua_State* L ) { @@ -432,11 +407,6 @@ static int wifi_ap_setip( lua_State* L ){ return wifi_setip(L, SOFTAP_IF); } -// Lua: wifi.ap.getnetmask() -static int wifi_ap_getnetmask( lua_State* L ){ - return wifi_getnetmask(L, SOFTAP_IF); -} - // Lua: wifi.ap.getbroadcast() static int wifi_ap_getbroadcast( lua_State* L ){ return wifi_getbroadcast(L, SOFTAP_IF); @@ -509,7 +479,6 @@ static const LUA_REG_TYPE wifi_station_map[] = { LSTRKEY( "autoconnect" ), LFUNCVAL ( wifi_station_setauto ) }, { LSTRKEY( "getip" ), LFUNCVAL ( wifi_station_getip ) }, { LSTRKEY( "setip" ), LFUNCVAL ( wifi_station_setip ) }, - { LSTRKEY( "getnetmask" ), LFUNCVAL ( wifi_station_getnetmask ) }, { LSTRKEY( "getbroadcast" ), LFUNCVAL ( wifi_station_getbroadcast) }, { LSTRKEY( "getmac" ), LFUNCVAL ( wifi_station_getmac ) }, { LSTRKEY( "setmac" ), LFUNCVAL ( wifi_station_setmac ) }, @@ -523,7 +492,6 @@ static const LUA_REG_TYPE wifi_ap_map[] = { LSTRKEY( "config" ), LFUNCVAL( wifi_ap_config ) }, { LSTRKEY( "getip" ), LFUNCVAL ( wifi_ap_getip ) }, { LSTRKEY( "setip" ), LFUNCVAL ( wifi_ap_setip ) }, - { LSTRKEY( "getnetmask" ), LFUNCVAL ( wifi_ap_getnetmask ) }, { LSTRKEY( "getbroadcast" ), LFUNCVAL ( wifi_ap_getbroadcast) }, { LSTRKEY( "getmac" ), LFUNCVAL ( wifi_ap_getmac ) }, { LSTRKEY( "setmac" ), LFUNCVAL ( wifi_ap_setmac ) },