<p>EEPROM library uses one sector of flash located <ahref="http://arduino-esp8266.readthedocs.io/en/latest/libraries.html?highlight=SPIFFS#eeprom">just after the SPIFFS</a>.</p>
</blockquote>
<p>So in the default state, the credential storage area used by AutoConnect conflicts with data area owned by the user sketch. It will be destroyed together saved data in EEPROM by user sketch and AutoConnect each other. But you can move the storage area to avoid this.</p>
<p>The <ahref="../api/index.html#saveoffset"><strong>saveOffset</strong></a> in <ahref="../api/index.html#autoconnectconfig-api"><strong>AutoConnectConfig</strong></a> specifies the start offset of the credentials storage area. The default value is 0.</p>
<p>The <ahref="../api/index.html#boundaryoffset"><strong>boundaryOffset</strong></a> in <ahref="../api/index.html#autoconnectconfig-api"><strong>AutoConnectConfig</strong></a> specifies the start offset of the credentials storage area. The default value is 0.</p>
<h3id="refers-the-hosted-esp8266webserver"><iclass="fa fa-caret-right"></i> Refers the hosted ESP8266WebServer<aclass="headerlink"href="#refers-the-hosted-esp8266webserver"title="Permanent link">¶</a></h3>
<p>Constructing an AutoConnect object variable without parameters then creates and starts an ESP8266WebServer inside the AutoConnect. This object variable could be referred by <ahref="../api/index.html#host"><em>AutoConnect::host()</em></a> function to access ESP8266WebServer instance as like below.</p>
<p>Sets the offset address of the credential storage area for EEPROM. This value must be between greater than 4 and less than flash sector size. (4096 by SDK)<br/>
The default value is 0.
<dlclass="apidl">
<dt><strong>Type</strong></dt>
<dd>uint16_t</dd>
</dl></p>
<divclass="admonition warning">
<pclass="admonition-title">It will conflict with user data.</p>
<p>If the sketch leaves this offset at zero, it will conflict the storage area of credentials with the user sketch owned data. It needs to use the behind of credential area.</p>
<p>Sets the offset address of the credential storage area for EEPROM. This value must be between greater than 4 and less than flash sector size. (4096 by SDK)<br/>
The default value is 0.
<dlclass="apidl">
<dt><strong>Type</strong></dt>
<dd>uint16_t</dd>
</dl></p>
<divclass="admonition warning">
<pclass="admonition-title">It will conflict with user data.</p>
<p>If the sketch leaves this offset at zero, it will conflict the storage area of credentials with the user sketch owned data. It needs to use the behind of credential area.</p>
<spanclass="n">AutoConenctConfig</span><spanclass="nf">Config</span><spanclass="p">(</span><spanclass="s">""</span><spanclass="p">,</span><spanclass="s">"passpass"</span><spanclass="p">);</span><spanclass="c1">// SoftAp name is determined at runtime</span>
@ -1311,6 +1311,7 @@ The default value is 0.
<spanclass="n">Config</span><spanclass="p">.</span><spanclass="n">gateway</span><spanclass="o">=</span><spanclass="nf">IPAddress</span><spanclass="p">(</span><spanclass="mi">192</span><spanclass="p">,</span><spanclass="mi">168</span><spanclass="p">,</span><spanclass="mi">10</span><spanclass="p">,</span><spanclass="mi">1</span><spanclass="p">);</span><spanclass="c1">// Sets WLAN router IP address</span>
<spanclass="n">Config</span><spanclass="p">.</span><spanclass="n">autoSave</span><spanclass="o">=</span><spanclass="n">AC_SAVECREDENTIAL_NEVER</span><spanclass="p">;</span><spanclass="c1">// No save credential</span>
<spanclass="n">COnfig</span><spanclass="p">.</span><spanclass="n">boundaryOffet</span><spanclass="o">=</span><spanclass="mi">64</span><spanclass="p">;</span><spanclass="c1">// Reserve 64 bytes for the user data in EEPROM. </span>
<spanclass="n">Config</span><spanclass="p">.</span><spanclass="n">homeUri</span><spanclass="o">=</span><spanclass="s">"/index.html"</span><spanclass="c1">// Sets home path of the sketch application</span>
<p>Here holds two case examples. Both examples perform the same function. Only how to incorporate the <strong>AutoConnect</strong> into the sketch differs. Also included in the sample folder, HandlePortal.ino also shows how to use the <ahref="https://github.com/Hieromon/PageBuilder">PageBuilder</a> library for HTML assemblies.</p>
<h2id="what-does-this-example-do">What does this example do?<aclass="headerlink"href="#what-does-this-example-do"title="Permanent link">¶</a></h2>
<p>Uses the web interface to light the LED connected to the <strong><ahref="https://github.com/nodemcu/nodemcu-devkit-v1.0">NodeMCU</a></strong> module D0 port (which could be referred to as <em>BUILTIN_LED</em>), the following animation is it.</p>
<p>Access to the ESP8266 module connected WiFi from the browser then the page contains the current value of the D0 port would be displayed. The page has the buttons to switch the port value. The LED blinks according to the value of the button that was clicked. This example is a typical sketch of manipulating ESP8266's GPIO via WLN.</p>
<p>Access to the ESP8266 module connected WiFi from the browser then the page contains the current value of the D0 port would be displayed. The page has the buttons to switch the port value. The LED blinks according to the value of the button that was clicked. This example is a typical sketch of manipulating ESP8266's GPIO via WLAN.</p>
<p><imgdata-gifffer="../images/ac2.gif"/></p>
<p>Embed AutoConnect library into this sketch. There are few places to be changed. And you can use AutoConnect's captive portal function to establish a connection freely to other WiFi spots.</p>
<h2id="how-erase-the-credentials-saved-in-eeprom"><iclass="fa fa-question-circle"></i> How erase the credentials saved in EEPROM?<aclass="headerlink"href="#how-erase-the-credentials-saved-in-eeprom"title="Permanent link">¶</a></h2>
<p>Make some sketches for erasing the EEPROM area, or some erasing utility is needed. You can prepare the sketch to erase the saved credential with <em>AutoConnectCredential</em>. The <em>AutoConnectCrendential</em> class provides the access method to the saved credential in EEPROM and library source file is including it.</p>
<p>A class description of AutoConnectCredential is follows.</p>
<p>AutoConnectCredential default constructor. The default offset value is 0. If the offset value is 0, the credential storage area starts from the top of the EEPROM. AutoConnect sometimes overwrites data when using this area with user sketch.</p>
So in the default state, the credential storage area used by AutoConnect conflicts with data area owned by the user sketch. It will be destroyed together saved data in EEPROM by user sketch and AutoConnect each other. But you can move the storage area to avoid this.
The [**saveOffset**](api.md#saveoffset) in [**AutoConnectConfig**](api.md#autoconnectconfig-api) specifies the start offset of the credentials storage area. The default value is 0.
The [**boundaryOffset**](api.md#boundaryoffset) in [**AutoConnectConfig**](api.md#autoconnectconfig-api) specifies the start offset of the credentials storage area. The default value is 0.
### <iclass="fa fa-caret-right"></i> Refers the hosted ESP8266WebServer
@ -243,7 +243,7 @@ Captive portal activation switch. False for disabling the captive portal. It pre
<dt>**Type**</dt>
<dd>bool</dd>
<dt>**Value**</dt>
<dd><spanclass="apidef"style="width:230px;">true</span>Enable the captive portal. This is a default.</dd>
<dd><spanclass="apidef"style="width:230px;">true</span>Enable the captive portal. This is the default.</dd>
<dd><spanclass="apidef"style="width:230px;">false</span>Disable the captive portal.</dd>
</dl>
@ -258,6 +258,18 @@ The credential saved automatically at the connection establishment.
<dd><spanclass="apidef"style="width:230px;">AC_SAVECREDENTIAL_NEVER</span>The credential no saved.</dd>
</dl>
#### boundaryOffset
Sets the offset address of the credential storage area for EEPROM. This value must be between greater than 4 and less than flash sector size. (4096 by SDK)
The default value is 0.
<dlclass="apidl">
<dt>**Type**</dt>
<dd>uint16_t</dd>
</dl>
!!! warning "It will conflict with user data."
If the sketch leaves this offset at zero, it will conflict the storage area of credentials with the user sketch owned data. It needs to use the behind of credential area.
#### channel
The channel number of WIFi when SoftAP starts.
@ -314,18 +326,6 @@ Sets password for SoftAP. The length should be from 8 to up to 63. The default v
<dd>String</dd>
</dl>
#### saveOffset
Sets the offset address of the credential storage area for EEPROM. This value must be between greater than 4 and less than flash sector size. (4096 by SDK)
The default value is 0.
<dlclass="apidl">
<dt>**Type**</dt>
<dd>uint16_t</dd>
</dl>
!!! warning "It will conflict with user data."
If the sketch leaves this offset at zero, it will conflict the storage area of credentials with the user sketch owned data. It needs to use the behind of credential area.
### <iclass="fa fa-code"></i> AutoConnectConfig example
@ -6,7 +6,7 @@ Here holds two case examples. Both examples perform the same function. Only how
Uses the web interface to light the LED connected to the **[NodeMCU](https://github.com/nodemcu/nodemcu-devkit-v1.0)** module D0 port (which could be referred to as *BUILTIN_LED*), the following animation is it.
Access to the ESP8266 module connected WiFi from the browser then the page contains the current value of the D0 port would be displayed. The page has the buttons to switch the port value. The LED blinks according to the value of the button that was clicked. This example is a typical sketch of manipulating ESP8266's GPIO via WLN.
Access to the ESP8266 module connected WiFi from the browser then the page contains the current value of the D0 port would be displayed. The page has the buttons to switch the port value. The LED blinks according to the value of the button that was clicked. This example is a typical sketch of manipulating ESP8266's GPIO via WLAN.
@ -68,14 +68,26 @@ Make some sketches for erasing the EEPROM area, or some erasing utility is neede
A class description of AutoConnectCredential is follows.
### Constructor
### Include header
```cpp
#include<AutoConnectCredential.h>
```
### Constructor
```cpp
AutoConnectCredential();
```
AutoConnectCredential default constructor. The default offset value is 0. If the offset value is 0, the credential storage area starts from the top of the EEPROM. AutoConnect sometimes overwrites data when using this area with user sketch.
```cpp
AutoConnectCredential(uint16_t offset);
```
Specify offset from the top of the EEPROM for the credential storage area together. The offset value is from 0 to the flash sector size.