<ahref="#static-ip-assignment"title=" Static IP assignment"class="md-nav__link">
Static IP assignment
</a>
</li>
</ul>
@ -668,6 +675,13 @@
Relocate the AutoConnect home path
</a>
</li>
<liclass="md-nav__item">
<ahref="#static-ip-assignment"title=" Static IP assignment"class="md-nav__link">
Static IP assignment
</a>
</li>
</ul>
@ -701,7 +715,7 @@
<p>By default, AutoConnect saves the credentials of the established connection in EEPROM. You can disable it with the <ahref="../api/index.html#autosave"><strong>autoSave</strong></a> parameter specified by <ahref="../api/index.html#autoconnectconfig"><strong>AutoConnectConfig</strong></a>.</p>
<h3id="configuration-for-soft-ap"><iclass="fa fa-caret-right"></i> Configuration for Soft AP<aclass="headerlink"href="#configuration-for-soft-ap"title="Permanent link">¶</a></h3>
<p>AutoConnect will activate SoftAP at failed initial WiFi.Begin. It SoftAP settings are stored in <ahref="../api/index.html#autoconnectconfig"><strong>AutoConnectConfig</strong></a> as the following parameters. The sketch could be configured SoftAP using these parameters, refer the <ahref="../api/index.html#autoconnectconfig-api">AutoConnectConfig API</a> for details.</p>
<p>AutoConnect will activate SoftAP at failed the first <em>WiFi.begin</em>. It SoftAP settings are stored in <ahref="../api/index.html#autoconnectconfig"><strong>AutoConnectConfig</strong></a> as the following parameters. The sketch could be configured SoftAP using these parameters, refer the <ahref="../api/index.html#autoconnectconfig-api">AutoConnectConfig API</a> for details.</p>
<ul>
<li>IP address of SoftAP activated.</li>
<li>Gateway IP address.</li>
@ -876,6 +890,28 @@
<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>
<h3id="static-ip-assignment"><iclass="fa fa-caret-right"></i> Static IP assignment<aclass="headerlink"href="#static-ip-assignment"title="Permanent link">¶</a></h3>
<p>It is also possible to assign static IP Address to ESP8266 in STA mode. By default DHCP is enabled and it becomes the IP address assigned by the DHCP server with <em>WiFi.begin</em>.<supid="fnref:1"><aclass="footnote-ref"href="#fn:1"rel="footnote">1</a></sup></p>
<p>To assign a static IP Address, specify it in the <ahref="../api/index.html#staip">AutoConnectConfig parameter</a>. In the case of assigning a static IP Address, specify the gateway, subnet mask, and DNS server is needed.</p>
<p>Static IP address assignment is available from version 0.9.3. <aclass="footnote-backref"href="#fnref:1"rev="footnote"title="Jump back to footnote 1 in the text">↩</a></p>
<pclass="admonition-title">How do I choose Channel</p>
<p>Espressif Systems had announced the <ahref="https://www.espressif.com/sites/default/files/esp8266_wi-fi_channel_selection_guidelines.pdf">application note</a> about Wi-Fi channel selection.</p>
<p>Sets gateway address for Soft AP in captive portal. When AutoConnect fails the initial WiFi.begin, it starts the captive portal with the IP address specified this.
<spanclass="n">AutoConenctConfig</span><spanclass="nf">Config</span><spanclass="p">(</span><spanclass="s">""</span><spanclass="p">,</span><spanclass="s">"passpass"</span><spanclass="p">);</span><spanclass="c1">// SoftAp name is determined at runtime</span>
@ -1295,6 +1395,10 @@ The default value is 0.
<spanclass="n">Config</span><spanclass="p">.</span><spanclass="n">autoSave</span><spanclass="o">=</span><spanclass="n">AC_SAVECREDENTIAL_NEVER</span><spanclass="p">;</span><spanclass="c1">// No save credential</span>
<spanclass="n">COnfig</span><spanclass="p">.</span><spanclass="n">boundaryOffet</span><spanclass="o">=</span><spanclass="mi">64</span><spanclass="p">;</span><spanclass="c1">// Reserve 64 bytes for the user data in EEPROM. </span>
<spanclass="n">Config</span><spanclass="p">.</span><spanclass="n">homeUri</span><spanclass="o">=</span><spanclass="s">"/index.html"</span><spanclass="c1">// Sets home path of the sketch application</span>
<spanclass="n">Config</span><spanclass="p">.</span><spanclass="n">dns1</span><spanclass="o">=</span><spanclass="nf">IPAddress</span><spanclass="p">(</span><spanclass="mi">192</span><spanclass="p">,</span><spanclass="mi">168</span><spanclass="p">,</span><spanclass="mi">10</span><spanclass="p">,</span><spanclass="mi">1</span><spanclass="p">);</span><spanclass="c1">// Sets primary DNS address</span>
@ -11,7 +11,7 @@ By default, AutoConnect saves the credentials of the established connection in E
```arduino hl_lines="3"
AutoConnect Portal;
AutoConnectConfig Config;
Config.autoSave = AC_SAVECREDENTIAL_NEVER;
Config.autoSave = AC_SAVECREDENTIAL_NEVER;f
Portal.config(Config);
Portal.begin();
```
@ -185,7 +185,7 @@ An example sketch used with the PageBuilder as follows and it explains how it ai
### <iclass="fa fa-caret-right"></i> Configuration for Soft AP
AutoConnect will activate SoftAP at failed initial WiFi.Begin. It SoftAP settings are stored in [**AutoConnectConfig**](api.md#autoconnectconfig) as the following parameters. The sketch could be configured SoftAP using these parameters, refer the [AutoConnectConfig API](api.md#autoconnectconfig-api) for details.
AutoConnect will activate SoftAP at failed the first *WiFi.begin*. It SoftAP settings are stored in [**AutoConnectConfig**](api.md#autoconnectconfig) as the following parameters. The sketch could be configured SoftAP using these parameters, refer the [AutoConnectConfig API](api.md#autoconnectconfig-api) for details.
- IP address of SoftAP activated.
- Gateway IP address.
@ -216,4 +216,23 @@ A home path of AutoConnect is **/\_ac** by default. You can access from the brow
```cpp
#define AUTOCONNECT_URI "/_ac"
```
```
### <iclass="fa fa-caret-right"></i> Static IP assignment
It is also possible to assign static IP Address to ESP8266 in STA mode. By default DHCP is enabled and it becomes the IP address assigned by the DHCP server with *WiFi.begin*.[^1]
To assign a static IP Address, specify it in the [AutoConnectConfig parameter](api.md#staip). In the case of assigning a static IP Address, specify the gateway, subnet mask, and DNS server is needed.
```arduino
AutoConnect portal;
AutoConnectConfig Config;
Config.staip = IPAddress(192,168,1,10);
Config.staGateway = IPAddress(192,168,1,1);
Config.staNetmask = IPAddress(255,255,255,0);
Config.dns1 = IPAddress(192,168,1,1);
portal.config(Config);
portal.begin();
```
[^1]:Static IP address assignment is available from version 0.9.3.
@ -285,6 +285,22 @@ The channel number of WIFi when SoftAP starts.
!!! info "How do I choose Channel"
Espressif Systems had announced the [application note](https://www.espressif.com/sites/default/files/esp8266_wi-fi_channel_selection_guidelines.pdf) about Wi-Fi channel selection.
#### dns1
Set primary DNS server address when using static IP address.
<dlclass="apidl">
<dt>**Type**</dt>
<dd>IPAddress</dd>
</dl>
#### dns2
Set secondary DNS server address when using static IP address.
<dlclass="apidl">
<dt>**Type**</dt>
<dd>IPAddress</dd>
</dl>
#### gateway
Sets gateway address for Soft AP in captive portal. When AutoConnect fails the initial WiFi.begin, it starts the captive portal with the IP address specified this.
@ -328,6 +344,30 @@ Sets password for SoftAP. The length should be from 8 to up to 63. The default v
<dd>String</dd>
</dl>
#### staip
Set a static IP address. The IP will behave with STA mode.
<dlclass="apidl">
<dt>**Type**</dt>
<dd>IPAddress</dd>
</dl>
#### staGateway
Set the gateway address when using static IP address.
<dlclass="apidl">
<dt>**Type**</dt>
<dd>IPAddress</dd>
</dl>
#### staNetmask
Set the subnetmask when using static IP address.
<dlclass="apidl">
<dt>**Type**</dt>
<dd>IPAddress</dd>
</dl>
### <iclass="fa fa-code"></i> AutoConnectConfig example