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
4a1775c2
Commit
4a1775c2
authored
Jun 05, 2016
by
dnc40085
Committed by
Marcel Stör
Jun 05, 2016
Browse files
Fixed bug where default hostname is not set on boot when in SoftAP mode (#1341)
parent
9cedfd47
Changes
2
Show whitespace changes
Inline
Side-by-side
app/modules/wifi.c
View file @
4a1775c2
...
@@ -1311,6 +1311,8 @@ static const LUA_REG_TYPE wifi_map[] = {
...
@@ -1311,6 +1311,8 @@ static const LUA_REG_TYPE wifi_map[] = {
void
wifi_change_default_host_name
(
void
)
void
wifi_change_default_host_name
(
void
)
{
{
uint8
opmode_temp
=
wifi_get_opmode
();
wifi_set_opmode_current
(
STATION_MODE
);
#ifndef WIFI_STA_HOSTNAME
#ifndef WIFI_STA_HOSTNAME
char
temp
[
32
];
char
temp
[
32
];
uint8_t
mac
[
6
];
uint8_t
mac
[
6
];
...
@@ -1318,7 +1320,7 @@ void wifi_change_default_host_name(void)
...
@@ -1318,7 +1320,7 @@ void wifi_change_default_host_name(void)
c_sprintf
(
temp
,
"NODE-%X%X%X"
,
(
mac
)[
3
],
(
mac
)[
4
],
(
mac
)[
5
]);
c_sprintf
(
temp
,
"NODE-%X%X%X"
,
(
mac
)[
3
],
(
mac
)[
4
],
(
mac
)[
5
]);
wifi_sta_sethostname
((
const
char
*
)
temp
,
strlen
(
temp
));
wifi_sta_sethostname
((
const
char
*
)
temp
,
strlen
(
temp
));
#elif defined(WIFI_STA_HOSTNAME) && !defined(WIFI_STA_HOSTNAME_APPEND_MAC)
#elif defined(WIFI_STA_HOSTNAME) && !defined(WIFI_STA_HOSTNAME_APPEND_MAC)
if
(
!
wifi_sta_sethostname
(
WIFI_STA_HOSTNAME
,
strlen
(
WIFI_STA_HOSTNAME
)))
if
(
!
wifi_sta_sethostname
(
WIFI_STA_HOSTNAME
,
strlen
(
WIFI_STA_HOSTNAME
)))
{
{
char
temp
[
32
];
char
temp
[
32
];
...
@@ -1339,7 +1341,10 @@ void wifi_change_default_host_name(void)
...
@@ -1339,7 +1341,10 @@ void wifi_change_default_host_name(void)
wifi_sta_sethostname
((
const
char
*
)
temp
,
strlen
(
temp
));
wifi_sta_sethostname
((
const
char
*
)
temp
,
strlen
(
temp
));
}
}
#endif
#endif
if
(
opmode_temp
!=
wifi_get_opmode
())
{
wifi_set_opmode_current
(
opmode_temp
);
}
}
}
int
luaopen_wifi
(
lua_State
*
L
)
int
luaopen_wifi
(
lua_State
*
L
)
...
...
app/user/user_main.c
View file @
4a1775c2
...
@@ -122,7 +122,7 @@ void nodemcu_init(void)
...
@@ -122,7 +122,7 @@ void nodemcu_init(void)
void
user_rf_pre_init
(
void
)
void
user_rf_pre_init
(
void
)
{
{
//set WiFi hostname before RF initialization (adds ~4
40
us to boot time)
//set WiFi hostname before RF initialization (adds ~4
79
us to boot time)
wifi_change_default_host_name
();
wifi_change_default_host_name
();
}
}
#endif
#endif
...
...
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