Commit 2ab28df9 authored by Jason Follas's avatar Jason Follas Committed by Marcel Stör
Browse files

Support clearing WiFi config (#1761)

* Add wifi.sta.clearconfig(). Adjust password validation to match 2.0.0 SDK rules (no min length enforced, i.e. for WEP)
* Updat comments about WEP key not having a minimum
* Documentation: add note about node.restore() to wifi.sta.clearconfig() docs, and add SDK verbiage to describe what node.restore() impacts.
* Normaliz if statements
* Convert leading tabs to leading spaces for consistency
parent b9d9f585
This diff is collapsed.
......@@ -280,7 +280,9 @@ none
## node.restore()
Restores system configuration to defaults using the SDK function `system_restore()`, which doesn't document precisely what it erases/restores.
Restores system configuration to defaults using the SDK function `system_restore()`, which is described in the documentation as:
> Reset default settings of following APIs: `wifi_station_set_auto_connect`, `wifi_set_phy_mode`, `wifi_softap_set_config` related, `wifi_station_set_config` related, `wifi_set_opmode`, and APs’ information recorded by `#define AP_CACHE`.
#### Syntax
`node.restore()`
......
......@@ -270,6 +270,26 @@ wifi.sta.changeap(4)
- [`wifi.sta.getapinfo()`](#wifistagetapinfo)
- [`wifi.sta.getapindex()`](#wifistagetapindex)
## wifi.sta.clearconfig()
Clears the currently saved WiFi station configuration, erasing it from the flash. May be useful for certain factory-reset
scenarios when a full [`node.restore()`](node.md#noderestore) is not desired, or to prepare for using
[End-User Setup](enduser-setup) so that the SoftAP is able to lock onto a single hardware radio channel.
#### Syntax
`wifi.sta.clearconfig()`
#### Parameters
none
#### Returns
- `true` Success
- `false` Failure
#### See also
- [`wifi.sta.config()`](#wifistaconfig)
- [`node.restore()`](node.md#noderestore)
## wifi.sta.config()
Sets the WiFi station configuration.
......@@ -280,7 +300,7 @@ Sets the WiFi station configuration.
#### Parameters
- `station_config` table containing configuration data for station
- `ssid` string which is less than 32 bytes.
- `pwd` string which is 8-64 or 0 bytes. Empty string indicates an open WiFi access point.
- `pwd` string which is 0-64. Empty string indicates an open WiFi access point. _Note: WPA requires a minimum of 8-characters, but the ESP8266 can also connect to a WEP access point (a 40-bit WEP key can be provided as its corresponding 5-character ASCII string)._
- `auto` defaults to true
- `true` to enable auto connect and connect to access point, hence with `auto=true` there's no need to call [`wifi.sta.connect()`](#wifistaconnect)
- `false` to disable auto connect and remain disconnected from access point
......@@ -332,6 +352,7 @@ wifi.sta.config(station_cfg)
```
#### See also
- [`wifi.sta.clearconfig()`](#wifistaclearconfig)
- [`wifi.sta.connect()`](#wifistaconnect)
- [`wifi.sta.disconnect()`](#wifistadisconnect)
- [`wifi.sta.apinfo()`](#wifistaapinfo)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment