You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
AutoConnect/docs/faq/index.html

1005 lines
37 KiB

<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="description" content="ESP8266 WLAN configuration at run time with web interface">
<link rel="canonical" href="https://Hieromon.github.io/AutoConnect/faq/index.html">
<meta name="author" content="Hieromon Ikasamo">
<meta name="lang:clipboard.copy" content="Copy to clipboard">
<meta name="lang:clipboard.copied" content="Copied to clipboard">
<meta name="lang:search.language" content="en">
<meta name="lang:search.pipeline.stopwords" content="True">
<meta name="lang:search.pipeline.trimmer" content="True">
<meta name="lang:search.result.none" content="No matching documents">
<meta name="lang:search.result.one" content="1 matching document">
<meta name="lang:search.result.other" content="# matching documents">
<meta name="lang:search.tokenizer" content="[\s\-]+">
<link rel="shortcut icon" href="../assets/images/favicon.png">
<meta name="generator" content="mkdocs-0.17.3, mkdocs-material-2.7.0">
<title>FAQ - AutoConnect for ESP8266</title>
<link rel="stylesheet" href="../assets/stylesheets/application.78aab2dc.css">
<link rel="stylesheet" href="../assets/stylesheets/application-palette.6079476c.css">
<script src="../assets/javascripts/modernizr.1aa3b519.js"></script>
<link href="https://fonts.gstatic.com" rel="preconnect" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,400i,700|Roboto+Mono">
<style>body,input{font-family:"Roboto","Helvetica Neue",Helvetica,Arial,sans-serif}code,kbd,pre{font-family:"Roboto Mono","Courier New",Courier,monospace}</style>
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="../css/paragraph.css">
</head>
<body dir="ltr" data-md-color-primary="indigo" data-md-color-accent="indigo">
<svg class="md-svg">
<defs>
<svg xmlns="http://www.w3.org/2000/svg" width="416" height="448"
viewBox="0 0 416 448" id="github">
<path fill="currentColor" d="M160 304q0 10-3.125 20.5t-10.75 19-18.125
8.5-18.125-8.5-10.75-19-3.125-20.5 3.125-20.5 10.75-19 18.125-8.5
18.125 8.5 10.75 19 3.125 20.5zM320 304q0 10-3.125 20.5t-10.75
19-18.125 8.5-18.125-8.5-10.75-19-3.125-20.5 3.125-20.5 10.75-19
18.125-8.5 18.125 8.5 10.75 19 3.125 20.5zM360
304q0-30-17.25-51t-46.75-21q-10.25 0-48.75 5.25-17.75 2.75-39.25
2.75t-39.25-2.75q-38-5.25-48.75-5.25-29.5 0-46.75 21t-17.25 51q0 22 8
38.375t20.25 25.75 30.5 15 35 7.375 37.25 1.75h42q20.5 0
37.25-1.75t35-7.375 30.5-15 20.25-25.75 8-38.375zM416 260q0 51.75-15.25
82.75-9.5 19.25-26.375 33.25t-35.25 21.5-42.5 11.875-42.875 5.5-41.75
1.125q-19.5 0-35.5-0.75t-36.875-3.125-38.125-7.5-34.25-12.875-30.25-20.25-21.5-28.75q-15.5-30.75-15.5-82.75
0-59.25 34-99-6.75-20.5-6.75-42.5 0-29 12.75-54.5 27 0 47.5 9.875t47.25
30.875q36.75-8.75 77.25-8.75 37 0 70 8 26.25-20.5
46.75-30.25t47.25-9.75q12.75 25.5 12.75 54.5 0 21.75-6.75 42 34 40 34
99.5z" />
</svg>
</defs>
</svg>
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="drawer">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="search">
<label class="md-overlay" data-md-component="overlay" for="drawer"></label>
<a href="#after-connected-autoconnect-menu-performs-but-no-happens" tabindex="1" class="md-skip">
Skip to content
</a>
<header class="md-header" data-md-component="header">
<nav class="md-header-nav md-grid">
<div class="md-flex">
<div class="md-flex__cell md-flex__cell--shrink">
<a href="https://Hieromon.github.io/AutoConnect/" title="AutoConnect for ESP8266" class="md-header-nav__button md-logo">
<img src="../images/arduino-logo.svg" width="24" height="24">
</a>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--menu md-header-nav__button" for="drawer"></label>
</div>
<div class="md-flex__cell md-flex__cell--stretch">
<div class="md-flex__ellipsis md-header-nav__title" data-md-component="title">
<span class="md-header-nav__topic">
AutoConnect for ESP8266
</span>
<span class="md-header-nav__topic">
FAQ
</span>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<label class="md-icon md-icon--search md-header-nav__button" for="search"></label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" name="search">
<input type="text" class="md-search__input" name="query" placeholder="Search" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="query" data-md-state="active">
<label class="md-icon md-search__icon" for="search"></label>
<button type="reset" class="md-icon md-search__icon" data-md-component="reset" tabindex="-1">
&#xE5CD;
</button>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" data-md-scrollfix>
<div class="md-search-result" data-md-component="result">
<div class="md-search-result__meta">
Type to start searching
</div>
<ol class="md-search-result__list"></ol>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<div class="md-header-nav__source">
<a href="https://github.com/Hieromon/AutoConnect" title="Go to repository" class="md-source" data-md-source="github">
<div class="md-source__icon">
<svg viewBox="0 0 24 24" width="24" height="24">
<use xlink:href="#github" width="24" height="24"></use>
</svg>
</div>
<div class="md-source__repository">
Hieromon/AutoConnect
</div>
</a>
</div>
</div>
</div>
</nav>
</header>
<div class="md-container">
<nav class="md-tabs" data-md-component="tabs">
<div class="md-tabs__inner md-grid">
<ul class="md-tabs__list">
<li class="md-tabs__item">
<a href="../index.html" title="Overview" class="md-tabs__link md-tabs__link--active">
Overview
</a>
</li>
</ul>
</div>
</nav>
<main class="md-main">
<div class="md-main__inner md-grid" data-md-component="container">
<div class="md-sidebar md-sidebar--primary" data-md-component="navigation">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" data-md-level="0">
<label class="md-nav__title md-nav__title--site" for="drawer">
<span class="md-nav__button md-logo">
<img src="../images/arduino-logo.svg" width="48" height="48">
</span>
AutoConnect for ESP8266
</label>
<div class="md-nav__source">
<a href="https://github.com/Hieromon/AutoConnect" title="Go to repository" class="md-source" data-md-source="github">
<div class="md-source__icon">
<svg viewBox="0 0 24 24" width="24" height="24">
<use xlink:href="#github" width="24" height="24"></use>
</svg>
</div>
<div class="md-source__repository">
Hieromon/AutoConnect
</div>
</a>
</div>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../index.html" title="Overview" class="md-nav__link">
Overview
</a>
</li>
<li class="md-nav__item">
<a href="../gettingstarted/index.html" title="Getting started" class="md-nav__link">
Getting started
</a>
</li>
<li class="md-nav__item">
<a href="../menu/index.html" title="AutoConnect menu" class="md-nav__link">
AutoConnect menu
</a>
</li>
<li class="md-nav__item">
<a href="../basicusage/index.html" title="Basic usage" class="md-nav__link">
Basic usage
</a>
</li>
<li class="md-nav__item">
<a href="../advancedusage/index.html" title="Advanced usage" class="md-nav__link">
Advanced usage
</a>
</li>
<li class="md-nav__item">
<a href="../api/index.html" title="Library APIs" class="md-nav__link">
Library APIs
</a>
</li>
<li class="md-nav__item">
<a href="../examples/index.html" title="Examples" class="md-nav__link">
Examples
</a>
</li>
<li class="md-nav__item md-nav__item--active">
<input class="md-toggle md-nav__toggle" data-md-toggle="toc" type="checkbox" id="toc">
<label class="md-nav__link md-nav__link--active" for="toc">
FAQ
</label>
<a href="index.html" title="FAQ" class="md-nav__link md-nav__link--active">
FAQ
</a>
<nav class="md-nav md-nav--secondary">
<label class="md-nav__title" for="toc">Table of contents</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="#after-connected-autoconnect-menu-performs-but-no-happens" title=" After connected, AutoConnect menu performs but no happens." class="md-nav__link">
After connected, AutoConnect menu performs but no happens.
</a>
</li>
<li class="md-nav__item">
<a href="#an-esp8266ap-as-softap-was-connected-but-captive-portal-does-not-start" title=" An esp8266ap as SoftAP was connected but Captive portal does not start." class="md-nav__link">
An esp8266ap as SoftAP was connected but Captive portal does not start.
</a>
</li>
<li class="md-nav__item">
<a href="#does-not-appear-esp8266ap-in-smartphone" title=" Does not appear esp8266ap in smartphone." class="md-nav__link">
Does not appear esp8266ap in smartphone.
</a>
</li>
<li class="md-nav__item">
<a href="#does-not-response-from-95ac" title=" Does not response from /_ac." class="md-nav__link">
Does not response from /_ac.
</a>
</li>
<li class="md-nav__item">
<a href="#how-change-esp8266ap-for-ssid-name-in-captive-portal" title=" How change esp8266ap for SSID name in Captive portal?" class="md-nav__link">
How change esp8266ap for SSID name in Captive portal?
</a>
</li>
<li class="md-nav__item">
<a href="#how-change-http-port" title=" How change HTTP port?" class="md-nav__link">
How change HTTP port?
</a>
</li>
<li class="md-nav__item">
<a href="#hang-up-after-reset" title=" Hang up after Reset?" class="md-nav__link">
Hang up after Reset?
</a>
</li>
<li class="md-nav__item">
<a href="#how-erase-the-credentials-saved-in-eeprom" title=" How erase the credentials saved in EEPROM?" class="md-nav__link">
How erase the credentials saved in EEPROM?
</a>
<nav class="md-nav">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#include-header" title="Include header" class="md-nav__link">
Include header
</a>
</li>
<li class="md-nav__item">
<a href="#constructor" title="Constructor" class="md-nav__link">
Constructor
</a>
</li>
<li class="md-nav__item">
<a href="#public-member-functions" title="Public member functions" class="md-nav__link">
Public member functions
</a>
</li>
<li class="md-nav__item">
<a href="#data-structures" title="Data structures" class="md-nav__link">
Data structures
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#how-locate-the-link-button-to-the-autoconnect-menu" title=" How locate the link button to the AutoConnect menu?" class="md-nav__link">
How locate the link button to the AutoConnect menu?
</a>
</li>
<li class="md-nav__item">
<a href="#how-much-memory-does-autoconnect-consume" title=" How much memory does AutoConnect consume?" class="md-nav__link">
How much memory does AutoConnect consume?
</a>
<nav class="md-nav">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#sketch-size" title="Sketch size" class="md-nav__link">
Sketch size
</a>
</li>
<li class="md-nav__item">
<a href="#heap-size" title="Heap size" class="md-nav__link">
Heap size
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#i-cannot-complete-to-wi-fi-login-from-smartphone" title=" I cannot complete to Wi-Fi login from smartphone." class="md-nav__link">
I cannot complete to Wi-Fi login from smartphone.
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../changelog/index.html" title="Change log" class="md-nav__link">
Change log
</a>
</li>
<li class="md-nav__item">
<a href="../license/index.html" title="License" class="md-nav__link">
License
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="toc">
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary">
<label class="md-nav__title" for="toc">Table of contents</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="#after-connected-autoconnect-menu-performs-but-no-happens" title=" After connected, AutoConnect menu performs but no happens." class="md-nav__link">
After connected, AutoConnect menu performs but no happens.
</a>
</li>
<li class="md-nav__item">
<a href="#an-esp8266ap-as-softap-was-connected-but-captive-portal-does-not-start" title=" An esp8266ap as SoftAP was connected but Captive portal does not start." class="md-nav__link">
An esp8266ap as SoftAP was connected but Captive portal does not start.
</a>
</li>
<li class="md-nav__item">
<a href="#does-not-appear-esp8266ap-in-smartphone" title=" Does not appear esp8266ap in smartphone." class="md-nav__link">
Does not appear esp8266ap in smartphone.
</a>
</li>
<li class="md-nav__item">
<a href="#does-not-response-from-95ac" title=" Does not response from /_ac." class="md-nav__link">
Does not response from /_ac.
</a>
</li>
<li class="md-nav__item">
<a href="#how-change-esp8266ap-for-ssid-name-in-captive-portal" title=" How change esp8266ap for SSID name in Captive portal?" class="md-nav__link">
How change esp8266ap for SSID name in Captive portal?
</a>
</li>
<li class="md-nav__item">
<a href="#how-change-http-port" title=" How change HTTP port?" class="md-nav__link">
How change HTTP port?
</a>
</li>
<li class="md-nav__item">
<a href="#hang-up-after-reset" title=" Hang up after Reset?" class="md-nav__link">
Hang up after Reset?
</a>
</li>
<li class="md-nav__item">
<a href="#how-erase-the-credentials-saved-in-eeprom" title=" How erase the credentials saved in EEPROM?" class="md-nav__link">
How erase the credentials saved in EEPROM?
</a>
<nav class="md-nav">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#include-header" title="Include header" class="md-nav__link">
Include header
</a>
</li>
<li class="md-nav__item">
<a href="#constructor" title="Constructor" class="md-nav__link">
Constructor
</a>
</li>
<li class="md-nav__item">
<a href="#public-member-functions" title="Public member functions" class="md-nav__link">
Public member functions
</a>
</li>
<li class="md-nav__item">
<a href="#data-structures" title="Data structures" class="md-nav__link">
Data structures
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#how-locate-the-link-button-to-the-autoconnect-menu" title=" How locate the link button to the AutoConnect menu?" class="md-nav__link">
How locate the link button to the AutoConnect menu?
</a>
</li>
<li class="md-nav__item">
<a href="#how-much-memory-does-autoconnect-consume" title=" How much memory does AutoConnect consume?" class="md-nav__link">
How much memory does AutoConnect consume?
</a>
<nav class="md-nav">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#sketch-size" title="Sketch size" class="md-nav__link">
Sketch size
</a>
</li>
<li class="md-nav__item">
<a href="#heap-size" title="Heap size" class="md-nav__link">
Heap size
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#i-cannot-complete-to-wi-fi-login-from-smartphone" title=" I cannot complete to Wi-Fi login from smartphone." class="md-nav__link">
I cannot complete to Wi-Fi login from smartphone.
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content">
<article class="md-content__inner md-typeset">
<h1>FAQ</h1>
<h2 id="after-connected-autoconnect-menu-performs-but-no-happens"><i class="fa fa-question-circle"></i> After connected, AutoConnect menu performs but no happens.<a class="headerlink" href="#after-connected-autoconnect-menu-performs-but-no-happens" title="Permanent link">&para;</a></h2>
<p>If you can access the <strong>AutoConnect root path</strong> as http://ESP8266IPADDRESS/_ac from browser, probably the sketch uses <em>ESP8266WebServer::handleClient()</em> without <a href="../api/index.html#handlerequest"><em>AutoConnect::handleRequest()</em></a>.<br />
For AutoConnect menus to work properly, call <a href="../api/index.html#handlerequest"><em>AutoConnect::handleRequest()</em></a> after <em>ESP8266WebServer::handleClient()</em> invoked, or use <a href="../api/index.html#handleclient"><em>AutoConnect::handleClient()</em></a>. <a href="../api/index.html#handleclient"><em>AutoConnect::handleClient()</em></a> is equivalent <em>ESP8266WebServer::handleClient</em> combinated <a href="../api/index.html#handlerequest"><em>AutoConnect::handleRequest()</em></a>.</p>
<p>See also the explanation <a href="../basicusage/index.html#esp8266webserver-hosted-or-parasitic">here</a>.</p>
<h2 id="an-esp8266ap-as-softap-was-connected-but-captive-portal-does-not-start"><i class="fa fa-question-circle"></i> An esp8266ap as SoftAP was connected but Captive portal does not start.<a class="headerlink" href="#an-esp8266ap-as-softap-was-connected-but-captive-portal-does-not-start" title="Permanent link">&para;</a></h2>
<p>Captive portal detection could not be trapped. It is necessary to disconnect and reset ESP8266 to clear memorized connection data in ESP8266. Also, It may be displayed on the smartphone if the connection information of esp8266ap is wrong. In that case, delete the connection information of esp8266ap memorized by the smartphone once.</p>
<h2 id="does-not-appear-esp8266ap-in-smartphone"><i class="fa fa-question-circle"></i> Does not appear esp8266ap in smartphone.<a class="headerlink" href="#does-not-appear-esp8266ap-in-smartphone" title="Permanent link">&para;</a></h2>
<p>Maybe it is successfully connected at the <strong>first WiFi.begin</strong>. ESP8266 remembers the last SSID successfully connected and will use at the next. It means SoftAP will only start up when the first <em>WiFi.begin()</em> fails.</p>
<p>The saved SSID would be cleared by <em>WiFi.disconnect()</em> with WIFI_STA mode. If you do not want automatic reconnection, you can erase the memorized SSID with the following simple sketch.</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="kr">void</span> <span class="nb">setup</span><span class="p">()</span> <span class="p">{</span>
<span class="nf">delay</span><span class="p">(</span><span class="mi">1000</span><span class="p">);</span>
<span class="nf">Serial</span><span class="p">.</span><span class="nf">begin</span><span class="p">(</span><span class="mi">115200</span><span class="p">);</span>
<span class="nf">WiFi</span><span class="p">.</span><span class="n">mode</span><span class="p">(</span><span class="n">WIFI_STA</span><span class="p">);</span>
<span class="nf">delay</span><span class="p">(</span><span class="mi">100</span><span class="p">);</span>
<span class="nf">WiFi</span><span class="p">.</span><span class="nf">begin</span><span class="p">();</span>
<span class="k">if</span> <span class="p">(</span><span class="nf">WiFi</span><span class="p">.</span><span class="n">waitForConnectResult</span><span class="p">()</span> <span class="o">==</span> <span class="n">WL_CONNECTED</span><span class="p">)</span> <span class="p">{</span>
<span class="nf">WiFi</span><span class="p">.</span><span class="nf">disconnect</span><span class="p">();</span>
<span class="k">while</span> <span class="p">(</span><span class="nf">WiFi</span><span class="p">.</span><span class="n">status</span><span class="p">()</span> <span class="o">==</span> <span class="n">WL_CONNECTED</span><span class="p">)</span>
<span class="nf">delay</span><span class="p">(</span><span class="mi">100</span><span class="p">);</span>
<span class="p">}</span>
<span class="nf">Serial</span><span class="p">.</span><span class="nf">println</span><span class="p">(</span><span class="s">&quot;WiFi disconnected.&quot;</span><span class="p">);</span>
<span class="p">}</span>
<span class="kr">void</span> <span class="nb">loop</span><span class="p">()</span> <span class="p">{</span>
<span class="nf">delay</span><span class="p">(</span><span class="mi">1000</span><span class="p">);</span>
<span class="p">}</span>
</pre></div>
<details class="hint"><summary>You can interactively check the WiFi state of ESP8266.</summary><p>Please try <a href="https://github.com/Hieromon/ESPShaker"><strong>ESPShaker</strong></a>. It is ESP8266 interactive serial command processor.</p><p><img src="../images/espshaker.gif" /></p></details><h2 id="does-not-response-from-95ac"><i class="fa fa-question-circle"></i> Does not response from /_ac.<a class="headerlink" href="#does-not-response-from-95ac" title="Permanent link">&para;</a></h2>
<p>Probably <strong>WiFi.begin</strong> failed with the specified SSID. Activating the <a href="../advancedusage/index.html#debug-print">debug printing</a> will help you to track down the cause.</p>
<h2 id="how-change-esp8266ap-for-ssid-name-in-captive-portal"><i class="fa fa-question-circle"></i> How change esp8266ap for SSID name in Captive portal?<a class="headerlink" href="#how-change-esp8266ap-for-ssid-name-in-captive-portal" title="Permanent link">&para;</a></h2>
<p>An <strong>esp8266ap</strong> is default SSID name for SoftAP of captive portal and password is <strong>12345678</strong>. You can change both by using <a href="../api/index.html#autoconnectconfig-api">AutoConnectConfig</a>.</p>
<h2 id="how-change-http-port"><i class="fa fa-question-circle"></i> How change HTTP port?<a class="headerlink" href="#how-change-http-port" title="Permanent link">&para;</a></h2>
<p>HTTP port number is defined as a macro in <a href="https://github.com/Hieromon/AutoConnect/blob/77d5cb5dc6d50651fd15f74b47859105c71fc317/src/AutoConnect.h#L89">AutoConnect.h</a> header file. You can change it directly with several editors and must re-compile.</p>
<div class="codehilite"><pre><span></span><span class="cp">#define AUTOCONNECT_HTTPPORT 80</span>
</pre></div>
<h2 id="hang-up-after-reset"><i class="fa fa-question-circle"></i> Hang up after Reset?<a class="headerlink" href="#hang-up-after-reset" title="Permanent link">&para;</a></h2>
<p>If ESP8266 hang up after reset by AutoConnect menu, perhaps manual reset is not yet. Especially if it is not manual reset yet after uploading the sketch, the boot mode will stay 'Uart Download'. There is some discussion about this on the Github's ESP8266 core: <a href="https://github.com/esp8266/Arduino/issues/1017">https://github.com/esp8266/Arduino/issues/1017</a></p>
<p>If you received the following message, the boot mode is still sketch uploaded. It needs to the manual reset once.</p>
<div class="codehilite"><pre><span></span>ets Jan 8 2013,rst cause:2, boot mode:(1,6) or (1,7)
ets Jan 8 2013,rst cause:4, boot mode:(1,6) or (1,7)
wdt reset
</pre></div>
<p>The correct boot mode for starting the sketch is <strong>(3, x)</strong>.</p>
<h2 id="how-erase-the-credentials-saved-in-eeprom"><i class="fa fa-question-circle"></i> How erase the credentials saved in EEPROM?<a class="headerlink" href="#how-erase-the-credentials-saved-in-eeprom" title="Permanent link">&para;</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>
<h3 id="include-header">Include header<a class="headerlink" href="#include-header" title="Permanent link">&para;</a></h3>
<div class="codehilite"><pre><span></span><span class="cp">#include</span> <span class="cpf">&lt;AutoConnectCredential.h&gt;</span><span class="cp"></span>
</pre></div>
<h3 id="constructor">Constructor<a class="headerlink" href="#constructor" title="Permanent link">&para;</a></h3>
<div class="codehilite"><pre><span></span><span class="n">AutoConnectCredential</span><span class="p">();</span>
</pre></div>
<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>
<div class="codehilite"><pre><span></span><span class="n">AutoConnectCredential</span><span class="p">(</span><span class="kt">uint16_t</span> <span class="n">offset</span><span class="p">);</span>
</pre></div>
<p>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.</p>
<h3 id="public-member-functions">Public member functions<a class="headerlink" href="#public-member-functions" title="Permanent link">&para;</a></h3>
<ul>
<li>
<p>uint8_t <strong>entries()</strong><br />
Returns number of entries as contained credentials.</p>
</li>
<li>
<p>int8_t <strong>load(const char* <em>ssid</em>, struct station_config* <em>config</em>)</strong><br />
Load a credential entry specified <em>ssid</em> to <em>config</em>. Returns -1 as unsuccessfully loaded.</p>
</li>
<li>
<p>bool <strong>load(int8_t <em>entry</em>, struct station_config* <em>config</em>)</strong><br />
Load a credential entry to <em>config</em>. The <em>entry</em> parameter specify to index of the entry.</p>
</li>
<li>
<p>bool <strong>save(const struct station_config* <em>config</em>)</strong><br />
Save a credential entry stored in <em>config</em> to EEPROM. Returns the true as succeeded.</p>
</li>
<li>
<p>bool <strong>del(const char* <em>ssid</em>)</strong><br />
Delete a credential entry specified <em>ssid</em>. Returns the true as successfully deleted.</p>
</li>
</ul>
<h3 id="data-structures">Data structures<a class="headerlink" href="#data-structures" title="Permanent link">&para;</a></h3>
<ul>
<li>station_config<br />
A structure is included in the ESP8266 SDK. You can use it in the sketch like as follows.</li>
</ul>
<div class="codehilite"><pre><span></span><span class="k">extern</span> <span class="s">&quot;C&quot;</span> <span class="p">{</span>
<span class="cp">#include</span> <span class="cpf">&lt;user_interface.h&gt;</span><span class="cp"></span>
<span class="p">}</span>
</pre></div>
<div class="codehilite"><pre><span></span><span class="k">struct</span> <span class="n">station_config</span> <span class="p">{</span>
<span class="n">uint8</span> <span class="n">ssid</span><span class="p">[</span><span class="mi">32</span><span class="p">];</span>
<span class="n">uint8</span> <span class="n">password</span><span class="p">[</span><span class="mi">64</span><span class="p">];</span>
<span class="n">uint8</span> <span class="n">bssid_set</span><span class="p">;</span>
<span class="n">uint8</span> <span class="n">bssid</span><span class="p">[</span><span class="mi">6</span><span class="p">];</span>
<span class="p">};</span>
</pre></div>
<ul>
<li>EEPROM data structure<br />
A data structure of the credential saving area in EEPROM as the below. <sup id="fnref:1"><a class="footnote-ref" href="#fn:1" rel="footnote">1</a></sup></li>
</ul>
<table>
<thead>
<tr>
<th>Byte offset</th>
<th>Length</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<tr>
<td>0</td>
<td>8</td>
<td>AC_CREDT</td>
</tr>
<tr>
<td>8</td>
<td>1</td>
<td>Number of contained entries (uint8_t)</td>
</tr>
<tr>
<td>9</td>
<td>2</td>
<td>Container size, excluding size of AC_CREDT and size of the number of entries(width for uint16_t type).</td>
</tr>
<tr>
<td>11</td>
<td>variable</td>
<td>SSID terminated by 0x00. Max length is 32 bytes.</td>
</tr>
<tr>
<td>variable</td>
<td>variable</td>
<td>Password plain text terminated by 0x00. Max length is 64 bytes.</td>
</tr>
<tr>
<td>variable</td>
<td>6</td>
<td>BSSID</td>
</tr>
<tr>
<td>variable</td>
<td></td>
<td>Contained the next entries. (Continuation SSID+Password+BSSID)</td>
</tr>
<tr>
<td>variable</td>
<td>1</td>
<td>0x00. End of container.</td>
</tr>
</tbody>
</table>
<div class="admonition hint">
<p class="admonition-title">Hint</p>
<p>With the <a href="https://github.com/Hieromon/ESPShaker"><strong>ESPShaker</strong></a>, you can access EEPROM interactively from the serial monitor, and of course you can erase saved credentials.</p>
</div>
<h2 id="how-locate-the-link-button-to-the-autoconnect-menu"><i class="fa fa-question-circle"></i> How locate the link button to the AutoConnect menu?<a class="headerlink" href="#how-locate-the-link-button-to-the-autoconnect-menu" title="Permanent link">&para;</a></h2>
<p>Link button to AutoConnect menu can be embedded into Sketch's web page. The root path of the menu is <strong>/_ac</strong> by default and embed the following <code class="codehilite"><span class="nt">&lt;a&gt;&lt;/a&gt;</span></code> tag in the generating HTML.</p>
<div class="codehilite"><pre><span></span><span class="p">&lt;</span><span class="nt">a</span> <span class="na">style</span><span class="o">=</span><span class="s">&quot;background-color:SteelBlue; display:inline-block; padding:7px 13px; text-decoration:none;&quot;</span> <span class="na">href</span><span class="o">=</span><span class="s">&quot;/_ac&quot;</span><span class="p">&gt;</span>MENU<span class="p">&lt;/</span><span class="nt">a</span><span class="p">&gt;</span>
</pre></div>
<h2 id="how-much-memory-does-autoconnect-consume"><i class="fa fa-question-circle"></i> How much memory does AutoConnect consume?<a class="headerlink" href="#how-much-memory-does-autoconnect-consume" title="Permanent link">&para;</a></h2>
<h3 id="sketch-size">Sketch size<a class="headerlink" href="#sketch-size" title="Permanent link">&para;</a></h3>
<p>It increases about 53K bytes compared to the case without AutoConnect. A sketch size of the most simple example introduced in the Getting started is about 330K bytes. (270K byte without AutoConnect)</p>
<h3 id="heap-size">Heap size<a class="headerlink" href="#heap-size" title="Permanent link">&para;</a></h3>
<p>It consumes about 2K bytes in the static and about 12K bytes are consumed at the moment when menu executed.</p>
<h2 id="i-cannot-complete-to-wi-fi-login-from-smartphone"><i class="fa fa-question-circle"></i> I cannot complete to Wi-Fi login from smartphone.<a class="headerlink" href="#i-cannot-complete-to-wi-fi-login-from-smartphone" title="Permanent link">&para;</a></h2>
<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>
<div class="footnote">
<hr />
<ol>
<li id="fn:1">
<p>There may be 0xff as an invalid data in the credential saving area. The 0xff area would be reused.&#160;<a class="footnote-backref" href="#fnref:1" rev="footnote" title="Jump back to footnote 1 in the text">&#8617;</a></p>
</li>
</ol>
</div>
</article>
</div>
</div>
</main>
<footer class="md-footer">
<div class="md-footer-nav">
<nav class="md-footer-nav__inner md-grid">
<a href="../examples/index.html" title="Examples" class="md-flex md-footer-nav__link md-footer-nav__link--prev" rel="prev">
<div class="md-flex__cell md-flex__cell--shrink">
<i class="md-icon md-icon--arrow-back md-footer-nav__button"></i>
</div>
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
<span class="md-flex__ellipsis">
<span class="md-footer-nav__direction">
Previous
</span>
Examples
</span>
</div>
</a>
<a href="../changelog/index.html" title="Change log" class="md-flex md-footer-nav__link md-footer-nav__link--next" rel="next">
<div class="md-flex__cell md-flex__cell--stretch md-footer-nav__title">
<span class="md-flex__ellipsis">
<span class="md-footer-nav__direction">
Next
</span>
Change log
</span>
</div>
<div class="md-flex__cell md-flex__cell--shrink">
<i class="md-icon md-icon--arrow-forward md-footer-nav__button"></i>
</div>
</a>
</nav>
</div>
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-footer-copyright">
<div class="md-footer-copyright__highlight">
Copyright &copy; 2018 Hieromon Ikasamo
</div>
powered by
<a href="http://www.mkdocs.org">MkDocs</a>
and
<a href="https://squidfunk.github.io/mkdocs-material/">
Material for MkDocs</a>
</div>
<div class="md-footer-social">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<a href="https://github.com/Hieromon" class="md-footer-social__link fa fa-github"></a>
<a href="https://twitter.com/hieromon" class="md-footer-social__link fa fa-twitter"></a>
</div>
</div>
</div>
</footer>
</div>
<script src="../assets/javascripts/application.8eb9be28.js"></script>
<script>app.initialize({version:"0.17.3",url:{base:".."}})</script>
<script src="../js/gifffer.min.js"></script>
<script>!function(e,a,t,n,o,c,i){e.GoogleAnalyticsObject=o,e.ga=e.ga||function(){(e.ga.q=e.ga.q||[]).push(arguments)},e.ga.l=1*new Date,c=a.createElement(t),i=a.getElementsByTagName(t)[0],c.async=1,c.src="https://www.google-analytics.com/analytics.js",i.parentNode.insertBefore(c,i)}(window,document,"script",0,"ga"),ga("create","None","auto"),ga("set","anonymizeIp",!0),ga("send","pageview");var links=document.getElementsByTagName("a");if(Array.prototype.map.call(links,function(e){e.host!=document.location.host&&e.addEventListener("click",function(){var a=e.getAttribute("data-md-action")||"follow";ga("send","event","outbound",a,e.href)})}),document.forms.search){var query=document.forms.search.query;query.addEventListener("blur",function(){if(this.value){var e=document.location.pathname;ga("send","pageview",e+"?q="+this.value)}})}</script>
</body>
</html>