Skip to content

ESP8266WiFiClass constructor needs to set variables #754

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

Closed
JohnSL opened this issue Sep 7, 2015 · 0 comments
Closed

ESP8266WiFiClass constructor needs to set variables #754

JohnSL opened this issue Sep 7, 2015 · 0 comments
Milestone

Comments

@JohnSL
Copy link
Contributor

JohnSL commented Sep 7, 2015

I believe there is a bug in ESP8266WiFi.cpp when using auto reconnect. Namely, the _useClientMode and _useApMode variables need to be set in the constructor, using something like this (I add the first three lines--the fourth line was already there):

ESP8266WiFiClass::ESP8266WiFiClass()
: _smartConfigStarted(false)
, _smartConfigDone(false)
, _useApMode(false)
, _useClientMode(false)
, _useStaticIp(false)
{
    uint8 m = wifi_get_opmode();
    _useClientMode = (m & WIFI_STA);
    _useApMode = (m & WIFI_AP_STA);
    wifi_set_event_handler_cb((wifi_event_handler_cb_t)&ESP8266WiFiClass::_eventCallback);
}

Without this change, calling methods like softAP or scanNetworks will change the mode (I've been using WIFI_AP_STA). I've provided more details here (before I thought to create an issue):

http://www.esp8266.com/viewtopic.php?f=28&t=4899#p27971

igrr added a commit that referenced this issue Sep 8, 2015
fix _useClientMode & _useApMode in SDK auto connect mode (#754)
igrr added a commit that referenced this issue Oct 29, 2015
fix _useClientMode & _useApMode in SDK auto connect mode (#754)
@igrr igrr modified the milestone: 2.0.0 Nov 5, 2015
@igrr igrr closed this as completed Nov 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants