8000 ESP8266WiFiClass constructor needs to set variables · Issue #754 · esp8266/Arduino · GitHub
[go: up one dir, main page]

Skip to content
ESP8266WiFiClass constructor needs to set variables #754
Closed
@JohnSL

Description

@JohnSL

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0