@ -1354,7 +1354,7 @@ Also, if you want to stop AutoConnect completely when the captive portal is time
<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>
<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>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>
<p>To implement embedding your legacy web pages to the AutoConnect menu, 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>
<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>Declare AutoConnectAux for each legacy page. It includes the URI of the page and item string which will display in the AutoConnect menu.</li>
<dd>Save the specified SSID's credential entry to station_config pointed to by the parameter as <strong>config</strong>. -1 is returned if the SSID is not saved. </dd>
<dd>Save the specified SSID's credential entry to station_config_t pointed to by the parameter as <strong>config</strong>. -1 is returned if the SSID is not saved. </dd>
<dd>Save the specified credential entry to station_config pointed to by the parameter as <strong>config</strong>. -1 is returned if specified number is not saved. </dd>
<dd>Save the specified credential entry to station_config_t pointed to by the parameter as <strong>config</strong>. -1 is returned if specified number is not saved. </dd>
<pclass="admonition-title">The byte size of station_config_t in program memory and stored credentials is different</p>
<p>There is a gap byte for boundary alignment between the <code>dhcp</code> member and the static IP members of the above station_config_t. Its gap byte will be removed with saved credentials on the flash.</p>
</div>
<h3id="the-credential-entry"><iclass="fa fa-code"></i> The credential entry<aclass="headerlink"href="#the-credential-entry"title="Permanent link">¶</a></h3>
<h3id="the-credential-entry"><iclass="fa fa-code"></i> The credential entry<aclass="headerlink"href="#the-credential-entry"title="Permanent link">¶</a></h3>
<p>A data structure of the credential saving area in EEPROM as the below. <supid="fnref:4"><aclass="footnote-ref"href="#fn:4"rel="footnote">4</a></sup></p>
<p>A data structure of the credential saving area in EEPROM as the below. <supid="fnref:4"><aclass="footnote-ref"href="#fn:4"rel="footnote">4</a></sup></p>
<table>
<table>
<thead>
<thead>
<tr>
<tr>
<th>Byte offset</th>
<th>byte offset</th>
<th>Length</th>
<th>Length</th>
<th>Value</th>
<th>Value</th>
</tr>
</tr>
@ -1197,8 +1206,43 @@ The following function is an implementation example, and you can use it to achie
</tr>
</tr>
<tr>
<tr>
<td>variable</td>
<td>variable</td>
<td>1</td>
<td>Flag for DHCP or Static IP (0:DHCP, 1:Static IP)</td>
</tr>
<tr>
<td><tdcolspan=3>The following IP address entries are stored only for static IPs.</td>
<td></td>
<td></td>
<td></td>
<td>Contained the next entries. (Continuation SSID+Password+BSSID)</td>
</tr>
<tr>
<td>variable(1)</td>
<td>4</td>
<td>Station IP address (uint32_t)</td>
</tr>
<tr>
<td>variable(5)</td>
<td>4</td>
<td>Gateway address (uint32_t)</td>
</tr>
<tr>
<td>variable(9)</td>
<td>4</td>
<td>Netmask (uint32_t)</td>
</tr>
<tr>
<td>variable(13)</td>
<td>4</td>
<td>Primary DNS address (uint32_t)</td>
</tr>
<tr>
<td>variable(17)</td>
<td>4</td>
<td>Secondary IP address (uint32_t)</td>
</tr>
<tr>
<td>variable</td>
<td>variable</td>
<td>Contained the next entries. (Continuation SSID+Password+BSSID+DHCP flag+Static IPs(if exists))</td>
</tr>
</tr>
<tr>
<tr>
<td>variable</td>
<td>variable</td>
@ -1207,6 +1251,12 @@ The following function is an implementation example, and you can use it to achie
</tr>
</tr>
</tbody>
</tbody>
</table>
</table>
<divclass="admonition note">
<pclass="admonition-title">AutoConnectCredential has changed</p>
<p>It was lost AutoConnectCredential backward compatibility. Credentials saved by AutoConnect v1.0.3 (or earlier) will not work properly with AutoConnect v1.1.0. You need to erase the flash of the ESP module using the esptool before the sketch uploading.
<ahref="#saved-credentials-are-wrong-or-lost"title=" Saved credentials are wrong or lost."class="md-nav__link">
Saved credentials are wrong or lost.
</a>
</li>
<liclass="md-nav__item">
<ahref="#some-autoconnect-page-is-cut-off"title=" Some AutoConnect page is cut off."class="md-nav__link">
Some AutoConnect page is cut off.
</a>
</li>
</li>
<liclass="md-nav__item">
<liclass="md-nav__item">
@ -1124,6 +1138,20 @@
I cannot see the custom Web page.
I cannot see the custom Web page.
</a>
</a>
</li>
<liclass="md-nav__item">
<ahref="#saved-credentials-are-wrong-or-lost"title=" Saved credentials are wrong or lost."class="md-nav__link">
Saved credentials are wrong or lost.
</a>
</li>
<liclass="md-nav__item">
<ahref="#some-autoconnect-page-is-cut-off"title=" Some AutoConnect page is cut off."class="md-nav__link">
Some AutoConnect page is cut off.
</a>
</li>
</li>
<liclass="md-nav__item">
<liclass="md-nav__item">
@ -1361,6 +1389,22 @@ wdt reset
<p>Because AutoConnect does not send a login success response to the captive portal requests from the smartphone. The login success response varies iOS, Android and Windows. By analyzing the request URL of different login success inquiries for each OS, the correct behavior can be implemented, but not yet. Please resets ESP8266 from the AutoConnect menu.</p>
<p>Because AutoConnect does not send a login success response to the captive portal requests from the smartphone. The login success response varies iOS, Android and Windows. By analyzing the request URL of different login success inquiries for each OS, the correct behavior can be implemented, but not yet. Please resets ESP8266 from the AutoConnect menu.</p>
<h2id="i-cannot-see-the-custom-web-page"><iclass="fa fa-question-circle"></i> I cannot see the custom Web page.<aclass="headerlink"href="#i-cannot-see-the-custom-web-page"title="Permanent link">¶</a></h2>
<h2id="i-cannot-see-the-custom-web-page"><iclass="fa fa-question-circle"></i> I cannot see the custom Web page.<aclass="headerlink"href="#i-cannot-see-the-custom-web-page"title="Permanent link">¶</a></h2>
<p>If the sketch is correct, a JSON syntax error may have occurred. In this case, activate the <ahref="faq.html#3-turn-on-the-debug-log-options">AC_DEBUG</a> and rerun. If you take the message of JSON syntax error, the <ahref="https://arduinojson.org/v5/assistant/">Json Assistant</a> helps syntax checking. This online tool is provided by the author of ArduinoJson and is most consistent for the AutoConnect. </p>
<p>If the sketch is correct, a JSON syntax error may have occurred. In this case, activate the <ahref="faq.html#3-turn-on-the-debug-log-options">AC_DEBUG</a> and rerun. If you take the message of JSON syntax error, the <ahref="https://arduinojson.org/v5/assistant/">Json Assistant</a> helps syntax checking. This online tool is provided by the author of ArduinoJson and is most consistent for the AutoConnect. </p>
<h2id="saved-credentials-are-wrong-or-lost"><iclass="fa fa-question-circle"></i> Saved credentials are wrong or lost.<aclass="headerlink"href="#saved-credentials-are-wrong-or-lost"title="Permanent link">¶</a></h2>
<p>A structure of AutoConnect saved credentials has changed two times throughout enhancement with v1.0.3 and v1.1.0. In particular, due to enhancements in v1.1.0, AutoConnectCredential data structure has lost the backward compatibility with previous versions. You must erase the flash of the ESP module using the esptool completely to save the credentials correctly with v1.1.0.
<h2id="some-autoconnect-page-is-cut-off"><iclass="fa fa-question-circle"></i> Some AutoConnect page is cut off.<aclass="headerlink"href="#some-autoconnect-page-is-cut-off"title="Permanent link">¶</a></h2>
<p>It may be two possibilities as follows:</p>
<ol>
<li>Packet loss during transmission due to a too weak WiFi signal.</li>
<li>Heap is insufficient memory. AutoConnect entrusts HTML generation to PageBuilder that makes heavy use the String::concatenate function and causes memory fragmentation. This is a structural problem with PageBuilder, but it is difficult to solve immediately.</li>
</ol>
<p>If this issue produces with your sketch, Reloading the page may recover.<br/>
Also, you can check the memory running out status by rebuilding the sketch with <ahref="faq.html#fn:2">PageBuilder's debug log option</a> turned on.</p>
<p>If the heap memory is insufficient, the following message is displayed on the serial console.</p>
<divclass="codehilite"style="background: #272822"><prestyle="line-height: 125%"><span></span>[PB] Failed building, free heap:<Size of free heap>
</pre></div>
<h2id="submit-element-in-a-custom-web-page-does-not-react"><iclass="fa fa-question-circle"></i> Submit element in a custom Web page does not react.<aclass="headerlink"href="#submit-element-in-a-custom-web-page-does-not-react"title="Permanent link">¶</a></h2>
<h2id="submit-element-in-a-custom-web-page-does-not-react"><iclass="fa fa-question-circle"></i> Submit element in a custom Web page does not react.<aclass="headerlink"href="#submit-element-in-a-custom-web-page-does-not-react"title="Permanent link">¶</a></h2>
<p>Is there the AutoConnectElements element named <strong>SUBMIT</strong> in the custom Web page? (case sensitive ignored) AutoConnect does not rely on the <code>input type=submit</code> element for the form submission and uses <ahref="https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/submit">HTML form element submit</a> function instead. So, the submit function will fail if there is an element named 'submit' in the form. You can not use <strong>SUBMIT</strong> as the element name of AutoConnectElements in a custom Web page that declares the AutoConnectSubmit element.</p>
<p>Is there the AutoConnectElements element named <strong>SUBMIT</strong> in the custom Web page? (case sensitive ignored) AutoConnect does not rely on the <code>input type=submit</code> element for the form submission and uses <ahref="https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/submit">HTML form element submit</a> function instead. So, the submit function will fail if there is an element named 'submit' in the form. You can not use <strong>SUBMIT</strong> as the element name of AutoConnectElements in a custom Web page that declares the AutoConnectSubmit element.</p>
<h2id="still-not-stable-with-my-sketch"><iclass="fa fa-question-circle"></i> Still, not stable with my sketch.<aclass="headerlink"href="#still-not-stable-with-my-sketch"title="Permanent link">¶</a></h2>
<h2id="still-not-stable-with-my-sketch"><iclass="fa fa-question-circle"></i> Still, not stable with my sketch.<aclass="headerlink"href="#still-not-stable-with-my-sketch"title="Permanent link">¶</a></h2>
<h3id="join-to-the-new-access-point"><iclass="fa fa-cog"></i> Join to the new access point<aclass="headerlink"href="#join-to-the-new-access-point"title="Permanent link">¶</a></h3>
<h3id="join-to-the-new-access-point"><iclass="fa fa-cog"></i> Join to the new access point<aclass="headerlink"href="#join-to-the-new-access-point"title="Permanent link">¶</a></h3>
<p>Here, tap <em>"Configure new AP"</em> to connect the new access point then the SSID configuration screen would be shown. Enter the <strong>SSID</strong> and <strong>Passphrase</strong> and tap <strong>apply</strong> to start connecting the access point.</p>
<p>Here, tap <em>"Configure new AP"</em> to connect the new access point then the SSID configuration screen would be shown. Enter the <strong>SSID</strong> and <strong>Passphrase</strong> and tap <strong>apply</strong> to start connecting the access point.</p>
<p>After connection established, the current status screen will appear. It is already connected to WLAN with WiFi mode as WIFI_AP_STA and the IP connection status is displayed there including the SSID. Then at this screen, you have two options for the next step.</p>
<p>After connection established, the current status screen will appear. It is already connected to WLAN with WiFi mode as WIFI_AP_STA and the IP connection status is displayed there including the SSID. Then at this screen, you have two options for the next step.</p>
<p>For one, continues execution of the sketch while keeping this connection. You can access ESP8266 via browser through the established IP address after cancel to "<strong>Log in</strong>" by upper right on the screen.<br/>
<p>For one, continues execution of the sketch while keeping this connection. You can access ESP8266 via browser through the established IP address after cancel to "<strong>Log in</strong>" by upper right on the screen.<br/>
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.17499995px;line-height:1.25;font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="79.585876"
y="-32.471371"
id="text9138-7-3-9-9-90-9"><tspan
sodipodi:role="line"
id="tspan1283"
x="79.585876"
y="-32.471371">Loads saved credentials from the flash</tspan><tspan
sodipodi:role="line"
id="tspan1285"
x="79.585876"
y="-28.502621">that matches the last SSID stored in</tspan><tspan
<ahref="#by-attaching-autoconnect-menu"title=" by attaching AutoConnect menu"class="md-nav__link">
<ahref="#attaching-to-autoconnect-menu"title=" Attaching to AutoConnect menu"class="md-nav__link">
by attaching AutoConnect menu
Attaching to AutoConnect menu
</a>
</a>
</li>
</li>
@ -886,8 +886,8 @@
</li>
</li>
<liclass="md-nav__item">
<liclass="md-nav__item">
<ahref="#by-attaching-autoconnect-menu"title=" by attaching AutoConnect menu"class="md-nav__link">
<ahref="#attaching-to-autoconnect-menu"title=" Attaching to AutoConnect menu"class="md-nav__link">
by attaching AutoConnect menu
Attaching to AutoConnect menu
</a>
</a>
</li>
</li>
@ -916,11 +916,11 @@
<p>The AutoConnect menu is developed using the <ahref="https://github.com/balzss/luxbar">LuxBar</a> which is licensed under the MIT License. See the <ahref="license.html">License</a>.</p>
<p>The AutoConnect menu is developed using the <ahref="https://github.com/balzss/luxbar">LuxBar</a> which is licensed under the MIT License. See the <ahref="license.html">License</a>.</p>
</div>
</div>
<h2id="where-the-from"><iclass="fa fa-external-link"></i> Where the from<aclass="headerlink"href="#where-the-from"title="Permanent link">¶</a></h2>
<h2id="where-the-from"><iclass="fa fa-external-link"></i> Where the from<aclass="headerlink"href="#where-the-from"title="Permanent link">¶</a></h2>
<p>The AutoConnect menu appears when you access the<strong>AutoConnect root path</strong>. It is assigned "<strong>/_ac</strong>" located on the <em>local IP address</em> of ESP8266/ESP32 module by default. This location can be changed in the sketch. The following screen will appear at access to<code>http://{localIP}/_ac</code> as the root path. This is the statistics of the current WiFi connection. You can access the menu from the here, to invoke it tap <iclass="fa fa-bars"></i> at right on top. (e.g. <code>http://172.217.28.1/_ac</code> for SoftAP mode.)</p>
<p>The following screen will appear as the AutoConnect menu when you access to<strong>AutoConnect root URL</strong> via <code>http://{localIP}/_ac</code>. (eg.<code>http://172.217.28.1/_ac</code>) It is a top page of AutoConnect which shows the current WiFi connection statistics. To invoke the AutoConnect menu, you can t tap <iclass="fa fa-bars"></i> at right on top.</p>
<p>A local IP means Local IP at connection established or SoftAP's IP.</p>
<p>It is assigned "<strong>/_ac</strong>" located on the <em>local IP address</em> of ESP8266/ESP32 module by default and can be changed with the sketch. A local IP means Local IP at connection established or SoftAP's IP.</p>
</div>
</div>
<h2id="right-on-top"><iclass="fa fa-bars"></i> Right on top<aclass="headerlink"href="#right-on-top"title="Permanent link">¶</a></h2>
<h2id="right-on-top"><iclass="fa fa-bars"></i> Right on top<aclass="headerlink"href="#right-on-top"title="Permanent link">¶</a></h2>
<p>Currently, AutoConnect supports four menus. Undermost menu as "HOME" returns to the home path of its sketch.</p>
<p>Currently, AutoConnect supports four menus. Undermost menu as "HOME" returns to the home path of its sketch.</p>
<h2id="configure-new-ap"><iclass="fa fa-bars"></i> Configure new AP<aclass="headerlink"href="#configure-new-ap"title="Permanent link">¶</a></h2>
<h2id="configure-new-ap"><iclass="fa fa-bars"></i> Configure new AP<aclass="headerlink"href="#configure-new-ap"title="Permanent link">¶</a></h2>
<p>Scan all available access point in the vicinity and display it. Strength and security of the detected AP are marked. The<iclass="fa fa-lock"></i>is indicated for the SSID that needs a security key. "<strong>Hidden:</strong>" means the number of hidden SSIDs discovered.<br/>
<p>It scans all available access points in the vicinity and display it further the WiFi signal strength and security indicator as<iclass="fa fa-lock"></i>of the detected AP. Below that, the number of discovered hidden APs will be displayed.
Enter SSID and Passphrase and tap "<strong>apply</strong>" to starts WiFi connection. </p>
Enter SSID and Passphrase and tap "<strong>Apply</strong>" to start a WiFi connection. </p>
<p>If you want to configure with static IP, uncheck "<strong>Enable DHCP</strong>". Once the WiFi connection is established, the entered static IP<supid="fnref:1"><aclass="footnote-ref"href="#fn:1"rel="footnote">1</a></sup> configuration will be stored to the credentials in the flash and restored to the station configuration via the <ahref="#open-ssids">Open SSIDs</a> menu.</p>
<h2id="open-ssids"><iclass="fa fa-bars"></i> Open SSIDs<aclass="headerlink"href="#open-ssids"title="Permanent link">¶</a></h2>
<h2id="open-ssids"><iclass="fa fa-bars"></i> Open SSIDs<aclass="headerlink"href="#open-ssids"title="Permanent link">¶</a></h2>
<p>Once it was established WiFi connection, its SSID and password will be saved in the flash of ESP8266/ESP32 automatically. The <strong>Open SSIDs</strong> menu reads the saved SSID credentials from the flash. The stored credential data are listed by the SSID as shown below. Its label is a clickable button. Tap the SSID button, starts WiFi connection it.</p>
<p>After WiFi connected, AutoConnect will automatically save the established SSID and password to the flash on the ESP module.<strong>Open SSIDs</strong> menu reads the saved SSID credentials and lists them as below. Listed items are clickable buttons and can initiate a connection to its access point.</p>
<pclass="admonition-title">Saved credentials data structure has changed</p>
<p>A structure of AutoConnect saved credentials has changed in v1.1.0 and was lost backward compatibility. Credentials saved by AutoConnect v1.0.3 (or earlier) will not display properly with AutoConnect v1.1.0. You need to erase the flash of the ESP module using the esptool before the sketch uploading.
<p>Disconnect ESP8266/ESP32 from the current connection. It can also reset the ESP8266/ESP32 automatically after disconnection by instructing with using <ahref="api.html#autoreset">API</a> in the sketch.</p>
<p>It disconnects ESP8266/ESP32 from the current connection. Also, ESP8266/ESP32 can be automatically reset after WiFi cutting by instructing with the sketch using the<ahref="api.html#autoreset">AutoConnect API</a>.</p>
<p>After tapping "Disconnect", you will not be able to reach the AutoConnect menu. Once disconnected, you will need to set the SSID again for connecting the WLAN. </p>
<p>After tapping the <strong>Disconnect</strong>, you will not be able to reach the AutoConnect menu. Once disconnected, you will need to set the SSID again for connecting to the WLAN. </p>
<p>Reset the ESP8266/ESP32 module, it will start rebooting. After rebooting complete, the ESP8266/ESP32 module begins establishing the previous connection with WIFI_STA mode, and <em>esp8266ap</em> or <em>esp32ap</em> of an access point will disappear from WLAN.</p>
<p>Resetting the ESP8266/ESP32 module will initiate a reboot. When the module restarting, the<em>esp8266ap</em> or <em>esp32ap</em> access point will disappear from the WLAN and the ESP8266/ESP32 module will begin to reconnect a previous access point with WIFI_STA mode.</p>
<pclass="admonition-title">Not every ESP8266 module will be rebooted normally</p>
<pclass="admonition-title">Not every ESP8266 module will be rebooted normally</p>
<p>The Reset menu is using the <strong>ESP.reset()</strong> function for ESP8266. This is an almost hardware reset. In order to resume the sketch normally, the <ahref="https://github.com/esp8266/esp8266-wiki/wiki/Boot-Process#esp-boot-modes">state of GPIO0</a> is important. Since this depends on the circuit implementation for each module, not every module will be rebooted normally. See also <ahref="faq.html#hang-up-after-reset">FAQ</a>.</p>
<p>The Reset menu is using the <strong>ESP.reset()</strong> function for ESP8266. This is an almost hardware reset. In order to resume the sketch normally, the <ahref="https://github.com/esp8266/esp8266-wiki/wiki/Boot-Process#esp-boot-modes">state of GPIO0</a> is important. Since this depends on the circuit implementation for each module, not every module will be rebooted normally. See also <ahref="faq.html#hang-up-after-reset">FAQ</a>.</p>
</div>
</div>
<h2id="custom-menu-items"><iclass="fa fa-bars"></i> Custom menu items<aclass="headerlink"href="#custom-menu-items"title="Permanent link">¶</a></h2>
<h2id="custom-menu-items"><iclass="fa fa-bars"></i> Custom menu items<aclass="headerlink"href="#custom-menu-items"title="Permanent link">¶</a></h2>
<p>The menu items of the custom Web page line up at the below in the AutoConnect menu if the custom Web pages are joined. Details for <ahref="acintro.html#custom-web-pages-in-autoconnectmenu">Custom Web pages in AutoConnect menu</a>.</p>
<p>If the sketch has custom Web pages, the AutoConnect menu lines them up with the AutoConnect's items. Details for <ahref="acintro.html#custom-web-pages-in-autoconnectmenu">Custom Web pages in AutoConnect menu</a>.</p>
<p>A <strong>HOME</strong> item located at the bottom of the menu list is a link to the home path. The URI as the home path is <code>/</code>by default, and it is defined by <code>AUTOCONNECT_HOMEURI</code>with<strong>AutoConnectDefs.h</strong> file.</p>
<p>A <strong>HOME</strong> item at the bottom of the menu list is a link to the home path, and the default URI is <code>/</code>which is defined by <code>AUTOCONNECT_HOMEURI</code>in<strong>AutoConnectDefs.h</strong> header file.</p>
<p>You can change the HOME path using the AutoConnect API. The <ahref="api.html#home"><strong>AutoConnect::home</strong></a> function sets the URI as a link of the HOME item of the AutoConnect menu.</p>
<p>Also, you can change the HOME path using the AutoConnect API. The <ahref="api.html#home"><strong>AutoConnect::home</strong></a> function sets the URI as a link of the HOME item in the AutoConnect menu.</p>
<h2id="attaching-to-autoconnect-menu"><iclass="fa fa-bars"></i>Attaching to AutoConnect menu<aclass="headerlink"href="#attaching-to-autoconnect-menu"title="Permanent link">¶</a></h2>
<p>The AutoConnect menu can contain HTML pages of your owns sketch as custom items. It works for HTML pages implemented by<strong>ESP8266WebServer::on</strong> handler or <strong>WebServer::on</strong> handler for ESP32. That is, you can make it as menu items to invoke the legacy web page. The below screenshot is the result of adding an example sketch for the ESP8266WebServer library known as <ahref="https://github.com/esp8266/Arduino/tree/master/libraries/ESP8266WebServer/examples/FSBrowser">FSBrowser</a> to the AutoConnect menu item. It adds Edit and List items with little modification to the legacy sketch code.</p>
<p>The AutoConnect menu can contain your sketch's web pages as extra items as a custom. It works for HTML pages implemented by the<strong>ESP8266WebServer::on</strong> handler or the<strong>WebServer::on</strong> handler for ESP32. That is, you can make them invoke the legacy web pages from the AutoConnect menu. The below screen-shot is the result of adding an example sketch for the ESP8266WebServer library known as <ahref="https://github.com/esp8266/Arduino/tree/master/libraries/ESP8266WebServer/examples/FSBrowser">FSBrowser</a> to the AutoConnect menu item. It can add Edit and List items with little modification to the legacy sketch code.</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"><em>Advanced Usage</em></a>.</p>
<p>You can improve your sketches by extending the AutoConnect menu by adding the legacy web pages according to the procedure described in section <ahref="advancedusage.html#casts-the-html-pages-to-be-add-on-into-the-menu"><em>Advanced Usage</em></a>.</p>
<divclass="footnote">
<hr/>
<ol>
<liid="fn:1">
<p>AutoConnect does not check the syntax and validity of the entered IP address. If the entered static IPs are incorrect, it cannot connect to the access point. <aclass="footnote-backref"href="#fnref:1"rev="footnote"title="Jump back to footnote 1 in the text">↩</a></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 [AutoConnectElements](acelements.md), this allows to legacy web pages registered by *ESP8266WebServer::on* or *WebServer::on* function.
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 [AutoConnectElements](acelements.md), this allows to legacy web pages registered by *ESP8266WebServer::on* or *WebServer::on* function.
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:
To implement embedding your legacy web pages to the AutoConnect menu, 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:
1. Declare AutoConnectAux for each legacy page. It includes the URI of the page and item string which will display in the AutoConnect menu.
1. Declare AutoConnectAux for each legacy page. It includes the URI of the page and item string which will display in the AutoConnect menu.
<dd>Save the specified SSID's credential entry to station_config pointed to by the parameter as **config**. -1 is returned if the SSID is not saved. </dd>
<dd>Save the specified SSID's credential entry to station_config_t pointed to by the parameter as **config**. -1 is returned if the SSID is not saved. </dd>
<dd>Save the specified credential entry to station_config pointed to by the parameter as **config**. -1 is returned if specified number is not saved. </dd>
<dd>Save the specified credential entry to station_config_t pointed to by the parameter as **config**. -1 is returned if specified number is not saved. </dd>
</dl>
</dl>
#### <iclass="fa fa-caret-right"></i> save
#### <iclass="fa fa-caret-right"></i> save
```cpp
```cpp
bool save(const struct station_config* config)
bool save(const station_config_t* config)
```
```
Save a credential entry.
Save a credential entry.
<dlclass="apidl">
<dlclass="apidl">
<dt>**Parameter**</dt>
<dt>**Parameter**</dt>
<dd><spanclass="apidef">config</span><spanclass="apidesc">station_config to be saved.</span></dd>
<dd><spanclass="apidef">config</span><spanclass="apidesc">station_config_t to be saved.</span></dd>
<dd><spanclass="apidef">false</span><spanclass="apidesc">Failed to save.</span></dd>
<dd><spanclass="apidef">false</span><spanclass="apidesc">Failed to save.</span></dd>
@ -142,7 +142,7 @@ Delete a credential the specified SSID.
```cpp
```cpp
void deleteAllCredentials(void) {
void deleteAllCredentials(void) {
AutoConnectCredential credential;
AutoConnectCredential credential;
struct station_config config;
station_config_t config;
uint8_t ent = credential.entries();
uint8_t ent = credential.entries();
while (ent--) {
while (ent--) {
@ -154,24 +154,31 @@ Delete a credential the specified SSID.
## The data structures
## The data structures
### <iclass="fa fa-code"></i> station_config
### <iclass="fa fa-code"></i> station_config_t
A structure is included in the ESP8266 SDK. You can use it in the sketch like as follows:
The saved credential structure is defined as stato_config_t in the AcutoConnectCredential header file.
```cpp
```cpp
extern "C" {
typedef struct {
#include<user_interface.h>
uint8_t ssid[32];
}
uint8_t password[64];
uint8_t bssid[6];
uint8_t dhcp; /**<0:DHCP,1:StaticIP*/
union _config {
uint32_t addr[5];
struct _sta {
uint32_t ip;
uint32_t gateway;
uint32_t netmask;
uint32_t dns1;
uint32_t dns2;
} sta;
} config;
} station_config_t;
```
```
```cpp
!!! note "The byte size of station_config_t in program memory and stored credentials is different"
struct station_config {
There is a gap byte for boundary alignment between the `dhcp` member and the static IP members of the above station_config_t. Its gap byte will be removed with saved credentials on the flash.
uint8 ssid[32];
uint8 password[64];
uint8 bssid_set;
uint8 bssid[6];
};
```
### <iclass="fa fa-code"></i> The credential entry
### <iclass="fa fa-code"></i> The credential entry
@ -180,13 +187,26 @@ A data structure of the credential saving area in EEPROM as the below. [^4]
[^4]:
[^4]:
There may be 0xff as an invalid data in the credential saving area. The 0xff area would be reused.
There may be 0xff as an invalid data in the credential saving area. The 0xff area would be reused.
| 9 | 2 | Container size, excluding size of AC_CREDT and size of the number of entries(width for uint16_t type). |
| 9 | 2 | Container size, excluding size of AC_CREDT and size of the number of entries(width for uint16_t type). |
| 11 | variable | SSID terminated by 0x00. Max length is 32 bytes. |
| 11 | variable | SSID terminated by 0x00. Max length is 32 bytes. |
| variable | variable | Password plain text terminated by 0x00. Max length is 64 bytes. |
| variable | variable | Password plain text terminated by 0x00. Max length is 64 bytes. |
| variable | 6 | BSSID |
| variable | 6 | BSSID |
| variable | | Contained the next entries. (Continuation SSID+Password+BSSID) |
| variable | 1 | Flag for DHCP or Static IP (0:DHCP, 1:Static IP) |
| <tdcolspan=3>The following IP address entries are stored only for static IPs.
| variable(1) | 4 | Station IP address (uint32_t) |
| variable(5) | 4 | Gateway address (uint32_t) |
| variable(9) | 4 | Netmask (uint32_t) |
| variable(13) | 4 | Primary DNS address (uint32_t) |
| variable(17) | 4 | Secondary IP address (uint32_t) |
| variable | variable | Contained the next entries. (Continuation SSID+Password+BSSID+DHCP flag+Static IPs(if exists)) |
| variable | 1 | 0x00. End of container. |
| variable | 1 | 0x00. End of container. |
!!! note "AutoConnectCredential has changed"
It was lost AutoConnectCredential backward compatibility. Credentials saved by AutoConnect v1.0.3 (or earlier) will not work properly with AutoConnect v1.1.0. You need to erase the flash of the ESP module using the esptool before the sketch uploading.
```
esptool -c esp8266 (or esp32) - p [COM_PORT] erase_flash
@ -180,6 +180,29 @@ Because AutoConnect does not send a login success response to the captive portal
If the sketch is correct, a JSON syntax error may have occurred. In this case, activate the [AC_DEBUG](faq.md#3-turn-on-the-debug-log-options) and rerun. If you take the message of JSON syntax error, the [Json Assistant](https://arduinojson.org/v5/assistant/) helps syntax checking. This online tool is provided by the author of ArduinoJson and is most consistent for the AutoConnect.
If the sketch is correct, a JSON syntax error may have occurred. In this case, activate the [AC_DEBUG](faq.md#3-turn-on-the-debug-log-options) and rerun. If you take the message of JSON syntax error, the [Json Assistant](https://arduinojson.org/v5/assistant/) helps syntax checking. This online tool is provided by the author of ArduinoJson and is most consistent for the AutoConnect.
## <iclass="fa fa-question-circle"></i> Saved credentials are wrong or lost.
A structure of AutoConnect saved credentials has changed two times throughout enhancement with v1.0.3 and v1.1.0. In particular, due to enhancements in v1.1.0, AutoConnectCredential data structure has lost the backward compatibility with previous versions. You must erase the flash of the ESP module using the esptool completely to save the credentials correctly with v1.1.0.
## <iclass="fa fa-question-circle"></i> Some AutoConnect page is cut off.
It may be two possibilities as follows:
1. Packet loss during transmission due to a too weak WiFi signal.
2. Heap is insufficient memory. AutoConnect entrusts HTML generation to PageBuilder that makes heavy use the String::concatenate function and causes memory fragmentation. This is a structural problem with PageBuilder, but it is difficult to solve immediately.
If this issue produces with your sketch, Reloading the page may recover.
Also, you can check the memory running out status by rebuilding the sketch with [PageBuilder's debug log option](faq.md#fn:2) turned on.
If the heap memory is insufficient, the following message is displayed on the serial console.
```
[PB] Failed building, free heap:<Sizeoffreeheap>
```
## <iclass="fa fa-question-circle"></i> Submit element in a custom Web page does not react.
## <iclass="fa fa-question-circle"></i> Submit element in a custom Web page does not react.
Is there the AutoConnectElements element named **SUBMIT** in the custom Web page? (case sensitive ignored) AutoConnect does not rely on the `input type=submit` element for the form submission and uses [HTML form element submit](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/submit) function instead. So, the submit function will fail if there is an element named 'submit' in the form. You can not use **SUBMIT** as the element name of AutoConnectElements in a custom Web page that declares the AutoConnectSubmit element.
Is there the AutoConnectElements element named **SUBMIT** in the custom Web page? (case sensitive ignored) AutoConnect does not rely on the `input type=submit` element for the form submission and uses [HTML form element submit](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/submit) function instead. So, the submit function will fail if there is an element named 'submit' in the form. You can not use **SUBMIT** as the element name of AutoConnectElements in a custom Web page that declares the AutoConnectSubmit element.
After connection established, the current status screen will appear. It is already connected to WLAN with WiFi mode as WIFI\_AP\_STA and the IP connection status is displayed there including the SSID. Then at this screen, you have two options for the next step.
After connection established, the current status screen will appear. It is already connected to WLAN with WiFi mode as WIFI\_AP\_STA and the IP connection status is displayed there including the SSID. Then at this screen, you have two options for the next step.
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.17499995px;line-height:1.25;font-family:'Times New Roman';-inkscape-font-specification:'Times New Roman, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-feature-settings:normal;text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
x="79.585876"
y="-32.471371"
id="text9138-7-3-9-9-90-9"><tspan
sodipodi:role="line"
id="tspan1283"
x="79.585876"
y="-32.471371">Loads saved credentials from the flash</tspan><tspan
sodipodi:role="line"
id="tspan1285"
x="79.585876"
y="-28.502621">that matches the last SSID stored in</tspan><tspan
## <iclass="fa fa-external-link"></i> Where the from
## <iclass="fa fa-external-link"></i> Where the from
The AutoConnect menu appears when you access the **AutoConnect root path**. It is assigned "**/_ac**" located on the *local IP address* of ESP8266/ESP32 module by default. This location can be changed in the sketch. The following screen will appear at access to `http://{localIP}/_ac` as the root path. This is the statistics of the current WiFi connection. You can access the menu from the here, to invoke it tap <iclass="fa fa-bars"></i> at right on top. (e.g. `http://172.217.28.1/_ac` for SoftAP mode.)
The following screen will appear as the AutoConnect menu when you access to **AutoConnect root URL** via `http://{localIP}/_ac`. (eg. `http://172.217.28.1/_ac`) It is a top page of AutoConnect which shows the current WiFi connection statistics. To invoke the AutoConnect menu, you can t tap <iclass="fa fa-bars"></i> at right on top.
A local IP means Local IP at connection established or SoftAP's IP.
It is assigned "**/_ac**" located on the *local IP address* of ESP8266/ESP32 module by default and can be changed with the sketch. A local IP means Local IP at connection established or SoftAP's IP.
## <iclass="fa fa-bars"></i> Right on top
## <iclass="fa fa-bars"></i> Right on top
@ -24,26 +24,38 @@ Currently, AutoConnect supports four menus. Undermost menu as "HOME" returns to
## <iclass="fa fa-bars"></i> Configure new AP
## <iclass="fa fa-bars"></i> Configure new AP
Scan all available access point in the vicinity and display it. Strength and security of the detected AP are marked. The<iclass="fa fa-lock"></i>is indicated for the SSID that needs a security key. "**Hidden:**" means the number of hidden SSIDs discovered.
It scans all available access points in the vicinity and display it further the WiFi signal strength and security indicator as<iclass="fa fa-lock"></i>of the detected AP. Below that, the number of discovered hidden APs will be displayed.
Enter SSID and Passphrase and tap "**apply**" to starts WiFi connection.
Enter SSID and Passphrase and tap "**Apply**" to start a WiFi connection.
If you want to configure with static IP, uncheck "**Enable DHCP**". Once the WiFi connection is established, the entered static IP[^1] configuration will be stored to the credentials in the flash and restored to the station configuration via the [Open SSIDs](#open-ssids) menu.
[^1]: AutoConnect does not check the syntax and validity of the entered IP address. If the entered static IPs are incorrect, it cannot connect to the access point.
Once it was established WiFi connection, its SSID and password will be saved in the flash of ESP8266/ESP32 automatically. The **Open SSIDs** menu reads the saved SSID credentials from the flash. The stored credential data are listed by the SSID as shown below. Its label is a clickable button. Tap the SSID button, starts WiFi connection it.
After WiFi connected, AutoConnect will automatically save the established SSID and password to the flash on the ESP module. **Open SSIDs** menu reads the saved SSID credentials and lists them as below. Listed items are clickable buttons and can initiate a connection to its access point.
!!! note "Saved credentials data structure has changed"
A structure of AutoConnect saved credentials has changed in v1.1.0 and was lost backward compatibility. Credentials saved by AutoConnect v1.0.3 (or earlier) will not display properly with AutoConnect v1.1.0. You need to erase the flash of the ESP module using the esptool before the sketch uploading.
```
esptool -c esp8266 (or esp32) - p [COM_PORT] erase_flash
```
## <iclass="fa fa-bars"></i> Disconnect
## <iclass="fa fa-bars"></i> Disconnect
Disconnect ESP8266/ESP32 from the current connection. It can also reset the ESP8266/ESP32 automatically after disconnection by instructing with using [API](api.md#autoreset) in the sketch.
It disconnects ESP8266/ESP32 from the current connection. Also, ESP8266/ESP32 can be automatically reset after WiFi cutting by instructing with the sketch using the [AutoConnect API](api.md#autoreset).
After tapping "Disconnect", you will not be able to reach the AutoConnect menu. Once disconnected, you will need to set the SSID again for connecting the WLAN.
After tapping the **Disconnect**, you will not be able to reach the AutoConnect menu. Once disconnected, you will need to set the SSID again for connecting to the WLAN.
## <iclass="fa fa-bars"></i> Reset...
## <iclass="fa fa-bars"></i> Reset...
Reset the ESP8266/ESP32 module, it will start rebooting. After rebooting complete, the ESP8266/ESP32 module begins establishing the previous connection with WIFI_STA mode, and*esp8266ap* or *esp32ap*of an access point will disappear from WLAN.
Resetting the ESP8266/ESP32 module will initiate a reboot. When the module restarting, the*esp8266ap* or *esp32ap* access point will disappear from the WLAN and the ESP8266/ESP32 module will begin to reconnect a previous access point with WIFI_STA mode.
@ -52,23 +64,23 @@ Reset the ESP8266/ESP32 module, it will start rebooting. After rebooting complet
## <iclass="fa fa-bars"></i> Custom menu items
## <iclass="fa fa-bars"></i> Custom menu items
The menu items of the custom Web page line up at the below in the AutoConnect menu if the custom Web pages are joined. Details for [Custom Web pages in AutoConnect menu](acintro.md#custom-web-pages-in-autoconnectmenu).
If the sketch has custom Web pages, the AutoConnect menu lines them up with the AutoConnect's items. Details for [Custom Web pages in AutoConnect menu](acintro.md#custom-web-pages-in-autoconnectmenu).
## <iclass="fa fa-bars"></i> HOME
## <iclass="fa fa-bars"></i> HOME
A **HOME** item located at the bottom of the menu list is a link to the home path. The URI as the home path is `/` by default, and it is defined by `AUTOCONNECT_HOMEURI` with **AutoConnectDefs.h** file.
A **HOME** item at the bottom of the menu list is a link to the home path, and the default URI is `/` which is defined by `AUTOCONNECT_HOMEURI` in **AutoConnectDefs.h** header file.
```cpp
```cpp
#define AUTOCONNECT_HOMEURI "/"
#define AUTOCONNECT_HOMEURI "/"
```
```
You can change the HOME path using the AutoConnect API. The [**AutoConnect::home**](api.md#home) function sets the URI as a link of the HOME item of the AutoConnect menu.
Also, you can change the HOME path using the AutoConnect API. The [**AutoConnect::home**](api.md#home) function sets the URI as a link of the HOME item in the AutoConnect menu.
## <iclass="fa fa-bars"></i>by attaching AutoConnect menu
## <iclass="fa fa-bars"></i>Attaching to AutoConnect menu
The AutoConnect menu can contain HTML pages of your owns sketch as custom items. It works for HTML pages implemented by**ESP8266WebServer::on** handler or **WebServer::on** handler for ESP32. That is, you can make it as menu items to invoke the legacy web page. The below screenshot is the result of adding an example sketch for the ESP8266WebServer library known as [FSBrowser](https://github.com/esp8266/Arduino/tree/master/libraries/ESP8266WebServer/examples/FSBrowser) to the AutoConnect menu item. It adds Edit and List items with little modification to the legacy sketch code.
The AutoConnect menu can contain your sketch's web pages as extra items as a custom. It works for HTML pages implemented by the**ESP8266WebServer::on** handler or the**WebServer::on** handler for ESP32. That is, you can make them invoke the legacy web pages from the AutoConnect menu. The below screen-shot is the result of adding an example sketch for the ESP8266WebServer library known as [FSBrowser](https://github.com/esp8266/Arduino/tree/master/libraries/ESP8266WebServer/examples/FSBrowser) to the AutoConnect menu item. It can add Edit and List items with little modification to the legacy sketch code.
You can extend the AutoConnect menu to improve the original sketches and according to the procedure described in section [*Advanced Usage*](advancedusage.md#casts-the-html-pages-to-be-add-on-into-the-menu).
You can improve your sketches by extending the AutoConnect menu by adding the legacy web pages according to the procedure described in section [*Advanced Usage*](advancedusage.md#casts-the-html-pages-to-be-add-on-into-the-menu).