Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Nodemcu Firmware
Commits
6218b926
Unverified
Commit
6218b926
authored
Mar 23, 2018
by
Arnim Läuger
Committed by
GitHub
Mar 23, 2018
Browse files
initialize new memebers in station_config and scan_config (#2309)
Initialize new members in station_config and scan_config
parent
f8311855
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/modules/enduser_setup.c
View file @
6218b926
...
...
@@ -664,6 +664,8 @@ static int enduser_setup_http_handle_credentials(char *data, unsigned short data
struct
station_config
*
cnf
=
luaM_malloc
(
lua_getstate
(),
sizeof
(
struct
station_config
));
c_memset
(
cnf
,
0
,
sizeof
(
struct
station_config
));
cnf
->
threshold
.
rssi
=
-
127
;
cnf
->
threshold
.
authmode
=
AUTH_OPEN
;
int
err
;
err
=
enduser_setup_http_urldecode
(
cnf
->
ssid
,
name_str_start
,
name_str_len
,
sizeof
(
cnf
->
ssid
));
...
...
app/modules/wifi.c
View file @
6218b926
...
...
@@ -722,10 +722,7 @@ static int wifi_station_clear_config ( lua_State* L )
bool
auto_connect
=
true
;
bool
save_to_flash
=
true
;
memset
(
sta_conf
.
ssid
,
0
,
sizeof
(
sta_conf
.
ssid
));
memset
(
sta_conf
.
password
,
0
,
sizeof
(
sta_conf
.
password
));
memset
(
sta_conf
.
bssid
,
0
,
sizeof
(
sta_conf
.
bssid
));
sta_conf
.
bssid_set
=
0
;
memset
(
&
sta_conf
,
0
,
sizeof
(
sta_conf
));
wifi_station_disconnect
();
...
...
@@ -753,10 +750,9 @@ static int wifi_station_config( lua_State* L )
bool
save_to_flash
=
true
;
size_t
sl
,
pl
,
ml
;
memset
(
sta_conf
.
ssid
,
0
,
sizeof
(
sta_conf
.
ssid
));
memset
(
sta_conf
.
password
,
0
,
sizeof
(
sta_conf
.
password
));
memset
(
sta_conf
.
bssid
,
0
,
sizeof
(
sta_conf
.
bssid
));
sta_conf
.
bssid_set
=
0
;
memset
(
&
sta_conf
,
0
,
sizeof
(
sta_conf
));
sta_conf
.
threshold
.
rssi
=
-
127
;
sta_conf
.
threshold
.
authmode
=
AUTH_OPEN
;
if
(
lua_istable
(
L
,
1
))
{
...
...
@@ -1032,6 +1028,8 @@ static int wifi_station_listap( lua_State* L )
return
luaL_error
(
L
,
"Can't list ap in SOFTAP mode"
);
}
struct
scan_config
scan_cfg
;
memset
(
&
scan_cfg
,
0
,
sizeof
(
scan_cfg
));
getap_output_format
=
0
;
if
(
lua_type
(
L
,
1
)
==
LUA_TTABLE
)
...
...
@@ -1061,10 +1059,6 @@ static int wifi_station_listap( lua_State* L )
return
luaL_error
(
L
,
"wrong arg type"
);
}
}
else
{
scan_cfg
.
ssid
=
NULL
;
}
lua_getfield
(
L
,
1
,
"bssid"
);
if
(
!
lua_isnil
(
L
,
-
1
))
/* found? */
...
...
@@ -1085,10 +1079,6 @@ static int wifi_station_listap( lua_State* L )
return
luaL_error
(
L
,
"wrong arg type"
);
}
}
else
{
scan_cfg
.
bssid
=
NULL
;
}
lua_getfield
(
L
,
1
,
"channel"
);
...
...
@@ -1107,10 +1097,6 @@ static int wifi_station_listap( lua_State* L )
return
luaL_error
(
L
,
"wrong arg type"
);
}
}
else
{
scan_cfg
.
channel
=
0
;
}
lua_getfield
(
L
,
1
,
"show_hidden"
);
if
(
!
lua_isnil
(
L
,
-
1
))
/* found? */
...
...
@@ -1129,10 +1115,6 @@ static int wifi_station_listap( lua_State* L )
return
luaL_error
(
L
,
"wrong arg type"
);
}
}
else
{
scan_cfg
.
show_hidden
=
0
;
}
if
(
lua_type
(
L
,
2
)
==
LUA_TFUNCTION
||
lua_type
(
L
,
2
)
==
LUA_TLIGHTFUNCTION
)
{
...
...
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