Skip to content

Commit

Permalink
Calling wifi.off in connect now before connecting to new network.
Browse files Browse the repository at this point in the history
Attempting to fix this - #1
  • Loading branch information
arihantdaga authored Jun 4, 2020
1 parent ff72137 commit ef4f222
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/JustWifi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,13 @@ justwifi_states_t JustWifi::_connect(uint8_t id) {
// No state or previous network failed
if (state == STATE_NOT_CONNECTED) {
// Due to this wierd issue https://github.com/kiot-innovations/justwifi/issues/1 , temporay we have to disable this, it can also lead to bad issues like bricking of the device sometimes.
// WiFi.persistent(false);

// See https://github.com/esp8266/Arduino/issues/2186
if (strncmp_P(ESP.getSdkVersion(), PSTR("1.5.3"), 5) == 0) {
WiFi.mode(WIFI_OFF);
}

WiFi.mode(WIFI_STA);
WiFi.persistent(false);
// See the issue https://github.com/kiot-innovations/justwifi/issues/1
WiFi.mode(WIFI_OFF);
delay(200);

WiFi.enableSTA(true);
WiFi.hostname(_hostname);

// Configure static options
if (!entry.dhcp) {
Expand Down

0 comments on commit ef4f222

Please sign in to comment.