Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
724d3be1
Commit
724d3be1
authored
Jan 12, 2015
by
funshine
Browse files
combine getnetmask and getip
parent
94b64307
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/Makefile
View file @
724d3be1
...
...
@@ -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
:
app/modules/wifi.c
View file @
724d3be1
...
...
@@ -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
)
},
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment