Added saveOffset

pull/8/head
Hieromon Ikasamo 7 years ago
parent 3a310a2c30
commit a7a9044542
  1. 25
      docs/api/index.html
  2. 30
      docs/search/search_index.json
  3. 58
      docs/usage/index.html
  4. 12
      mkdocs/api.md
  5. 48
      mkdocs/usage.md
  6. 3
      src/AutoConnect.h

@ -601,6 +601,13 @@
psk
</a>
</li>
<li class="md-nav__item">
<a href="#saveoffset" title="saveOffset" class="md-nav__link">
saveOffset
</a>
</li>
</ul>
@ -945,6 +952,13 @@
psk
</a>
</li>
<li class="md-nav__item">
<a href="#saveoffset" title="saveOffset" class="md-nav__link">
saveOffset
</a>
</li>
</ul>
@ -1230,6 +1244,17 @@ Register the handler function for undefined URL request detected.
<dt><strong>Type</strong></dt>
<dd>String</dd>
</dl></p>
<h4 id="saveoffset">saveOffset<a class="headerlink" href="#saveoffset" title="Permanent link">&para;</a></h4>
<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.
<dl class="apidl">
<dt><strong>Type</strong></dt>
<dd>uint16_t</dd>
</dl></p>
<div class="admonition warning">
<p class="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>
</div>
<h3 id="autoconnectconfig-example"><i class="fa fa-code"></i> AutoConnectConfig example<a class="headerlink" href="#autoconnectconfig-example" title="Permanent link">&para;</a></h3>
<div class="codehilite"><pre><span></span><span class="n">AutoConenct</span> <span class="n">Portal</span><span class="p">;</span>
<span class="n">AutoConenctConfig</span> <span class="nf">Config</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">,</span> <span class="s">&quot;passpass&quot;</span><span class="p">);</span> <span class="c1">// SoftAp name is determined at runtime</span>

File diff suppressed because one or more lines are too long

@ -486,6 +486,13 @@
Disable the captive portal
</a>
</li>
<li class="md-nav__item">
<a href="#move-the-saving-area-of-eeprom-for-the-credentials" title=" Move the saving area of EEPROM for the credentials" class="md-nav__link">
Move the saving area of EEPROM for the credentials
</a>
</li>
<li class="md-nav__item">
@ -775,6 +782,13 @@
Disable the captive portal
</a>
</li>
<li class="md-nav__item">
<a href="#move-the-saving-area-of-eeprom-for-the-credentials" title=" Move the saving area of EEPROM for the credentials" class="md-nav__link">
Move the saving area of EEPROM for the credentials
</a>
</li>
<li class="md-nav__item">
@ -897,7 +911,7 @@ or</p>
<ul>
<li>
<p><strong>Parameter with ESP8266WebServer variable:</strong> An ESP8266WebServer object variable must be declared in the sketch. AutoConnect uses its variable for handling the AutoConnect menu.</p>
<p><strong>Parameter with ESP8266WebServer variable:</strong> An ESP8266WebServer object variable must be declared in the sketch. AutoConnect uses its variable for handling the <a href="../menu/index.html">AutoConnect menu</a>.</p>
</li>
<li>
<p><strong>With no parameter:</strong> The sketch does not declare ESP8266WebServer object. In this case, AutoConnect allocates an instance of the ESP8266WebServer internally and the logic sequence of the sketch is somewhat different as the above. To register a URL handler function by <em>ESP8266WebServer::on</em> should be performed after <a href="../api/index.html#begin"><em>AutoConnect::begin</em></a>.</p>
@ -912,9 +926,9 @@ or</p>
<p>AutoConnect traps the detection of captive portals and directs them to the AutoConnect menu to achieve a connection with the WLAN interactively. In order to trap, it temporarily responds SoftAP address to all DNS queries. When the connection with the WLAN is successfully established, the DNS server will stop.</p>
</div>
<h4 id="5-autoconnectbegin-with-ssid-and-password">5. AutoConnect::begin with SSID and Password<a class="headerlink" href="#5-autoconnectbegin-with-ssid-and-password" title="Permanent link">&para;</a></h4>
<p>SSID and Password can also specify by <a href="../api.me#begin">AutoConnect::begin</a>. ESP8266 uses provided SSID and Password explicitly. If the connection false with specified SSID with Password then a captive portal is activated. SSID and Password are not present, ESP8266 SDK will attempt to connect using the still effectual SSID and password. Usually, it succeeds.</p>
<p>SSID and Password can also specify by <a href="../api.me#begin"><em>AutoConnect::begin</em></a>. ESP8266 uses provided SSID and Password explicitly. If the connection false with specified SSID with Password then a captive portal is activated. SSID and Password are not present, ESP8266 SDK will attempt to connect using the still effectual SSID and password. Usually, it succeeds.</p>
<h4 id="6-use-esp8266webserveron-to-handle-url">6. Use ESP8266WebServer::on to handle URL<a class="headerlink" href="#6-use-esp8266webserveron-to-handle-url" title="Permanent link">&para;</a></h4>
<p>AutoConnect is designed to coexist with the process for handling the web pages by user sketches. The page processing function which will send an HTML to the client invoked by the "<strong>on</strong>" function is the same as when using ESP8266WebServer natively.</p>
<p>AutoConnect is designed to coexist with the process for handling the web pages by user sketches. The page processing function which will send an HTML to the client invoked by the "<em>on::ESP8266WebServer</em>" function is the same as when using ESP8266WebServer natively.</p>
<h4 id="7-use-either-esp8266webserverhandleclient-or-autoconnecthandleclient">7. Use either ESP8266WebServer::handleClient() or AutoConnect::handleClient()<a class="headerlink" href="#7-use-either-esp8266webserverhandleclient-or-autoconnecthandleclient" title="Permanent link">&para;</a></h4>
<p>Both classes member function name is the same: <em>handleClient</em>, but behavior is different. Using the AutoConnect embedded along with ESP8266WebServer::handleClient has limitations. Refer to the below section for details. </p>
<h3 id="esp8266webserver-hosted-or-parasitic"><i class="fa fa-caret-right"></i> ESP8266WebServer hosted or parasitic<a class="headerlink" href="#esp8266webserver-hosted-or-parasitic" title="Permanent link">&para;</a></h3>
@ -963,7 +977,7 @@ or</p>
<h3 id="404-handler"><i class="fa fa-caret-right"></i> 404 handler<a class="headerlink" href="#404-handler" title="Permanent link">&para;</a></h3>
<p>Registering the "not found" handler is a different way than ESP8266. The <em>onNotFound</em> of ESP8266WebServer does not work with AutoConnect. AutoConnect overrides <em>ESP8266WebServer::onNotFound</em> to handle a captive portal. To register "not found" handler, use <a href="../api/index.html#onnotfound"><em>AutoConnect::onNotFound</em></a>.</p>
<h3 id="auto-save-credential"><i class="fa fa-caret-right"></i> Auto save Credential<a class="headerlink" href="#auto-save-credential" title="Permanent link">&para;</a></h3>
<p>By default, AutoConnect saves the credentials of the established connection in EEPROM. You can disable it with the <strong>autoSave</strong> parameter specified by <a href="../api/index.html#config"><em>AutoConnect::config</em></a>.</p>
<p>By default, AutoConnect saves the credentials of the established connection in EEPROM. You can disable it with the <a href="../api/index.html#autosave"><strong>autoSave</strong></a> parameter specified by <a href="../api/index.html#autoconnectconfig"><strong>AutoConnectConfig</strong></a>.</p>
<div class="codehilite"><pre><span></span><span class="n">AutoConnect</span> <span class="n">Portal</span><span class="p">;</span>
<span class="n">AutoConnectConfig</span> <span class="n">Config</span><span class="p">;</span>
<span class="hll"><span class="n">Config</span><span class="p">.</span><span class="n">autoSave</span> <span class="o">=</span> <span class="n">AC_SAVECREDENTIAL_NEVER</span><span class="p">;</span>
@ -972,7 +986,7 @@ or</p>
</pre></div>
<h3 id="captive-portal-start-detection"><i class="fa fa-caret-right"></i> Captive portal start detection<a class="headerlink" href="#captive-portal-start-detection" title="Permanent link">&para;</a></h3>
<p>The captive portal will only be activated if the first <em>WiFi::begin</em> fails. Sketch can detect with the <a href="../api/index.html#ondetect"><em>onDetect</em></a> funciton that the captive portal has started. For example, the sketch can be written like as follows that turns on the LED at the start captive portal.</p>
<p>The captive portal will only be activated if the first <em>WiFi::begin</em> fails. Sketch can detect with the <a href="../api/index.html#ondetect"><em>AutoConnect::onDetect</em></a> funciton that the captive portal has started. For example, the sketch can be written like as follows that turns on the LED at the start captive portal.</p>
<div class="codehilite"><pre><span></span><span class="n">AutoConnect</span> <span class="n">Portal</span><span class="p">;</span>
<span class="hll"><span class="kr">bool</span> <span class="nf">startCP</span><span class="p">(</span><span class="nf">IPAddress</span> <span class="n">ip</span><span class="p">)</span> <span class="p">{</span>
@ -997,7 +1011,7 @@ or</p>
</pre></div>
<h3 id="combination-with-mdns"><i class="fa fa-caret-right"></i> Combination with mDNS<a class="headerlink" href="#combination-with-mdns" title="Permanent link">&para;</a></h3>
<p>With <a href="https://github.com/esp8266/Arduino/tree/master/libraries/ESP8266mDNS">mDNS library</a>, you can access to ESP8266 by name instead of IP address after connection. The sketch can start the MDNS responder after AutoConnect::begin.</p>
<p>With <a href="https://github.com/esp8266/Arduino/tree/master/libraries/ESP8266mDNS">mDNS library</a>, you can access to ESP8266 by name instead of IP address after connection. The sketch can start the MDNS responder after <a href="../api/index.html#begin"><em>AutoConnect::begin</em></a>.</p>
<div class="codehilite"><pre><span></span><span class="cp">#include</span> <span class="cpf">&lt;ESP8266WiFi.h&gt;</span><span class="cp"></span>
<span class="cp">#include</span> <span class="cpf">&lt;ESP8266mDNS.h&gt;</span><span class="cp"></span>
<span class="cp">#include</span> <span class="cpf">&lt;ESP8266WebServer.h&gt;</span><span class="cp"></span>
@ -1021,13 +1035,13 @@ or</p>
<p><em>AutoConnect::config</em> must be executed before <em>AutoConnect::begin</em>.</p>
</div>
<h3 id="debug-print"><i class="fa fa-caret-right"></i> Debug print<a class="headerlink" href="#debug-print" title="Permanent link">&para;</a></h3>
<p>You can output AutoConnect monitor messages to the <strong>Serial</strong>. A monitor message activation switch is in an include header file <a href="https://github.com/Hieromon/AutoConnect/blob/master/src/AutoConnect.h"><em>AutoConnect.h</em></a> of library source. Define <strong>AC_DEBUG</strong> macro to output monitor messages.</p>
<p>You can output AutoConnect monitor messages to the <strong>Serial</strong>. A monitor message activation switch is in an include header file <a href="https://github.com/Hieromon/AutoConnect/blob/master/src/AutoConnect.h">AutoConnect.h</a> of library source. Define <a href="https://github.com/Hieromon/AutoConnect/blob/master/src/AutoConnect.h#L27"><strong>AC_DEBUG</strong></a> macro to output monitor messages.</p>
<div class="codehilite"><pre><span></span><span class="cp">#define AC_DEBUG</span>
</pre></div>
<h3 id="disable-the-captive-portal"><i class="fa fa-caret-right"></i> Disable the captive portal<a class="headerlink" href="#disable-the-captive-portal" title="Permanent link">&para;</a></h3>
<p>It can also prevent the captive portal from starting even if the connection at the first <em>WiFi.begin</em> fails. In this case, the behavior of <em>AutoConnect::begin</em> is the same as <em>WiFi.begin</em>.</p>
<p>For disabling the captive portal, <strong>autoRise</strong> sets to false with AutoConnectConfig.</p>
<p>It can also prevent the captive portal from starting even if the connection at the first <em>WiFi.begin</em> fails. In this case, the behavior of <a href="../api/index.html#begin"><em>AutoConnect::begin</em></a> is the same as <em>WiFi.begin</em>.</p>
<p>For disabling the captive portal, <a href="../api/index.html#autorise"><strong>autoRise</strong></a> sets to false with <a href="../api/index.html#autoconnectconfig-api"><strong>AutoConnectConfig</strong></a>.</p>
<div class="codehilite"><pre><span></span><span class="n">AutoConnect</span> <span class="n">portal</span><span class="p">;</span>
<span class="n">AutoConnectConfig</span> <span class="n">acConfig</span><span class="p">;</span>
@ -1036,6 +1050,25 @@ or</p>
<span class="n">portal</span><span class="p">.</span><span class="nf">begin</span><span class="p">();</span>
</pre></div>
<h3 id="move-the-saving-area-of-eeprom-for-the-credentials"><i class="fa fa-caret-right"></i> Move the saving area of EEPROM for the credentials<a class="headerlink" href="#move-the-saving-area-of-eeprom-for-the-credentials" title="Permanent link">&para;</a></h3>
<p>By default, the credentials saving area is occupied from the beginning of EEPROM. <a href="http://arduino-esp8266.readthedocs.io/en/latest/filesystem.html?highlight=eeprom#flash-layout">ESP8266 Arduino core document</a> says that:</p>
<blockquote>
<p>The following diagram illustrates flash layout used in Arduino environment:</p>
</blockquote>
<div class="highlight">
<pre><span></span>
<span class="o">|--------------|-------|---------------|--|--|--|--|--|</span>
<span class="o">^</span> <span class="o">^</span> <span class="o">^</span> <span class="o">^</span> <span class="o">^</span>
<span class="n">Sketch</span> <span class="n">OTA</span> <span class="n">update</span> <span class="n">File</span> <span class="n">system</span> <span class="n"><span class="highlighted">EEPROM</span></span> <span class="n">WiFi</span> <span class="n">config</span> <span class="p">(</span><span class="n">SDK</span><span class="p">)</span>
</pre>
</div>
<p>and</p>
<blockquote>
<p>EEPROM library uses one sector of flash located <a href="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 <a href="../api/index.html#saveoffset"><strong>saveOffset</strong></a> in <a href="../api/index.html#autoconnectconfig-api"><strong>AutoConnectConfig</strong></a> specifies the start offset of the credentials storage area. The default value is 0.</p>
<h3 id="refers-the-hosted-esp8266webserver"><i class="fa fa-caret-right"></i> Refers the hosted ESP8266WebServer<a class="headerlink" href="#refers-the-hosted-esp8266webserver" title="Permanent link">&para;</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 <a href="../api/index.html#host"><em>AutoConnect::host()</em></a> function to access ESP8266WebServer instance as like below.</p>
<div class="codehilite"><pre><span></span><span class="n">AutoConnect</span> <span class="n">Portal</span><span class="p">;</span>
@ -1099,7 +1132,7 @@ or</p>
<p><img src="../images/PageBuilder.png" style="width:640px;"/></p>
<h2 id="configuration-functions">Configuration functions<a class="headerlink" href="#configuration-functions" title="Permanent link">&para;</a></h2>
<h3 id="configuration-for-soft-ap"><i class="fa fa-caret-right"></i> Configuration for Soft AP<a class="headerlink" href="#configuration-for-soft-ap" title="Permanent link">&para;</a></h3>
<p>AutoConnect will activate SoftAP at failed initial WiFi.Begin. It SoftAP settings are stored in <a href="../api/index.html#autoconnectconfig-api"><em>AutoConnectConfig</em></a> as the following parameters. The sketch could be configured SoftAP using these parameters, refer <a href="../api/index.html#autoconnectconfig-api">AutoConnectConfig API</a> for details.</p>
<p>AutoConnect will activate SoftAP at failed initial WiFi.Begin. It SoftAP settings are stored in <a href="../api/index.html#autoconnectconfig"><strong>AutoConnectConfig</strong></a> as the following parameters. The sketch could be configured SoftAP using these parameters, refer the <a href="../api/index.html#autoconnectconfig-api">AutoConnectConfig API</a> for details.</p>
<ul>
<li>IP address of SoftAP activated.</li>
<li>Gateway IP address.</li>
@ -1109,6 +1142,9 @@ or</p>
<li>Channel.</li>
<li>Hidden attribute.</li>
<li>Auto save credential.</li>
<li>Offset address of the credentials storage area in EEPROM.</li>
<li>Length of start up time after reset.</li>
<li>Automatic starting the captive portal.</li>
<li>Auto reset after connection establishment.</li>
<li>Home URL of the user sketch application.</li>
</ul>
@ -1116,7 +1152,7 @@ or</p>
<p>"<strong>HOME</strong>" for returning to the user's sketch homepage is displayed at the bottom of the AutoConnect menu. It could be set using the <a href="../api/index.html#home"><em>AutoConnect::home</em></a> function.</p>
<p><img src="../images/menu_home.png" /></p>
<h3 id="relocate-the-autoconnect-home-path"><i class="fa fa-caret-right"></i> Relocate the AutoConnect home path<a class="headerlink" href="#relocate-the-autoconnect-home-path" title="Permanent link">&para;</a></h3>
<p>A home path of AutoConnect is <strong>_ac</strong> by default. You can access from the browser with http://IPADDRESS/_ac. You can change the home path by revising <strong>AUTOCONNECT_URI</strong> macro in the include header file as <a href="https://github.com/Hieromon/AutoConnect/blob/master/src/AutoConnect.h">AutoConnect.h</a>.</p>
<p>A home path of AutoConnect is <strong>_ac</strong> by default. You can access from the browser with http://IPADDRESS/_ac. You can change the home path by revising <a href="https://github.com/Hieromon/AutoConnect/blob/master/src/AutoConnect.h#L58"><strong>AUTOCONNECT_URI</strong></a> macro in the include header file as <a href="https://github.com/Hieromon/AutoConnect/blob/master/src/AutoConnect.h">AutoConnect.h</a>.</p>
<div class="codehilite"><pre><span></span><span class="cp">#define AUTOCONNECT_URI &quot;/_ac&quot;</span>
</pre></div>

@ -313,6 +313,18 @@ 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.
<dl class="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.
### <i class="fa fa-code"></i> AutoConnectConfig example
```arduino

@ -56,7 +56,7 @@ or
AutoConnect VARIABLE;
```
- **Parameter with ESP8266WebServer variable:** An ESP8266WebServer object variable must be declared in the sketch. AutoConnect uses its variable for handling the AutoConnect menu.
- **Parameter with ESP8266WebServer variable:** An ESP8266WebServer object variable must be declared in the sketch. AutoConnect uses its variable for handling the [AutoConnect menu](menu.md).
- **With no parameter:** The sketch does not declare ESP8266WebServer object. In this case, AutoConnect allocates an instance of the ESP8266WebServer internally and the logic sequence of the sketch is somewhat different as the above. To register a URL handler function by *ESP8266WebServer::on* should be performed after [*AutoConnect::begin*](api.md#begin).
@ -73,11 +73,11 @@ AutoConnect performs *WiFi.begin* for establishing a connection with WLAN intern
#### 5. AutoConnect::begin with SSID and Password
SSID and Password can also specify by [AutoConnect::begin](api.me#begin). ESP8266 uses provided SSID and Password explicitly. If the connection false with specified SSID with Password then a captive portal is activated. SSID and Password are not present, ESP8266 SDK will attempt to connect using the still effectual SSID and password. Usually, it succeeds.
SSID and Password can also specify by [*AutoConnect::begin*](api.me#begin). ESP8266 uses provided SSID and Password explicitly. If the connection false with specified SSID with Password then a captive portal is activated. SSID and Password are not present, ESP8266 SDK will attempt to connect using the still effectual SSID and password. Usually, it succeeds.
#### 6. Use ESP8266WebServer::on to handle URL
AutoConnect is designed to coexist with the process for handling the web pages by user sketches. The page processing function which will send an HTML to the client invoked by the "**on**" function is the same as when using ESP8266WebServer natively.
AutoConnect is designed to coexist with the process for handling the web pages by user sketches. The page processing function which will send an HTML to the client invoked by the "*on::ESP8266WebServer*" function is the same as when using ESP8266WebServer natively.
#### 7. Use either ESP8266WebServer::handleClient() or AutoConnect::handleClient()
@ -112,7 +112,7 @@ Registering the "not found" handler is a different way than ESP8266. The *onNotF
### <i class="fa fa-caret-right"></i> Auto save Credential
By default, AutoConnect saves the credentials of the established connection in EEPROM. You can disable it with the **autoSave** parameter specified by [*AutoConnect::config*](api.md#config).
By default, AutoConnect saves the credentials of the established connection in EEPROM. You can disable it with the [**autoSave**](api.md#autosave) parameter specified by [**AutoConnectConfig**](api.md#autoconnectconfig).
```arduino hl_lines="3"
AutoConnect Portal;
@ -124,7 +124,7 @@ Portal.begin();
### <i class="fa fa-caret-right"></i> Captive portal start detection
The captive portal will only be activated if the first *WiFi::begin* fails. Sketch can detect with the [*onDetect*](api.md#ondetect) funciton that the captive portal has started. For example, the sketch can be written like as follows that turns on the LED at the start captive portal.
The captive portal will only be activated if the first *WiFi::begin* fails. Sketch can detect with the [*AutoConnect::onDetect*](api.md#ondetect) funciton that the captive portal has started. For example, the sketch can be written like as follows that turns on the LED at the start captive portal.
```arduino hl_lines="3 13"
AutoConnect Portal;
@ -152,7 +152,7 @@ void loop() {
### <i class="fa fa-caret-right"></i> Combination with mDNS
With [mDNS library](https://github.com/esp8266/Arduino/tree/master/libraries/ESP8266mDNS), you can access to ESP8266 by name instead of IP address after connection. The sketch can start the MDNS responder after AutoConnect::begin.
With [mDNS library](https://github.com/esp8266/Arduino/tree/master/libraries/ESP8266mDNS), you can access to ESP8266 by name instead of IP address after connection. The sketch can start the MDNS responder after [*AutoConnect::begin*](api.md#begin).
```arduino hl_lines="8 9"
#include <ESP8266WiFi.h>
@ -178,7 +178,7 @@ void loop() {
### <i class="fa fa-caret-right"></i> Debug print
You can output AutoConnect monitor messages to the **Serial**. A monitor message activation switch is in an include header file [*AutoConnect.h*](https://github.com/Hieromon/AutoConnect/blob/master/src/AutoConnect.h) of library source. Define **AC_DEBUG** macro to output monitor messages.
You can output AutoConnect monitor messages to the **Serial**. A monitor message activation switch is in an include header file [AutoConnect.h](https://github.com/Hieromon/AutoConnect/blob/master/src/AutoConnect.h) of library source. Define [**AC_DEBUG**](https://github.com/Hieromon/AutoConnect/blob/master/src/AutoConnect.h#L27) macro to output monitor messages.
```cpp
#define AC_DEBUG
@ -186,9 +186,9 @@ You can output AutoConnect monitor messages to the **Serial**. A monitor message
### <i class="fa fa-caret-right"></i> Disable the captive portal
It can also prevent the captive portal from starting even if the connection at the first *WiFi.begin* fails. In this case, the behavior of *AutoConnect::begin* is the same as *WiFi.begin*.
It can also prevent the captive portal from starting even if the connection at the first *WiFi.begin* fails. In this case, the behavior of [*AutoConnect::begin*](api.md#begin) is the same as *WiFi.begin*.
For disabling the captive portal, **autoRise** sets to false with AutoConnectConfig.
For disabling the captive portal, [**autoRise**](api.md#autorise) sets to false with [**AutoConnectConfig**](api.md#autoconnectconfig-api).
```arduino hl_lines="4"
AutoConnect portal;
@ -199,6 +199,29 @@ portal.config(acConfig);
portal.begin();
```
### <i class="fa fa-caret-right"></i> Move the saving area of EEPROM for the credentials
By default, the credentials saving area is occupied from the beginning of EEPROM. [ESP8266 Arduino core document](http://arduino-esp8266.readthedocs.io/en/latest/filesystem.html?highlight=eeprom#flash-layout) says that:
> The following diagram illustrates flash layout used in Arduino environment:
<div class="highlight">
<pre><span></span>
<span class="o">|--------------|-------|---------------|--|--|--|--|--|</span>
<span class="o">^</span> <span class="o">^</span> <span class="o">^</span> <span class="o">^</span> <span class="o">^</span>
<span class="n">Sketch</span> <span class="n">OTA</span> <span class="n">update</span> <span class="n">File</span> <span class="n">system</span> <span class="n"><span class="highlighted">EEPROM</span></span> <span class="n">WiFi</span> <span class="n">config</span> <span class="p">(</span><span class="n">SDK</span><span class="p">)</span>
</pre>
</div>
and
> EEPROM library uses one sector of flash located [just after the SPIFFS](http://arduino-esp8266.readthedocs.io/en/latest/libraries.html?highlight=SPIFFS#eeprom).
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.
### <i class="fa fa-caret-right"></i> Refers the hosted ESP8266WebServer
Constructing an AutoConnect object variable without parameters then creates and starts an ESP8266WebServer inside the AutoConnect. This object variable could be referred by [*AutoConnect::host()*](api.md#host) function to access ESP8266WebServer instance as like below.
@ -271,7 +294,7 @@ An example sketch used with the PageBuilder as follows and it explains how it ai
### <i class="fa fa-caret-right"></i> Configuration for Soft AP
AutoConnect will activate SoftAP at failed initial WiFi.Begin. It SoftAP settings are stored in [*AutoConnectConfig*](api.md#autoconnectconfig-api) as the following parameters. The sketch could be configured SoftAP using these parameters, refer [AutoConnectConfig API](api.md#autoconnectconfig-api) for details.
AutoConnect will activate SoftAP at failed initial WiFi.Begin. It SoftAP settings are stored in [**AutoConnectConfig**](api.md#autoconnectconfig) as the following parameters. The sketch could be configured SoftAP using these parameters, refer the [AutoConnectConfig API](api.md#autoconnectconfig-api) for details.
- IP address of SoftAP activated.
- Gateway IP address.
@ -281,6 +304,9 @@ AutoConnect will activate SoftAP at failed initial WiFi.Begin. It SoftAP setting
- Channel.
- Hidden attribute.
- Auto save credential.
- Offset address of the credentials storage area in EEPROM.
- Length of start up time after reset.
- Automatic starting the captive portal.
- Auto reset after connection establishment.
- Home URL of the user sketch application.
@ -292,7 +318,7 @@ AutoConnect will activate SoftAP at failed initial WiFi.Begin. It SoftAP setting
### <i class="fa fa-caret-right"></i> Relocate the AutoConnect home path
A home path of AutoConnect is **\_ac** by default. You can access from the browser with http://IPADDRESS/\_ac. You can change the home path by revising **AUTOCONNECT_URI** macro in the include header file as [AutoConnect.h](https://github.com/Hieromon/AutoConnect/blob/master/src/AutoConnect.h).
A home path of AutoConnect is **\_ac** by default. You can access from the browser with http://IPADDRESS/\_ac. You can change the home path by revising [**AUTOCONNECT_URI**](https://github.com/Hieromon/AutoConnect/blob/master/src/AutoConnect.h#L58) macro in the include header file as [AutoConnect.h](https://github.com/Hieromon/AutoConnect/blob/master/src/AutoConnect.h).
```cpp
#define AUTOCONNECT_URI "/_ac"

@ -157,8 +157,9 @@ class AutoConnectConfig {
uint8_t channel; /**< SoftAP used wifi channel */
uint8_t hidden; /**< SoftAP SSID hidden */
AC_SAVECREDENTIAL_t autoSave; /**< Auto save credential */
uint16_t saveOffset; /**< The save storage offset of EEPROM */
int uptime; /**< Length of start up time */
bool autoRise; /**< automatic starting the captive portal */
bool autoRise; /**< Automatic starting the captive portal */
bool autoReset; /**< Reset ESP8266 module automatically when WLAN disconnected. */
String homeUri; /**< A URI of user site */
};

Loading…
Cancel
Save