From 95a45ce259617faaaa09ea792ba8d76bc0fe3e04 Mon Sep 17 00:00:00 2001 From: Rotzbua Date: Mon, 27 Jun 2022 13:01:00 +0200 Subject: [PATCH] Doc: Update deprecation of `setAutoConnect`, etc.. (#6908) * Doc: Update deprecation of `setAutoConnect`... ... and `getAutoConnect` * Doc: Add doc to `setAutoReconnect`.. .. and `getAutoReconnect` --- docs/source/api/wifi.rst | 21 ++++----------------- libraries/WiFi/src/WiFiSTA.cpp | 16 +++++++++++++--- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/docs/source/api/wifi.rst b/docs/source/api/wifi.rst index 5f1d10049..4808d92fb 100644 --- a/docs/source/api/wifi.rst +++ b/docs/source/api/wifi.rst @@ -446,26 +446,12 @@ Return the connection state. setAutoConnect ************** -Function used to set the automatic connection. - -.. code-block:: arduino - - bool setAutoConnect(bool autoConnect); - -Where: - -* ``bool autoConnect`` is set to ``true`` to enable this option. +Function is deprecated. getAutoConnect ************** -Function used to get the automatic connection setting value. - -.. code-block:: arduino - - bool getAutoConnect(); - -The function will return ``true`` if the setting is enabled. +Function is deprecated. setAutoReconnect **************** @@ -484,11 +470,12 @@ getAutoReconnect **************** Function used to get the automatic reconnection if the connection is lost. + .. code-block:: arduino bool getAutoReconnect(); - The function will return ``true`` if this setting is enabled. +The function will return ``true`` if this setting is enabled. WiFiMulti --------- diff --git a/libraries/WiFi/src/WiFiSTA.cpp b/libraries/WiFi/src/WiFiSTA.cpp index f93f4bae0..859d6cf3e 100644 --- a/libraries/WiFi/src/WiFiSTA.cpp +++ b/libraries/WiFi/src/WiFiSTA.cpp @@ -430,8 +430,9 @@ void WiFiSTAClass::setSortMethod(wifi_sort_method_t sortMethod) } /** - * Setting the ESP32 station to connect to the AP (which is recorded) + * Deprecated. Setting the ESP32 station to connect to the AP (which is recorded) * automatically or not when powered on. Enable auto-connect by default. + * @deprecated use `setAutoReconnect` * @param autoConnect bool * @return if saved */ @@ -441,8 +442,9 @@ bool WiFiSTAClass::setAutoConnect(bool autoConnect) } /** - * Checks if ESP32 station mode will connect to AP + * Deprecated. Checks if ESP32 station mode will connect to AP * automatically or not when it is powered on. + * @deprecated use `getAutoReconnect` * @return auto connect */ bool WiFiSTAClass::getAutoConnect() @@ -450,12 +452,20 @@ bool WiFiSTAClass::getAutoConnect() return false;//now deprecated } +/** + * Function used to set the automatic reconnection if the connection is lost. + * @param autoReconnect `true` to enable this option. + * @return true + */ bool WiFiSTAClass::setAutoReconnect(bool autoReconnect) { _autoReconnect = autoReconnect; return true; } - +/** + * Function used to get the automatic reconnection if the connection is lost. + * @return The function will return `true` if this setting is enabled. + */ bool WiFiSTAClass::getAutoReconnect() { return _autoReconnect;