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
a63da92e
Commit
a63da92e
authored
Apr 04, 2018
by
devsaurus
Browse files
set auto_connect before station configuration
idf 3.1 connects automatically upon esp_wifi_sta_config()
parent
8d843e5b
Changes
1
Hide whitespace changes
Inline
Side-by-side
components/modules/wifi_sta.c
View file @
a63da92e
...
@@ -214,18 +214,18 @@ static int wifi_sta_config (lua_State *L)
...
@@ -214,18 +214,18 @@ static int wifi_sta_config (lua_State *L)
bool
auto_conn
=
luaL_optbool
(
L
,
-
1
,
true
);
bool
auto_conn
=
luaL_optbool
(
L
,
-
1
,
true
);
SET_SAVE_MODE
(
save
);
SET_SAVE_MODE
(
save
);
esp_err_t
err
=
esp_wifi_set_config
(
WIFI_IF_STA
,
&
cfg
);
esp_err_t
err
=
esp_wifi_set_auto_connect
(
auto_conn
);
if
(
err
!=
ESP_OK
)
return
luaL_error
(
L
,
"failed to set wifi auto-connect, code %d"
,
err
);
err
=
esp_wifi_set_config
(
WIFI_IF_STA
,
&
cfg
);
if
(
err
!=
ESP_OK
)
if
(
err
!=
ESP_OK
)
return
luaL_error
(
L
,
"failed to set wifi config, code %d"
,
err
);
return
luaL_error
(
L
,
"failed to set wifi config, code %d"
,
err
);
if
(
auto_conn
)
if
(
auto_conn
)
err
=
esp_wifi_connect
();
err
=
esp_wifi_connect
();
if
(
err
!=
ESP_OK
)
return
luaL_error
(
L
,
"failed to begin connect, code %d"
,
err
);
err
=
esp_wifi_set_auto_connect
(
auto_conn
);
return
(
err
==
ESP_OK
)
?
return
(
err
==
ESP_OK
)
?
0
:
luaL_error
(
L
,
"failed to
set wifi auto-
connect, code %d"
,
err
);
0
:
luaL_error
(
L
,
"failed to
begin
connect, code %d"
,
err
);
}
}
...
...
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