Skip to content

stop lwIP dhcp client when WiFi goes off. #5703

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 1, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions libraries/ESP8266WiFi/src/ESP8266WiFiGeneric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,11 @@ bool ESP8266WiFiGenericClass::mode(WiFiMode_t m) {

bool ret = false;

if (m == WIFI_OFF)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of testing for OFF, should this be testing for !STA && !STA_AP?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!STA && !STA_AP == OFF || AP, so yes it is better.

// calls lwIP's dhcp_stop(),
// safe to call even if not started
wifi_station_dhcpc_stop();

ETS_UART_INTR_DISABLE();
if(_persistent) {
ret = wifi_set_opmode(m);
Expand Down