Initial WiFi auto reconnect implementation

This needs proper testing!
Fixes: https://github.com/espressif/arduino-esp32/issues/353
This commit is contained in:
me-no-dev 2017-05-22 16:29:41 +03:00
parent 7db8f70956
commit b6e83fac62
2 changed files with 14 additions and 0 deletions

View File

@ -84,6 +84,7 @@ static bool sta_config_equal(const wifi_config_t& lhs, const wifi_config_t& rhs)
// ---------------------------------------------------- STA function ----------------------------------------------------- // ---------------------------------------------------- STA function -----------------------------------------------------
// ----------------------------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------------------------
bool WiFiSTAClass::_autoReconnect = true;
bool WiFiSTAClass::_useStaticIp = false; bool WiFiSTAClass::_useStaticIp = false;
wl_status_t WiFiSTAClass::_status = WL_NO_SHIELD; wl_status_t WiFiSTAClass::_status = WL_NO_SHIELD;
/** /**
@ -302,6 +303,17 @@ bool WiFiSTAClass::getAutoConnect()
return autoConnect; return autoConnect;
} }
bool WiFiSTAClass::setAutoReconnect(bool autoReconnect)
{
_autoReconnect = autoReconnect;
return true;
}
bool WiFiSTAClass::getAutoReconnect()
{
return _autoReconnect;
}
/** /**
* Wait for WiFi connection to reach a result * Wait for WiFi connection to reach a result
* returns the status reached or disconnect if STA is off * returns the status reached or disconnect if STA is off

View File

@ -51,6 +51,7 @@ public:
bool getAutoConnect(); bool getAutoConnect();
bool setAutoReconnect(bool autoReconnect); bool setAutoReconnect(bool autoReconnect);
bool getAutoReconnect();
uint8_t waitForConnectResult(); uint8_t waitForConnectResult();
@ -84,6 +85,7 @@ public:
protected: protected:
static wl_status_t _status; static wl_status_t _status;
static bool _useStaticIp; static bool _useStaticIp;
static bool _autoReconnect;
public: public:
bool beginSmartConfig(); bool beginSmartConfig();