<p>AutoConnect has two parameters for timeout control. One is a timeout value used when trying to connect to the specified AP. It behaves the same as general timeout control in connection attempt by WiFi.begin. This control is specified by the third parameter of <ahref="api.html#begin"><em>AutoConnect::begin</em></a>. Default value is macro defined by <ahref="api.html#defined-macros"><strong>AUTOCONNECT_TIMEOUT</strong></a> in the <code>AutoConnectDef.h</code> file.</p>
<p>The other is timeout control for the captive portal itself. It is useful when you want to continue sketch execution with offline even if the WiFi connection is not possible. You can also combine it with the <ahref="#on-demand-start-the-captive-portal"><strong>immediateStart</strong></a> option to create sketches with high mobility.</p>
<p>AutoConnect has two parameters for timeout control. One is a timeout value used when trying to connect to the specified AP. It behaves the same as general timeout control in connection attempt by WiFi.begin. This control is specified by the third parameter of <ahref="api.html#begin"><em>AutoConnect::begin</em></a>. The default value is macro defined by <ahref="api.html#defined-macros"><strong>AUTOCONNECT_TIMEOUT</strong></a> in the <strong>AutoConnectDef.h</strong> file.</p>
<p>The other timeout control is for the captive portal itself. It is useful when you want to continue sketch execution with offline even if the WiFi connection is not possible. You can also combine it with the <ahref="#on-demand-start-the-captive-portal"><strong>immediateStart</strong></a> option to create sketches with high mobility.</p>
<p>The timeout of the captive portal is specified together with <ahref="apiconfig.html#portaltimeout"><strong>AutoConnectConfig::portalTimeout</strong></a> as follows.</p>
@ -1170,7 +1170,7 @@ Also, if you want to stop AutoConnect completely when the captive portal is time
<spanstyle="color: #f8f8f2">}</span>
</pre></div>
<p>There is another option related to timeout in AutoConnectConfig. It can make use of the captive portal function even after a timeout. The <ahref="apiconfig.html#retainlportal"><strong>AutoConnectConfig::retainPortal</strong></a> option will not stop the SoftAP when the captive portal is timed out. If you enable the ratainPortal option, you can try to connect to the AP at any time while continuing to sketch execution with offline even after the captive portal timed-out. The following code is its example. It can enable the captive portal after timed-out without changing sketch skeleton compared to the above code which does not specify an option.</p>
<p>There is another option related to timeout in AutoConnectConfig. It can make use of the captive portal function even after a timeout. The <ahref="apiconfig.html#retainlportal"><strong>AutoConnectConfig::retainPortal</strong></a> option will not stop the SoftAP when the captive portal is timed out. If you enable the ratainPortal option, you can try to connect to the AP at any time while continuing to sketch execution with offline even after the captive portal timed-out. Compared to the above code specified no option with the following example code, the captive portal will remain available even after a timeout without changing the logic of the sketch.</p>
@ -1196,20 +1196,20 @@ Also, if you want to stop AutoConnect completely when the captive portal is time
<spanstyle="color: #f8f8f2">}</span>
</pre></div>
<h3id="cast-the-legacy-html-pages-as-the-add-on-menu-items"><iclass="fa fa-caret-right"></i> Cast the legacy HTML pages as the add-on menu items<aclass="headerlink"href="#cast-the-legacy-html-pages-as-the-add-on-menu-items"title="Permanent link">¶</a></h3>
<p>If your sketch handles web pages, you can embed the pages into the AutoConnect menu with keeping the WiFi connection feature. Unlike the custom Web pages by <ahref="apiaux.html#autoconnectaux">AutoConnectAux</a>, this allows to legacy web pages registered by <em>ESP8266WebServer::on</em> or <em>WebServer::on</em> function.</p>
<p>To implement embedding the your sketch web pages, use only the <ahref="apiaux.html#autoconnectaux">AutoConnectAux</a> constructed with the URI of that page. <ahref="acelements.html">AutoConnectElements</a> is not required. The basic procedure for this as follows:</p>
<h3id="casts-the-html-pages-to-be-add-on-into-the-menu"><iclass="fa fa-caret-right"></i> Casts the HTML pages to be add-on into the menu<aclass="headerlink"href="#casts-the-html-pages-to-be-add-on-into-the-menu"title="Permanent link">¶</a></h3>
<p>If your sketch handles web pages, you can embed the pages into the AutoConnect menu in continuance enjoying the utility of the WiFi connection feature. Unlike the custom Web pages by <ahref="acelements.html">AutoConnectElements</a>, this allows to legacy web pages registered by <em>ESP8266WebServer::on</em> or <em>WebServer::on</em> function.</p>
<p>You can use AutoConnectAux only constructed with the URI of the page to be embedding. AutoConnectElements is not required. The basic procedure for this as follows:</p>
<ol>
<li>Declare AutoConnectAux for each legacy page. It includes the URI of the page and item string which will display in the AutoConnect menu.</li>
<li>Sketch the legacy page handlers.</li>
<li>Register those handler functions to ESP8266WebServer/WebServer with the <strong>on</strong> function.</li>
<li>Register AutoConnectAux declared with #1 to AutoConnect using <ahref="api.html#join">AutoConnect::join</a> function. It serves as a menu item.</li>
<li>Register AutoConnectAux declared with #1 to AutoConnect using <ahref="api.html#join"><em>AutoConnect::join</em></a> function. It serves as a menu item.</li>
<li><ahref="api.html#begin">Begin</a> the portal.</li>
<li>Performs <ahref="api.html#handleClient">AutoConnect::handleClient</a> in the <strong>loop</strong> function.</li>
<li>Performs <ahref="api.html#handleClient"><em>AutoConnect::handleClient</em></a> in the <strong>loop</strong> function.</li>
</ol>
<p>For details see <em>Example page</em> of section <ahref="menuize.html"><em>Constructing the menu</em></a>.</p>
<p>For details, see section <ahref="menuize.html">Constructing the menu</a> of Examples page.</p>
<h3id="change-menu-title"><iclass="fa fa-caret-right"></i> Change menu title<aclass="headerlink"href="#change-menu-title"title="Permanent link">¶</a></h3>
<p>Although the default menu title is <strong>AutoConnect</strong>, you can change the title by setting <ahref="apiconfig.html#title">AutoConnectConfig::title</a>. To set the menu title properly, you must set before calling <ahref="api.html#begin">AutoConnect::begin</a>.</p>
<p>Although the default menu title is <strong>AutoConnect</strong>, you can change the title by setting <ahref="apiconfig.html#title">AutoConnectConfig::title</a>. To set the menu title properly, you must set before calling <ahref="api.html#begin"><em>AutoConnect::begin</em></a>.</p>
@ -1293,7 +1293,7 @@ Sketch OTA update File system EEPROM WiFi config (SDK)
<p>Also, the placement of the EEPROM area of ESP32 is described in the <ahref="https://github.com/espressif/arduino-esp32/blob/master/tools/partitions/default.csv">partition table</a>. So in the default state, the credential storage area used by AutoConnect conflicts with data 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.html#boundaryoffset"><strong>boundaryOffset</strong></a> in <ahref="api.html#autoconnectconfig-api"><strong>AutoConnectConfig</strong></a> specifies the start offset of the credentials storage area. The default value is 0.</p>
<h3id="on-demand-start-the-captive-portal"><iclass="fa fa-caret-right"></i> On-demand start the captive portal<aclass="headerlink"href="#on-demand-start-the-captive-portal"title="Permanent link">¶</a></h3>
<p>If you do not usually connect to WiFi and need to establish a WiFi connection if necessary, you can combine the <ahref="api.html#autorise"><strong>autoRise</strong></a> option with the <ahref="api.html#immediatestart"><strong>immediateStart</strong></a> option to achieve on-demand connection. This behavior is similar to the <ahref="https://github.com/tzapu/WiFiManager#on-demand-configuration-portal">WiFiManager's startConfigPortal</a> function. In order to do this, you usually configure only with AutoConnectConfig in <em>setup()</em> and <ahref="api.html#begin"><em>AutoConnect::begin()</em></a> handles in <em>loop()</em>.</p>
<p>If you do not usually connect to WiFi and need to establish a WiFi connection if necessary, you can combine the <ahref="api.html#autorise"><strong>autoRise</strong></a> option with the <ahref="api.html#immediatestart"><strong>immediateStart</strong></a> option to achieve on-demand connection. This behavior is similar to the <ahref="https://github.com/tzapu/WiFiManager#on-demand-configuration-portal">WiFiManager's startConfigPortal</a> function. In order to do this, you usually configure only with AutoConnectConfig in <em>setup()</em> and <ahref="api.html#begin"><em>AutoConnect::begin</em></a> handles in <em>loop()</em>.</p>
@ -1314,7 +1314,7 @@ Sketch OTA update File system EEPROM WiFi config (SDK)
</pre></div>
The above example does not connect to WiFi until TRIGGER_PIN goes LOW. When TRIGGER_PIN goes LOW, the captive portal starts and you can connect to WiFi. Even if you reset the module, it will not automatically reconnect.</p>
<h3id="refers-the-hosted-esp8266webserverwebserver"><iclass="fa fa-caret-right"></i> Refers the hosted ESP8266WebServer/WebServer<aclass="headerlink"href="#refers-the-hosted-esp8266webserverwebserver"title="Permanent link">¶</a></h3>
<p>Constructing an AutoConnect object variable without parameters then creates and starts an ESP8266WebServer/WebServer inside the AutoConnect. This object variable could be referred by <ahref="api.html#host"><em>AutoConnect::host()</em></a> function to access ESP8266WebServer/WebServer instance as like below.</p>
<p>Constructing an AutoConnect object variable without parameters then creates and starts an ESP8266WebServer/WebServer inside the AutoConnect. This object variable could be referred by <ahref="api.html#host"><em>AutoConnect::host</em></a> function to access ESP8266WebServer/WebServer instance as like below.</p>
@ -1386,22 +1386,24 @@ The above example does not connect to WiFi until TRIGGER_PIN goes LOW. When TRIG
<li>Channel.</li>
<li>SoftAP name.</li>
<li>Hidden attribute.</li>
<li>Station hostname.</li>
<li>Auto save credential.</li>
<li>Offset address of the credentials storage area in EEPROM.</li>
<li>Captive portal time out limit.</li>
<li>Retains the portal function after time out.</li>
<li>Maintain portal function even after a timeout.</li>
<li>Length of start up time after reset.</li>
<li>Automatic starting the captive portal.</li>
<li>Start the captive portal forcefully.</li>
<li>Auto reset after connection establishment.</li>
<li>Home URL of the user sketch application.</li>
<li>Menu title.</li>
</ul>
<divclass="admonition note">
<pclass="admonition-title">AutoConnect::config before AutoConnect::begin</p>
<p><em>AutoConnect::config</em> must be executed before <em>AutoConnect::begin</em>.</p>
</div>
<h3id="assign-user-sketchs-home-path"><iclass="fa fa-caret-right"></i> Assign user sketch's home path<aclass="headerlink"href="#assign-user-sketchs-home-path"title="Permanent link">¶</a></h3>
<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 <ahref="api.html#home"><em>AutoConnect::home</em></a> function.</p>
<p><strong>HOME</strong> for returning to the user's sketch homepage will display at the bottom of the AutoConnect menu. It could be set using the <ahref="api.html#home"><em>AutoConnect::home</em></a> function.</p>
<p><imgsrc="./images/menu_home.png"/></p>
<h3id="relocate-the-autoconnect-home-path"><iclass="fa fa-caret-right"></i> Relocate the AutoConnect home path<aclass="headerlink"href="#relocate-the-autoconnect-home-path"title="Permanent link">¶</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 <ahref="https://github.com/Hieromon/AutoConnect/blob/master/src/AutoConnect.h#L58"><strong>AUTOCONNECT_URI</strong></a> macro in the include header file as <ahref="https://github.com/Hieromon/AutoConnect/blob/master/src/AutoConnect.h">AutoConnect.h</a>.</p>
@ -1430,6 +1432,12 @@ The above example does not connect to WiFi until TRIGGER_PIN goes LOW. When TRIG
</pre></div>
<h3id="station-host-name"><iclass="fa fa-caret-right"></i> Station host name<aclass="headerlink"href="#station-host-name"title="Permanent link">¶</a></h3>
<p><ahref="apiconfig.html#hostname">AutoConnectConfig::hostName</a> assigns the station DHCP hostname which complies with <ahref="https://tools.ietf.org/html/rfc952">RFC952</a>. It must satisfy the following constraints.</p>
<ul>
<li>Up to 24 characters</li>
<li>Only the alphabet (a-z, A-Z), digits (0-9), minus sign (-)</li>
<ahref="#easy-to-add-the-custom-web-screens-enhanced-wv097"title=" Easy to add the custom Web screens ENHANCED w/v0.9.7"class="md-nav__link">
Easy to add the custom Web screens ENHANCED w/v0.9.7
<ahref="#easy-to-add-the-custom-web-pages-enhanced-wv097"title=" Easy to add the custom Web pages ENHANCED w/v0.9.7"class="md-nav__link">
Easy to add the custom Web pages ENHANCED w/v0.9.7
</a>
</li>
@ -848,8 +848,8 @@
</li>
<liclass="md-nav__item">
<ahref="#easy-to-add-the-custom-web-screens-enhanced-wv097"title=" Easy to add the custom Web screens ENHANCED w/v0.9.7"class="md-nav__link">
Easy to add the custom Web screens ENHANCED w/v0.9.7
<ahref="#easy-to-add-the-custom-web-pages-enhanced-wv097"title=" Easy to add the custom Web pages ENHANCED w/v0.9.7"class="md-nav__link">
Easy to add the custom Web pages ENHANCED w/v0.9.7
</a>
</li>
@ -939,7 +939,7 @@ Easy implementing the Web interface constituting the WLAN for ESP8266/ESP32 WiFi
<p><spanclass="lead">AutoConnect can be placed easily in your sketch. It's "<strong>begin</strong>" and "<strong>handleClient</strong>" only.</span></p>
<h3id="lives-with-your-sketches"><iclass="fa fa-arrow-circle-right"aria-hidden="true"></i> Lives with your sketches<aclass="headerlink"href="#lives-with-your-sketches"title="Permanent link">¶</a></h3>
<p><spanclass="lead">The sketches which provide the web page using ESP8266WebServer there is, AutoConnect will not disturb it. AutoConnect can use an already instantiated ESP8266WebServer object, or itself can assign it. This effect also applies to ESP32. The corresponding class for ESP32 will be the WebServer.</span></p>
<h3id="easy-to-add-the-custom-web-screens-enhanced-wv097"><iclass="fa fa-arrow-circle-right"aria-hidden="true"></i> Easy to add the <ahref="acintro.html">custom Web screens</a><sup><sub>ENHANCED w/v0.9.7</sub></sup><aclass="headerlink"href="#easy-to-add-the-custom-web-screens-enhanced-wv097"title="Permanent link">¶</a></h3>
<h3id="easy-to-add-the-custom-web-pages-enhanced-wv097"><iclass="fa fa-arrow-circle-right"aria-hidden="true"></i> Easy to add the <ahref="acintro.html">custom Web pages</a><sup><sub>ENHANCED w/v0.9.7</sub></sup><aclass="headerlink"href="#easy-to-add-the-custom-web-pages-enhanced-wv097"title="Permanent link">¶</a></h3>
<p><spanclass="lead">You can easily add your owned web screens that can consist of representative HTML elements and invoke them from the menu. Further it possible importing the custom Web pages declarations described with JSON which stored in PROGMEM, SPIFFS, or SD.</span></p>
<p>You can extend the AutoConnect menu to match legacy sketches and according to the procedure described in the sectio <ahref="advancedusage.html#cast-the-legacy-html-pages-as-the-add-on-menu-items"><em>Advanced Usage</em></a>.</p>
<p>You can extend the AutoConnect menu to improve the original sketches and according to the procedure described in section<ahref="advancedusage.html#casts-the-html-pages-to-be-add-on-into-the-menu">Advanced Usage section</a>.</p>