From d39545ce13c12c3e8fddef599b7325b276707ac9 Mon Sep 17 00:00:00 2001 From: Hieromon Ikasamo Date: Sun, 19 Apr 2020 05:17:36 +0900 Subject: [PATCH] Deploy for v1.1.7 --- docs/acelements.html | 4 +- docs/achandling.html | 104 ++++++++++++------------- docs/acintro.html | 14 ++-- docs/acjson.html | 12 +-- docs/acupload.html | 68 ++++++++--------- docs/advancedusage.html | 138 +++++++++++++++++----------------- docs/api.html | 38 +++++----- docs/apiaux.html | 8 +- docs/apiconfig.html | 36 ++++----- docs/basicusage.html | 4 +- docs/changelabel.html | 8 +- docs/changelog.html | 22 +++++- docs/colorized.html | 18 ++--- docs/credit.html | 4 +- docs/datatips.html | 10 +-- docs/faq.html | 18 ++--- docs/gettingstarted.html | 8 +- docs/howtoembed.html | 6 +- docs/menu.html | 2 +- docs/otabrowser.html | 72 +++++++++--------- docs/otaserver.html | 18 ++--- docs/search/search_index.json | 2 +- docs/sitemap.xml | 60 +++++++-------- docs/sitemap.xml.gz | Bin 412 -> 412 bytes docs/wojson.html | 18 ++--- 25 files changed, 355 insertions(+), 337 deletions(-) diff --git a/docs/acelements.html b/docs/acelements.html index d7f6313..d84255a 100644 --- a/docs/acelements.html +++ b/docs/acelements.html @@ -2091,8 +2091,8 @@ AutoConnect will not actively be involved in the layout of custom Web pages gene if (elm.type() == AC_Text) { AutoConnectText& text = customPage[elm.name].as<AutoConnectText>(); text.style = "color:gray;"; - // Or, it is also possible to write the code further reduced as follows. - // customPage[elm.name].as<AutoConnectText>().style = "color:gray;"; + // Or, it is also possible to write the code further reduced as follows. + // customPage[elm.name].as<AutoConnectText>().style = "color:gray;"; } } diff --git a/docs/achandling.html b/docs/achandling.html index 73fe4f9..54369ef 100644 --- a/docs/achandling.html +++ b/docs/achandling.html @@ -1172,7 +1172,7 @@ AutoConnectElements contained in AutoConnectAux object are uniquely identified by name. When adding an AutoConnectElement, if an element with the same name already exists in the AutoConnectAux, checking the type, and if it is the same, the value will be replaced. If another type of AutoConnectElement exists with the same name, that add operation will be invalid.1 In the following example, AutoConnectButton button addition will invalid because hello with the same name already exists as AutoConnectText.

AutoConnectAux  aux;
 AutoConnectText text("hello", "hello, world");
-AutoConnectButton button("hello", "hello, world", "alert('Hello world!')");  // This is invalid.
+AutoConnectButton button("hello", "hello, world", "alert('Hello world!')");  // This is invalid.
 aux.add({ text, button });
 
@@ -1228,10 +1228,10 @@ AutoConnectElements contained in AutoConnectAux object are uniquely identified b
AutoConnectAux  aux;
 aux.load("SOME_JSON_DOCUMENT");
 
-// Retrieve the pointer of the AutoConnectText
+// Retrieve the pointer of the AutoConnectText
 AutoConnectText* text = reinterpret_cast<AutoConnectText*>(aux.getElement("TEXT_ELEMENT_NAME"));
 
-// Retrieve the reference of the AutoConnectText
+// Retrieve the reference of the AutoConnectText
 AutoConnectText& text = aux.getElement<AutoConnectText>("TEXT_ELEMENT_NAME");
 
@@ -1239,8 +1239,8 @@ AutoConnectElements contained in AutoConnectAux object are uniquely identified b
const String auxJson = String("{\"title\":\"Page 1 title\",\"uri\":\"/page1\",\"menu\":true,\"element\":[{\"name\":\"caption\",\"type\":\"ACText\",\"value\":\"hello, world\"}]}");
 AutoConnect portal;
 portal.load(auxJson);
-AutoConnectAux* aux = portal.aux("/page1");  // Identify the AutoConnectAux instance with uri
-AutoConnectText& text = aux->getElement<AutoConnectText>("caption");  // Cast to real type and access members
+AutoConnectAux* aux = portal.aux("/page1");  // Identify the AutoConnectAux instance with uri
+AutoConnectText& text = aux->getElement<AutoConnectText>("caption");  // Cast to real type and access members
 Serial.println(text.value);
 
@@ -1273,9 +1273,9 @@ AutoConnectElements contained in AutoConnectAux object are uniquely identified b

Enable AutoConnectElements during the Sketch execution

AutoConnectElemets have an enable attribute to activate its own HTML generation. Sketches can change the HTMLization of their elements dynamically by setting or resetting the enable value. An element whose the enable attribute is true will generate itself HTML and place on the custom Web page. And conversely, it will not generate the HTML when the value is false.

For example, to enable the submit button only when the ESP module is connected to the access point in STA mode, you can sketch the following:

-
#include <ESP8266WiFi.h>
-#include <ESP8266WebServer.h>
-#include <AutoConnect.h>
+
#include <ESP8266WiFi.h>
+#include <ESP8266WebServer.h>
+#include <AutoConnect.h>
 
 static const char AUX[] PROGMEM = R("
 {
@@ -1332,7 +1332,7 @@ AutoConnectElements contained in AutoConnectAux object are uniquely identified b
 

To load a JSON document as AutoConnectAux use the AutoConnect::load function and load the JSON document of each AutoConnectElement using the AutoConnectAux::loadElement function. Although the functions of both are similar, the structure of the target JSON document is different.

The AutoConnect::load function loads the entire AutoConnectAux and creates both the AutoConnectAux instance and each AutoConnectElement instance. A single JSON document can contain multiple custom Web pages. If you write JSON of AutoConnectAux as an array, the load function generates all the pages contained in that array. Therefore, it is necessary to supply the JSON document of AutoConnectAux as an input of the load function and must contain the elements described section JSON document structure for AutoConnectAux.

The AutoConnectAux::loadElement function loads the elements individually into an AutoConnectAux object. The structure of its supplying JSON document is not AutoConnectAux. It must be a JSON structure for AutoConnectElement, but you can specify an array.

-
// AutoConnectAux as a custom Web page.
+
// AutoConnectAux as a custom Web page.
 const char page[] PROGMEM = R"raw(
 {
   "title": "Settings",
@@ -1354,7 +1354,7 @@ AutoConnectElements contained in AutoConnectAux object are uniquely identified b
 }
 )raw";
 
-// Additional AutoConnectElements.
+// Additional AutoConnectElements.
 const char addons[] PROGMEM = R"raw(
 [
   {
@@ -1379,30 +1379,30 @@ AutoConnectElements contained in AutoConnectAux object are uniquely identified b
 AutoConnect     portal;
 AutoConnectAux* auxPage;
 
-// Load a custom Web page.
+// Load a custom Web page.
 portal.load(page);
 
-// Get a '/settings' page
+// Get a '/settings' page
 auxPage = portal.aux("/settings");
 
-// Also, load only AutoConnectRadio named the period.
+// Also, load only AutoConnectRadio named the period.
 auxPage->loadElement(addons, "period");
 
-// Retrieve a server name from an AutoConnectText value.
+// Retrieve a server name from an AutoConnectText value.
 AutoConnectText& serverName = auxPage->getElement<AutoConnectText>("server");
 Serial.println(serverName.value);
 

Saving AutoConnectElements with JSON

To save the AutoConnectAux or the AutoConnectElement as a JSON document, use the AutoConnectAux::saveElement function. It serializes the contents of the object based on the type of the AutoConnectElement. You can persist a serialized AutoConnectElements as a JSON document to a stream.

-
// Open a parameter file on the SPIFFS.
+
// Open a parameter file on the SPIFFS.
 SPIFFS.begin();
 FILE param = SPIFFS.open("/param", "w");
 
-// Save elements as the parameters.
+// Save elements as the parameters.
 auxPage->saveElement(param, { "server", "period" });
 
-// Close a parameter file.
+// Close a parameter file.
 param.close();
 SPIFFS.end();
 
@@ -1438,9 +1438,9 @@ AutoConnectElements contained in AutoConnectAux object are uniquely identified b

Where to pick up the values

A sketch composed of handlers can receive the value of AutoConnectElements entered in a custom Web page after sending, but that handler is different from the page where the value was entered. It is necessary to be aware that can accept the entered values by the next page handler after the transition.

Usually, two ways to retrieve entered values we have. One is to use the ESP8266WebServer::arg (or WebServer::arg for ESP32) function in the on handler attached by ESP8266WebServer (WebServer w/ESP32 also).

-
#include <ESP8266WiFi.h>
-#include <ESP8266WebServer.h>
-#include <AutoConnect.h>
+
#include <ESP8266WiFi.h>
+#include <ESP8266WebServer.h>
+#include <AutoConnect.h>
 
 static const char addonJson[] PROGMEM = R"raw(
 {
@@ -1466,21 +1466,21 @@ AutoConnectElements contained in AutoConnectAux object are uniquely identified b
 ESP8266WebServer webServer;
 AutoConnect portal(webServer);
 
-// Here, /feels handler
+// Here, /feels handler
 void feelsOn() {
 
-  // Retrieve the value of a input-box named "feels"
+  // Retrieve the value of a input-box named "feels"
   String feel = webServer.arg("feels");
 
-  // Echo back the value
+  // Echo back the value
   String echo = "<html><p style=\"color:blue;font-family:verdana;font-size:300%;\">" + feel + String(" and a bold world!</p></html>");
   webServer.send(200, "text/html", echo);
 }
 
 void setup() {
   delay(1000);
-  webServer.on("/feels", feelsOn);  // Register /feels handler
-  portal.load(addonJson);           // Load a custom Web page
+  webServer.on("/feels", feelsOn);  // Register /feels handler
+  portal.load(addonJson);           // Load a custom Web page
   portal.begin();
 }
 
@@ -1495,9 +1495,9 @@ AutoConnectElements contained in AutoConnectAux object are uniquely identified b
 

When you actually try the above sketch, there is no a root handler. So the URL that should be accessed first is /_ac concatenated with the local IP address of the esp8266 module.

Another method is effective when custom Web pages have complicated page transitions. It is a way to straight access the AutoConnectElements member value. You can get the AutoConnectElement with the specified name using the getElement function. The following sketch executes the above example with AutoConnect only, without using the function of ESP8266WebServer.

-
#include <ESP8266WiFi.h>
-#include <ESP8266WebServer.h>
-#include <AutoConnect.h>
+
#include <ESP8266WiFi.h>
+#include <ESP8266WebServer.h>
+#include <AutoConnect.h>
 
 const static char addonJson[] PROGMEM = R"raw(
 [
@@ -1536,26 +1536,26 @@ AutoConnectElements contained in AutoConnectAux object are uniquely identified b
 
 AutoConnect portal;
 
-// Here, /feels handler
+// Here, /feels handler
 String feelsOn(AutoConnectAux& aux, PageArgument& args) {
 
-  // Get the AutoConnectInput named "feels".
-  // The where() function returns an uri string of the AutoConnectAux that triggered this handler.
+  // Get the AutoConnectInput named "feels".
+  // The where() function returns an uri string of the AutoConnectAux that triggered this handler.
   AutoConnectAux* hello = portal.aux(portal.where());
   AutoConnectInput& feels = hello->getElement<AutoConnectInput>("feels");
 
-  // Get the AutoConnectText named "echo".
+  // Get the AutoConnectText named "echo".
   AutoConnectText&  echo = aux.getElement<AutoConnectText>("echo");
 
-  // Echo back from input-box to /feels page.
+  // Echo back from input-box to /feels page.
   echo.value = feels.value +  String(" and a bold world!");
   return String("");
 }
 
 void setup() {
   delay(1000);
-  portal.load(addonJson);                       // Load custom Web pages
-  portal.on("/feels", feelsOn, AC_EXIT_AHEAD);  // Register /feels handler
+  portal.load(addonJson);                       // Load custom Web pages
+  portal.on("/feels", feelsOn, AC_EXIT_AHEAD);  // Register /feels handler
   portal.begin();
 }
 
@@ -1606,34 +1606,34 @@ AutoConnectElements contained in AutoConnectAux object are uniquely identified b
 
 
 

The following example is a part of sketch contained the handlers.

-
// AutoConnect object declarations
+
// AutoConnect object declarations
 ACInput(input1);
 AutoConnectAux aux("/aux", { input1 });
 AutoConnect portal;
-// Pre-declare handlers
+// Pre-declare handlers
 String initialize(AutoConnectAux&, PageArgument&);
 String append(AutoConnectAux&, PageArgument&);
 
-// Register handlers and launch the portal.
+// Register handlers and launch the portal.
 aux.on(initialize, AC_AHEAD);
 aux.on(append, AC_LATER);
 portal.join(aux);
 portal.begin();
 
-// Some code here...
+// Some code here...
 
-// The handler called before HTML generating
+// The handler called before HTML generating
 String initialize(AutoConnectAux& aux, PageArgument& args) {
   AutoConnectInput& input1 = aux.getElement<AutoConnectInput>("input1");
-  // Set initial value for the input box in a custom Web page.
+  // Set initial value for the input box in a custom Web page.
   input1.value = "Initial value";
-  // Nothing appendix for a generated HTML.
+  // Nothing appendix for a generated HTML.
   return String();
 }
 
-// The handler called after HTML generated
+// The handler called after HTML generated
 String append(AutoConnectAux& aux, PageArgument& args) {
-  // Append an HTML
+  // Append an HTML
   return String("<p>This text has been added.</p>");
 }
 
@@ -1771,7 +1771,7 @@ ESP8266WebServer class will parse the query string and rebuilds its arguments wh } )r"; -// An on-page handler for '/' access +// An on-page handler for '/' access void onRoot() { String content = "<html>" @@ -1779,9 +1779,9 @@ ESP8266WebServer class will parse the query string and rebuilds its arguments wh "<body><div>INPUT: {{value}}</div></body>" "</html>"; - Input.fetchElement(); // Preliminary acquisition + Input.fetchElement(); // Preliminary acquisition - // For this steps to work, need to call fetchElement function beforehand. + // For this steps to work, need to call fetchElement function beforehand. String value = Input["input"].value; content.replace("{{value}}", value); server.send(200, "text/html", content); @@ -1790,7 +1790,7 @@ ESP8266WebServer class will parse the query string and rebuilds its arguments wh void setup() { Input.load(InputPage); portal.join(Input); - server.on("/", onRoot); // Register the on-page handler + server.on("/", onRoot); // Register the on-page handler portal.begin(); } @@ -1898,9 +1898,9 @@ ESP8266WebServer class will parse the query string and rebuilds its arguments wh

Transitions of the custom Web pages

Scope & Lifetime of AutoConnectAux

AutoConnectAux and AutoConnectElements must live while the custom Web pages are available. The implementation of the custom Web page inherits from requestHandler driven from ESP8266WebServer (WebServer for ESP32), so the instance of AutoConnectAux and AutoConnectElements must exist for the duration of effect of handleClient. The following example is incorrect for manipulating custom Web pages. Its AutoConnectAux instance will be destructed at the exit of the setup().

-
#include <ESP8266WiFi.h>
-#include <ESP8266WebServer.h>
-#include <AutoConnect.h>
+
#include <ESP8266WiFi.h>
+#include <ESP8266WebServer.h>
+#include <AutoConnect.h>
 
 static const auxPage[] PROGMEM = R"raw(
 {
@@ -1916,7 +1916,7 @@ ESP8266WebServer class will parse the query string and rebuilds its arguments wh
 AutoConnect  portal;
 
 void setup() {
-  // This declaration is wrong.
+  // This declaration is wrong.
   AutoConnectAux aux;
   aux.load(auxPage);
   portal.join(aux);
diff --git a/docs/acintro.html b/docs/acintro.html
index 09f6836..c55b5c4 100644
--- a/docs/acintro.html
+++ b/docs/acintro.html
@@ -988,10 +988,10 @@ The following JSON code and sketch will execute the custom Web page as an exampl
 ]
 

the Sketch -

#include <ESP8266WiFi.h>
-#include <ESP8266WebServer.h>
-#include <FS.h>
-#include <AutoConnect.h>
+
#include <ESP8266WiFi.h>
+#include <ESP8266WebServer.h>
+#include <FS.h>
+#include <AutoConnect.h>
 
 AutoConnect  portal;
 
@@ -1027,9 +1027,9 @@ The following JSON code and sketch will execute the custom Web page as an exampl
 
 
  • the Sketch is actually this: -

    #include <ESP8266WiFi.h>
    -#include <ESP8266WebServer.h>
    -#include <AutoConnect.h>
    +
    #include <ESP8266WiFi.h>
    +#include <ESP8266WebServer.h>
    +#include <AutoConnect.h>
     
     AutoConnect     portal;
     
    diff --git a/docs/acjson.html b/docs/acjson.html
    index 9824b64..9af0a37 100644
    --- a/docs/acjson.html
    +++ b/docs/acjson.html
    @@ -1692,11 +1692,11 @@
     An example of using each function is as follows.
     
    AutoConnect  portal;
     
    -// Loading from String
    +// Loading from String
     const String aux = String("{\"title\":\"Page 1 title\",\"uri\":\"/page1\",\"menu\":true,\"element\":[{\"name\":\"caption\",\"type\":\"ACText\",\"value\":\"hello, world\"}]}");
     portal.load(aux);
     
    -// Loading from PROGMEM
    +// Loading from PROGMEM
     const char aux[] PROGMEM = R"raw(
     {
       "title" : "Page 1 title",
    @@ -1713,7 +1713,7 @@ An example of using each function is as follows.
     )raw";
     portal.load(aux);
     
    -// Loading from Stream assumes "aux.json" file should be store in SPIFFS.
    +// Loading from Stream assumes "aux.json" file should be store in SPIFFS.
     File aux = SPIFFS.open("aux.json", "r");
     portal.load(aux);
     aux.close();
    @@ -1722,9 +1722,9 @@ An example of using each function is as follows.
     

    Adjust the JSON document buffer size

    AutoConnect uses ArduinoJson library's dynamic buffer to parse JSON documents. Its dynamic buffer allocation scheme depends on the version 5 or version 6 of ArduinoJson library. Either version must have enough buffer to parse the custom web page's JSON document successfully. AutoConnect has the following three constants internally to complete the parsing as much as possible in both ArduinoJson version. These constants are macro defined in AutoConnectDefs.h.

    If memory insufficiency occurs during JSON document parsing, you can adjust these constants to avoid insufficiency by using the JsonAssistant with deriving the required buffer size in advance.

    -
    #define AUTOCONNECT_JSONBUFFER_SIZE     256
    -#define AUTOCONNECT_JSONDOCUMENT_SIZE   (8 * 1024)
    -#define AUTOCONNECT_JSONPSRAM_SIZE      (16* 1024)
    +
    #define AUTOCONNECT_JSONBUFFER_SIZE     256
    +#define AUTOCONNECT_JSONDOCUMENT_SIZE   (8 * 1024)
    +#define AUTOCONNECT_JSONPSRAM_SIZE      (16* 1024)
     

    AUTOCONNECT_JSONBUFFER_SIZE

    diff --git a/docs/acupload.html b/docs/acupload.html index 463c09d..2711897 100644 --- a/docs/acupload.html +++ b/docs/acupload.html @@ -982,12 +982,12 @@

    The following sketch is an example that implements the above basic steps. The postUpload function is the on-handler and retrieves the AutoConnectFile as named upload_file. You should note that this handler is not for a custom Web page placed with its AutoConnectFile element. The uploaded file should be processed by the handler for the transition destination page from the AutoConnectFile element placed page. AutoConnect built-in upload handler will save the uploaded file to the specified device before invoking the postUpload function.

    However, If you use uploaded files in different situations, it may be more appropriate to place the actual handling process outside the handler. It applies for the parameter file, etc. The important thing is that you do not have to sketch file reception and storing logic by using the AutoConnectFile element and the upload handler built into the AutoConnect.

    -
    #include <ESP8266WiFi.h>
    -#include <ESP8266WebServer.h>
    -#include <FS.h>
    -#include <AutoConnect.h>
    +
    #include <ESP8266WiFi.h>
    +#include <ESP8266WebServer.h>
    +#include <FS.h>
    +#include <AutoConnect.h>
     
    -// Upload request custom Web page
    +// Upload request custom Web page
     static const char PAGE_UPLOAD[] PROGMEM = R"(
     {
       "uri": "/",
    @@ -1001,7 +1001,7 @@
     }
     )";
     
    -// Upload result display
    +// Upload result display
     static const char PAGE_BROWSE[] PROGMEM = R"(
     {
       "uri": "/upload",
    @@ -1018,32 +1018,32 @@
     
     ESP8266WebServer server;
     AutoConnect portal(server);
    -// Declare AutoConnectAux separately as a custom web page to access
    -// easily for each page in the post-upload handler.
    +// Declare AutoConnectAux separately as a custom web page to access
    +// easily for each page in the post-upload handler.
     AutoConnectAux auxUpload;
     AutoConnectAux auxBrowse;
     
    -/**
    - * Post uploading, AutoConnectFile's built-in upload handler reads the
    - * file saved in SPIFFS and displays the file contents on /upload custom
    - * web page. However, only files with mime type uploaded as text are
    - * displayed. A custom web page handler is called after upload.
    - * @param  aux  AutoConnectAux(/upload)
    - * @param  args PageArgument
    - * @return Uploaded text content
    - */
    +/**
    + * Post uploading, AutoConnectFile's built-in upload handler reads the
    + * file saved in SPIFFS and displays the file contents on /upload custom
    + * web page. However, only files with mime type uploaded as text are
    + * displayed. A custom web page handler is called after upload.
    + * @param  aux  AutoConnectAux(/upload)
    + * @param  args PageArgument
    + * @return Uploaded text content
    + */
     String postUpload(AutoConnectAux& aux, PageArgument& args) {
       String  content;
       AutoConnectFile&  upload = auxUpload["upload_file"].as<AutoConnectFile>();
       AutoConnectText&  aux_filename = aux["filename"].as<AutoConnectText>();
       AutoConnectText&  aux_size = aux["size"].as<AutoConnectText>();
       AutoConnectText&  aux_contentType = aux["content_type"].as<AutoConnectText>();
    -  // Assignment operator can be used for the element attribute.
    +  // Assignment operator can be used for the element attribute.
       aux_filename.value = upload.value;
       aux_size.value = String(upload.size);
       aux_contentType.value = upload.mimeType;
    -  // The file saved by the AutoConnect upload handler is read from
    -  // the EEPROM and echoed to a custom web page.
    +  // The file saved by the AutoConnect upload handler is read from
    +  // the EEPROM and echoed to a custom web page.
       SPIFFS.begin();
       File uploadFile = SPIFFS.open(String("/" + upload.value).c_str(), "r");
       if (uploadFile) {
    @@ -1091,8 +1091,8 @@
     
     

    The substance of AC_File_FS (fs) is a SPIFFS file system implemented by the ESP8266/ESP32 core, and then AutoConnect uses the Global Instance SPIFFS to access SPIFFS.

    Also, the substance of AC_File_SD (sd) is a FAT file of Arduino SD library ported to the ESP8266/ESP32 core, and then AutoConnect uses the Global Instance SD to access SD. When saving to an external SD device, there are additional required parameters for the connection interface and is defined as the macro in AutoConnectDefs.h.

    -
    #define AUTOCONNECT_SD_CS       SS
    -#define AUTOCONNECT_SD_SPEED    4000000
    +
    #define AUTOCONNECT_SD_CS       SS
    +#define AUTOCONNECT_SD_SPEED    4000000
     

    AUTOCONNECT_SD_CS defines which GPIO for the CS (Chip Select, or SS as Slave Select) pin. This definition is derived from pins_arduino.h, which is included in the Arduino core distribution. If you want to assign the CS pin to another GPIO, you need to change the macro definition of AutoConnectDefs.h.

    @@ -1219,9 +1219,9 @@
    uploadClassSpecifies the custom upload class instance.

    The rough structure of the Sketches that completed these implementations will be as follows:

    -
    #include <ESP8266WiFi.h>
    -#include <ESP8266WebServer.h>
    -#include <AutoConnect.h>
    +
    #include <ESP8266WiFi.h>
    +#include <ESP8266WebServer.h>
    +#include <AutoConnect.h>
     
     static const char PAGE_UPLOAD[] PROGMEM = R"(
     {
    @@ -1247,7 +1247,7 @@
     }
     )";
     
    -// Custom upload handler class
    +// Custom upload handler class
     class CustomUploader : public AutoConnectUploadHandler {
     public:
       CustomUploader() {}
    @@ -1259,31 +1259,31 @@
       void   _close(void) override;
     };
     
    -// _open for custom open
    +// _open for custom open
     bool CustomUploader::_open(const char* filename, const char* mode) {
    -  // Here, an implementation for the open file.
    +  // Here, an implementation for the open file.
     }
     
    -// _open for custom write
    +// _open for custom write
     size_t CustomUploader::_write(const uint8_t *buf, const size_t size) {
    -  // Here, an implementation for the writing the file data.
    +  // Here, an implementation for the writing the file data.
     }
     
    -// _open for custom close
    +// _open for custom close
     void CustomUploader::_close(void) {
    -  // Here, an implementation for the close file.
    +  // Here, an implementation for the close file.
     }
     
     AutoConnect     portal;
     AutoConnectAux  uploadPage;
     AutoConnectAux  receivePage;
    -CustomUploader  uploader;   // Declare the custom uploader
    +CustomUploader  uploader;   // Declare the custom uploader
     
     void setup() {
       uploadPage.load(PAGE_UPLOAD);
       receivePage.load(PAGE_RECEIVED);
       portal.join({ uploadPage, receivePage });
    -  receivePage.onUpload<CustomUploader>(uploader);  // Register the custom uploader
    +  receivePage.onUpload<CustomUploader>(uploader);  // Register the custom uploader
       portal.begin();
     }
     
    diff --git a/docs/advancedusage.html b/docs/advancedusage.html
    index db41afe..379f019 100644
    --- a/docs/advancedusage.html
    +++ b/docs/advancedusage.html
    @@ -1370,25 +1370,25 @@ See the Saved credentials access chapter for details o
     

    The Sketch can abort the AutoConnect::begin by setting the captive portal timeout and returns control to Sketch. 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 AutoConnect::begin. The default value is macro defined by AUTOCONNECT_TIMEOUT in the AutoConnectDefs.h file.

    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 immediateStart option to create sketches with high mobility.

    The timeout of the captive portal is specified together with AutoConnectConfig::portalTimeout as follows.

    -

    #include <ESP8266WiFi.h>
    -#include <ESP8266WebServer.h>
    -#include <AutoConnect.h>
    +

    #include <ESP8266WiFi.h>
    +#include <ESP8266WebServer.h>
    +#include <AutoConnect.h>
     
     AutoConnect  portal;
     AutoConnectConfig  config;
     
     void setup() {
    -  config.portalTimeout = 60000;  // It will time out in 60 seconds
    +  config.portalTimeout = 60000;  // It will time out in 60 seconds
       portal.config(config);
       portal.begin();
     }
     
     void loop() {
       if (WiFi.status() == WL_CONNECTED) {
    -    // Some sketch code for the connected scene is here.
    +    // Some sketch code for the connected scene is here.
       }
       else {
    -    // Some sketch code for not connected scene is here.
    +    // Some sketch code for not connected scene is here.
       }
       portal.handleClient();
     }
    @@ -1397,7 +1397,7 @@ Also, if you want to stop AutoConnect completely when the captive portal is time
     
    bool acEnable;
     
     void setup() {
    -  config.portalTimeout = 60000;  // It will time out in 60 seconds
    +  config.portalTimeout = 60000;  // It will time out in 60 seconds
       portal.config(config);
       acEnable = portal.begin();
       if (!acEnable) {
    @@ -1407,10 +1407,10 @@ Also, if you want to stop AutoConnect completely when the captive portal is time
     
     void loop() {
       if (WiFi.status() == WL_CONNECTED) {
    -    // Some sketch code for the connected scene is here.
    +    // Some sketch code for the connected scene is here.
       }
       else {
    -    // Some sketch code for not connected scene is here.
    +    // Some sketch code for not connected scene is here.
       }
       if (acEnable) {
         portal.handleClient();
    @@ -1419,15 +1419,15 @@ Also, if you want to stop AutoConnect completely when the captive portal is time
     

    There is another option related to timeout in AutoConnectConfig. It can make use of the captive portal function even after a timeout. The AutoConnectConfig::retainPortal 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.

    -
    #include <ESP8266WiFi.h>
    -#include <ESP8266WebServer.h>
    -#include <AutoConnect.h>
    +
    #include <ESP8266WiFi.h>
    +#include <ESP8266WebServer.h>
    +#include <AutoConnect.h>
     
     AutoConnect  portal;
     AutoConnectConfig  config;
     
     void setup() {
    -  config.portalTimeout = 60000;  // It will time out in 60 seconds
    +  config.portalTimeout = 60000;  // It will time out in 60 seconds
       config.retainPortal = true;
       portal.config(config);
       portal.begin();
    @@ -1435,10 +1435,10 @@ Also, if you want to stop AutoConnect completely when the captive portal is time
     
     void loop() {
       if (WiFi.status() == WL_CONNECTED) {
    -    // Some sketch code for the connected scene is here.
    +    // Some sketch code for the connected scene is here.
       }
       else {
    -    // Some sketch code for not connected scene is here.
    +    // Some sketch code for not connected scene is here.
       }
       portal.handleClient();
     }
    @@ -1455,20 +1455,20 @@ Also, if you want to stop AutoConnect completely when the captive portal is time
     
  • Begin the portal.
  • Performs AutoConnect::handleClient in the loop function.
  • -
    #include <ESP8266WiFi.h>
    -#include <ESP8266WebServer.h>
    -#include <AutoConnect.h>
    +
    #include <ESP8266WiFi.h>
    +#include <ESP8266WebServer.h>
    +#include <AutoConnect.h>
     
     ESP8266WebServer  server;
     
    -// Declaration for casting legacy page to AutoConnect menu.
    -// Specifies an uri and the menu label.
    +// Declaration for casting legacy page to AutoConnect menu.
    +// Specifies an uri and the menu label.
     AutoConnect       portal(server);
    -AutoConnectAux    hello("/hello", "Hello");   // Step #1 as the above procedure
    +AutoConnectAux    hello("/hello", "Hello");   // Step #1 as the above procedure
     
    -// Step #2 as the above procedure
    -// A conventional web page driven by the ESP8266WebServer::on handler.
    -// This is a legacy.
    +// Step #2 as the above procedure
    +// A conventional web page driven by the ESP8266WebServer::on handler.
    +// This is a legacy.
     void handleHello() {
       server.send(200, "text/html", String(F(
     "<html>"
    @@ -1479,19 +1479,19 @@ Also, if you want to stop AutoConnect completely when the captive portal is time
     }
     
     void setup() {
    -  // Step #3 as the above procedure
    -  // Register the "on" handler as usual to ESP8266WebServer.
    -  // Match this URI with the URI of AutoConnectAux to cast.
    +  // Step #3 as the above procedure
    +  // Register the "on" handler as usual to ESP8266WebServer.
    +  // Match this URI with the URI of AutoConnectAux to cast.
       server.on("/hello", handleHello);
     
    -  // Step #4 as the above procedure
    -  // Joins AutoConnectAux to cast the page via the handleRoot to AutoConnect.
    +  // Step #4 as the above procedure
    +  // Joins AutoConnectAux to cast the page via the handleRoot to AutoConnect.
       portal.join({ hello });
    -  portal.begin();           // Step #5 as the above procedure
    +  portal.begin();           // Step #5 as the above procedure
     }
     
     void loop() {
    -  portal.handleClient();    // Step #6 as the above procedure
    +  portal.handleClient();    // Step #6 as the above procedure
     }
     
    @@ -1503,15 +1503,15 @@ Also, if you want to stop AutoConnect completely when the captive portal is time
  • Overwrite the label literal of library source code directly.

    You can change the label of the AutoConnect menu item by rewriting the default label literal in AutoConnectLabels.h macros. However, changing menu items literal influences all the Sketch's build scenes.

    -
    #define AUTOCONNECT_MENULABEL_CONFIGNEW   "Configure new AP"
    -#define AUTOCONNECT_MENULABEL_OPENSSIDS   "Open SSIDs"
    -#define AUTOCONNECT_MENULABEL_DISCONNECT  "Disconnect"
    -#define AUTOCONNECT_MENULABEL_RESET       "Reset..."
    -#define AUTOCONNECT_MENULABEL_UPDATE      "Update"
    -#define AUTOCONNECT_MENULABEL_HOME        "HOME"
    -#define AUTOCONNECT_MENULABEL_DEVINFO     "Device info"
    -#define AUTOCONNECT_BUTTONLABEL_RESET     "RESET"
    -#define AUTOCONNECT_BUTTONLABEL_UPDATE    "UPDATE"
    +
    #define AUTOCONNECT_MENULABEL_CONFIGNEW   "Configure new AP"
    +#define AUTOCONNECT_MENULABEL_OPENSSIDS   "Open SSIDs"
    +#define AUTOCONNECT_MENULABEL_DISCONNECT  "Disconnect"
    +#define AUTOCONNECT_MENULABEL_RESET       "Reset..."
    +#define AUTOCONNECT_MENULABEL_UPDATE      "Update"
    +#define AUTOCONNECT_MENULABEL_HOME        "HOME"
    +#define AUTOCONNECT_MENULABEL_DEVINFO     "Device info"
    +#define AUTOCONNECT_BUTTONLABEL_RESET     "RESET"
    +#define AUTOCONNECT_BUTTONLABEL_UPDATE    "UPDATE"
     
    @@ -1528,9 +1528,9 @@ And PlatformIO is a build system. Library sources will not be compiled unless Au

    Combination with mDNS

    With mDNS library, you can access to ESP8266 by name instead of IP address after connection. The Sketch can start the MDNS responder after AutoConnect::begin.

    -
    #include <ESP8266WiFi.h>
    -#include <ESP8266mDNS.h>
    -#include <ESP8266WebServer.h>
    +
    #include <ESP8266WiFi.h>
    +#include <ESP8266mDNS.h>
    +#include <ESP8266WebServer.h>
     AutoConnect Portal;
     
     void setup() {
    @@ -1594,7 +1594,7 @@ Combining these two parameters allows you to filter the destination AP when mult
     
     

    Debug print

    You can output AutoConnect monitor messages to the Serial. A monitor message activation switch is in an include header file AutoConnectDefs.h of library source. Define AC_DEBUG macro to output the monitor messages.1

    -
    #define AC_DEBUG
    +
    #define AC_DEBUG
     

    Disable the captive portal

    @@ -1632,8 +1632,8 @@ Combining these two parameters allows you to filter the destination AP when mult

    You can use this template if the ESP module does not connect to WiFi at an ordinal situation and need to establish by a manual trigger. In this case, it is desirable that AutoConnect not start until an external switch fires. This behavior is similar to the WiFiManager's startConfigPortal function.
    AutoConnectConfig::immediateStart is an option to launch the portal by the SoftAP immediately without attempting 1st-WiFi.begin. Also, by setting the AutoConnectConfig::autoRise option to false, it is possible to suppress unintended automatic pop-ups of the portal screen when connecting to an ESP module SSID.
    To implement this, execute AutoConnect::config within the setup() function as usual, and handle AutoConnect::begin inside the loop() function.

    -
    #define TRIGGER_PIN 5     // Trigger switch should be LOW active.
    -#define HOLD_TIMER  3000
    +
    #define TRIGGER_PIN 5     // Trigger switch should be LOW active.
    +#define HOLD_TIMER  3000
     
     AutoConnect       Portal;
     AutoConnectConfig Config;
    @@ -1641,7 +1641,7 @@ To implement this, execute AutoConnect::config within the setup()void setup() {
       pinMode(5, INPUT_PULLUP);
       Config.immediateStart = true;
    -  // Config.autoRise = false;   // If you don't need to automatically pop-up the portal when connected to the ESP module's SSID.
    +  // Config.autoRise = false;   // If you don't need to automatically pop-up the portal when connected to the ESP module's SSID.
       Portal.config(Config);
     }
     
    @@ -1651,18 +1651,18 @@ To implement this, execute AutoConnect::config within the setup()while (digitalRead(TRIGGER_PIN) == LOW) {
           yield();
         }
    -    // Hold the switch while HOLD_TIMER time to start connect.
    +    // Hold the switch while HOLD_TIMER time to start connect.
         if (millis() - tm > HOLD_TIMER)
           Portal.begin();
       }
     
       if (WiFi.status() == WL_CONNECTED) {
    -    // Here, what to do if the module has connected to a WiFi access point
    +    // Here, what to do if the module has connected to a WiFi access point
       }
     
    -  // Main process of your sketch
    +  // Main process of your sketch
     
    -  Portal.handleClient();  // If WiFi is not connected, handleClient will do nothing.
    +  Portal.handleClient();  // If WiFi is not connected, handleClient will do nothing.
     }
     
    @@ -1678,9 +1678,9 @@ Known access point credentials are saved by AutoConnect, to the ESP module can u
    AutoConnect* portal = nullptr;
     
     bool detectSwitch() {
    -  /*
    -  Returns true if an external switch to configure is active.
    -  */
    +  /*
    +  Returns true if an external switch to configure is active.
    +  */
     }
     
     bool connectWiFi(const char* ssid, const char* password, unsigned long timeout) {
    @@ -1704,7 +1704,7 @@ Known access point credentials are saved by AutoConnect, to the ESP module can u
           break;
       }
       if (WiFi.status() != WL_CONNECTED) {
    -    // Here, do something when WiFi cannot reach.
    +    // Here, do something when WiFi cannot reach.
       }
     }
     
    @@ -1722,7 +1722,7 @@ Known access point credentials are saved by AutoConnect, to the ESP module can u
           portal = nullptr;
         }
       }
    -  // Here, ordinally sketch logic.
    +  // Here, ordinally sketch logic.
     }
     
    @@ -1743,9 +1743,9 @@ Known access point credentials are saved by AutoConnect, to the ESP module can u

    Usage for automatically instantiated ESP8266WebServer/WebServer

    The Sketch can handle URL requests using ESP8266WebServer or WebServer that AutoConnect started internally. ESP8266WebServer/WebServer instantiated dynamically by AutoConnect can be referred to by AutoConnect::host function. The Sketch can use the 'on' function, 'send' function, 'client' function and others by ESP8266WebServer/WebServer reference of its return value.

    -
    #include <ESP8266WiFi.h>
    -#include <ESP8266WebServer.h>
    -#include <AutoConnect.h>
    +
    #include <ESP8266WiFi.h>
    +#include <ESP8266WebServer.h>
    +#include <AutoConnect.h>
     
     AutoConnect       Portal;
     
    @@ -1764,16 +1764,16 @@ Known access point credentials are saved by AutoConnect, to the ESP module can u
       if (r) {
         ESP8266WebServer& IntServer = Portal.host();
         IntServer.on("/", handleRoot);
    -    Portal.onNotFound(handleNotFound);    // For only onNotFound.
    +    Portal.onNotFound(handleNotFound);    // For only onNotFound.
       }
     }
     
     void loop() {
       Portal.host().handleClient();
       Portal.handleRequest();
    -  /* or following one line code is equ.
    -  Portal.handleClient();
    -  */
    +  /* or following one line code is equ.
    +  Portal.handleClient();
    +  */
     }
     
    @@ -1873,7 +1873,7 @@ See the Updates with the Web Browser chapter for d AutoConnectConfig Config; void setup() { - // Set menu title + // Set menu title Config.title = "FSBrowser"; Portal.config(Config); Portal.begin(); @@ -1936,7 +1936,7 @@ But this method is not recommended. The broadcast radio of SSID emitted from Sof

    Relocate the AutoConnect home path

    A home path of AutoConnect is /_ac by default. You can access from the browser with http://IPADDRESS/_ac. You can change the home path by revising AUTOCONNECT_URI macro in the include header file as AutoConnectDefs.h.

    -
    #define AUTOCONNECT_URI         "/_ac"
    +
    #define AUTOCONNECT_URI         "/_ac"
     

    Static IP assignment 2

    @@ -1986,10 +1986,10 @@ But this method is not recommended. The broadcast radio of SSID emitted from Sof
  • No blink: WiFi connection with access point established and data link enabled. (i.e. WiFi.status = WL_CONNECTED)
  • The flicker cycle length is defined by some macros in AutoConnectDefs.h header file.

    -
    #define AUTOCONNECT_FLICKER_PERIODAP  1000 // [ms]
    -#define AUTOCONNECT_FLICKER_PERIODDC  (AUTOCONNECT_FLICKER_PERIODAP << 1) // [ms]
    -#define AUTOCONNECT_FLICKER_WIDTHAP   96  // (8 bit resolution)
    -#define AUTOCONNECT_FLICKER_WIDTHDC   16  // (8 bit resolution)
    +
    #define AUTOCONNECT_FLICKER_PERIODAP  1000 // [ms]
    +#define AUTOCONNECT_FLICKER_PERIODDC  (AUTOCONNECT_FLICKER_PERIODAP << 1) // [ms]
    +#define AUTOCONNECT_FLICKER_WIDTHAP   96  // (8 bit resolution)
    +#define AUTOCONNECT_FLICKER_WIDTHDC   16  // (8 bit resolution)
     
      diff --git a/docs/api.html b/docs/api.html index 06c3c6a..6f8fcf2 100644 --- a/docs/api.html +++ b/docs/api.html @@ -1145,29 +1145,29 @@

      Include headers

      AutoConnect.h

      -
      #include <AutoConnect.h>
      +
      #include <AutoConnect.h>
       

      Defined macros

      They contain in AutoConnectDefs.h.

      -
      #define AC_DEBUG                                // Monitor message output activation
      -#define AC_DEBUG_PORT           Serial          // Default message output device
      -#define AUTOCONNECT_AP_IP       0x011CD9AC      // Default SoftAP IP
      -#define AUTOCONNECT_AP_GW       0x011CD9AC      // Default SoftAP Gateway IP
      -#define AUTOCONNECT_AP_NM       0x00FFFFFF      // Default subnet mask
      -#define AUTOCONNECT_DNSPORT     53              // Default DNS port at captive portal
      -#define AUTOCONNECT_HTTPPORT    80              // Default HTTP
      -#define AUTOCONNECT_MENU_TITLE  "AutoConnect"   // Default AutoConnect menu title
      -#define AUTOCONNECT_URI         "/_ac"          // Default AutoConnect root path
      -#define AUTOCONNECT_TIMEOUT     30000           // Default connection timeout[ms]
      -#define AUTOCONNECT_CAPTIVEPORTAL_TIMEOUT  0    // Captive portal timeout value
      -#define AUTOCONNECT_STARTUPTIME 30              // Default waiting time[s] for after reset
      -#define AUTOCONNECT_USE_JSON                    // Allow AutoConnect elements to be handled by JSON format
      -#define AUTOCONNECT_USE_UPDATE                  // Indicator of whether to use the AutoConnectUpdate feature.
      -#define AUTOCONNECT_UPDATE_PORT 8000            // Available HTTP port number for the update
      -#define AUTOCONNECT_UPDATE_TIMEOUT  8000        // HTTP client timeout limitation for the update [ms]
      -#define AUTOCONNECT_TICKER_PORT LED_BUILTIN     // Ticker port
      -#endif
      +
      #define AC_DEBUG                                // Monitor message output activation
      +#define AC_DEBUG_PORT           Serial          // Default message output device
      +#define AUTOCONNECT_AP_IP       0x011CD9AC      // Default SoftAP IP
      +#define AUTOCONNECT_AP_GW       0x011CD9AC      // Default SoftAP Gateway IP
      +#define AUTOCONNECT_AP_NM       0x00FFFFFF      // Default subnet mask
      +#define AUTOCONNECT_DNSPORT     53              // Default DNS port at captive portal
      +#define AUTOCONNECT_HTTPPORT    80              // Default HTTP
      +#define AUTOCONNECT_MENU_TITLE  "AutoConnect"   // Default AutoConnect menu title
      +#define AUTOCONNECT_URI         "/_ac"          // Default AutoConnect root path
      +#define AUTOCONNECT_TIMEOUT     30000           // Default connection timeout[ms]
      +#define AUTOCONNECT_CAPTIVEPORTAL_TIMEOUT  0    // Captive portal timeout value
      +#define AUTOCONNECT_STARTUPTIME 30              // Default waiting time[s] for after reset
      +#define AUTOCONNECT_USE_JSON                    // Allow AutoConnect elements to be handled by JSON format
      +#define AUTOCONNECT_USE_UPDATE                  // Indicator of whether to use the AutoConnectUpdate feature.
      +#define AUTOCONNECT_UPDATE_PORT 8000            // Available HTTP port number for the update
      +#define AUTOCONNECT_UPDATE_TIMEOUT  8000        // HTTP client timeout limitation for the update [ms]
      +#define AUTOCONNECT_TICKER_PORT LED_BUILTIN     // Ticker port
      +#endif
       
      diff --git a/docs/apiaux.html b/docs/apiaux.html index 8c86cb7..6c766c7 100644 --- a/docs/apiaux.html +++ b/docs/apiaux.html @@ -1146,9 +1146,9 @@ Get vector of reference of all elements.
      A reference to std::vector of reference to AutoConnecctElements.

      The getElements returns a reference to std::vector of reference to AutoConnecctElements. This function is provided to handle AutoConnectElemets owned by AutoConnectAux in bulk, and you can use each method of std::vector for a return value.

      -
      // An example of getting type and name of all AutoConnectElements registered in AutoConnectAux.
      +
      // An example of getting type and name of all AutoConnectElements registered in AutoConnectAux.
       AutoConnectAux aux;
      -// some code here...
      +// some code here...
       AutoConnectElementVt& elements = aux.getElements();
       for (AutoConnectElement& elm : elements) {
           Serial.printf("name<%s> as type %d\n", elm.name.c_str(), (int)elm.typeOf());
      @@ -1361,11 +1361,11 @@ Sets the value of the specified AutoConnectElement. If values ​​is specified
       

      You can directly access the value member variable.

      If you are gripping with the Sketch to the AutoConnectElements of the target that sets the value, you can access the value member variable directly. The following sketch code has the same effect.

      AutoConnectAux aux;
      -// ... Griping the AutoConnectText here.
      +// ... Griping the AutoConnectText here.
       aux.setElementValue("TEXT_FIELD", "New value");
       
      AutoConnectAux aux;
      -// ... Griping the AutoConnectText here.
      +// ... Griping the AutoConnectText here.
       AutoConnectText& text = aux.getElement<AutoConnectText>("TEXT_FIELD");
       text.value = "New value";
       
      diff --git a/docs/apiconfig.html b/docs/apiconfig.html index ec8a98b..a8a374d 100644 --- a/docs/apiconfig.html +++ b/docs/apiconfig.html @@ -1598,24 +1598,24 @@ However, even if you specify like the above, the AutoConnectAux page items still

      AutoConnectConfig example

      AutoConnect        Portal;
      -AutoConnectConfig  Config("", "passpass");    // SoftAp name is determined at runtime
      -Config.apid = ESP.hostname();                 // Retrieve host name to SotAp identification
      -Config.apip = IPAddress(192,168,10,101);      // Sets SoftAP IP address
      -Config.gateway = IPAddress(192,168,10,1);     // Sets WLAN router IP address
      -Config.netmask = IPAddress(255,255,255,0);    // Sets WLAN scope
      -Config.autoReconnect = true;                  // Enable auto-reconnect
      -Config.autoSave = AC_SAVECREDENTIAL_NEVER;    // No save credential
      -Config.boundaryOffset = 64;                   // Reserve 64 bytes for the user data in EEPROM.
      -Config.portalTimeout = 60000;                 // Sets timeout value for the captive portal
      -Config.retainPortal = true;                   // Retains the portal function after timed-out
      -Config.homeUri = "/index.html";               // Sets home path of Sketch application
      -Config.title ="My menu";                      // Customize the menu title
      -Config.staip = IPAddress(192,168,10,10);      // Sets static IP
      -Config.staGateway = IPAddress(192,168,10,1);  // Sets WiFi router address
      -Config.staNetmask = IPAddress(255,255,255,0); // Sets WLAN scope
      -Config.dns1 = IPAddress(192,168,10,1);        // Sets primary DNS address
      -Portal.config(Config);                        // Configure AutoConnect
      -Portal.begin();                               // Starts and behaves captive portal
      +AutoConnectConfig  Config("", "passpass");    // SoftAp name is determined at runtime
      +Config.apid = ESP.hostname();                 // Retrieve host name to SotAp identification
      +Config.apip = IPAddress(192,168,10,101);      // Sets SoftAP IP address
      +Config.gateway = IPAddress(192,168,10,1);     // Sets WLAN router IP address
      +Config.netmask = IPAddress(255,255,255,0);    // Sets WLAN scope
      +Config.autoReconnect = true;                  // Enable auto-reconnect
      +Config.autoSave = AC_SAVECREDENTIAL_NEVER;    // No save credential
      +Config.boundaryOffset = 64;                   // Reserve 64 bytes for the user data in EEPROM.
      +Config.portalTimeout = 60000;                 // Sets timeout value for the captive portal
      +Config.retainPortal = true;                   // Retains the portal function after timed-out
      +Config.homeUri = "/index.html";               // Sets home path of Sketch application
      +Config.title ="My menu";                      // Customize the menu title
      +Config.staip = IPAddress(192,168,10,10);      // Sets static IP
      +Config.staGateway = IPAddress(192,168,10,1);  // Sets WiFi router address
      +Config.staNetmask = IPAddress(255,255,255,0); // Sets WLAN scope
      +Config.dns1 = IPAddress(192,168,10,1);        // Sets primary DNS address
      +Portal.config(Config);                        // Configure AutoConnect
      +Portal.begin();                               // Starts and behaves captive portal
       
      diff --git a/docs/basicusage.html b/docs/basicusage.html index b720014..5c53d34 100644 --- a/docs/basicusage.html +++ b/docs/basicusage.html @@ -1034,8 +1034,8 @@

      2. Declare AutoConnect object

      Two options are available for AutoConnect constructor.

      -

      AutoConnect VARIABLE(&ESP8266WebServer);  // For ESP8266
      -AutoConnect VARIABLE(&WebServer);         // For ESP32
      +

      AutoConnect VARIABLE(&ESP8266WebServer);  // For ESP8266
      +AutoConnect VARIABLE(&WebServer);         // For ESP32
       
      or

      AutoConnect VARIABLE;
      diff --git a/docs/changelabel.html b/docs/changelabel.html
      index 014956d..0b9e205 100644
      --- a/docs/changelabel.html
      +++ b/docs/changelabel.html
      @@ -964,10 +964,10 @@
       
       
       

      The definition of label text must conform to a certain coding pattern. Undefine with #undef the #define directive corresponding to the above IDs, and then redefine the ID with the replacement text. And surround it with #ifdef ~ #endif.

      -
      #ifdef AUTOCONNECT_MENULABEL_CONFIGNEW
      -#undef AUTOCONNECT_MENULABEL_CONFIGNEW
      -#define AUTOCONNECT_MENULABEL_CONFIGNEW   "NEW_STRING_YOU_WISH"
      -#endif
      +
      #ifdef AUTOCONNECT_MENULABEL_CONFIGNEW
      +#undef AUTOCONNECT_MENULABEL_CONFIGNEW
      +#define AUTOCONNECT_MENULABEL_CONFIGNEW   "NEW_STRING_YOU_WISH"
      +#endif
       

      You may not need to rewrite all definitions. It depends on your wishes and is sufficient that the above the include file contains only the labels you need.

      diff --git a/docs/changelog.html b/docs/changelog.html index 7088bc5..14c413d 100644 --- a/docs/changelog.html +++ b/docs/changelog.html @@ -122,7 +122,7 @@ - + Skip to content @@ -737,6 +737,13 @@
        +
      • + + [1.1.7] Apr. 19, 2020 + + +
      • +
      • [1.1.6] Apr. 17, 2020 @@ -939,6 +946,13 @@
          +
        • + + [1.1.7] Apr. 19, 2020 + + +
        • +
        • [1.1.6] Apr. 17, 2020 @@ -1119,7 +1133,11 @@

          Change log

          -

          [1.1.6] Apr. 17, 2020

          +

          [1.1.7] Apr. 19, 2020

          +
            +
          • Fixed Apply button not work.
          • +
          +

          [1.1.6] Apr. 17, 2020

          • Fixed OTA page translation not work.
          diff --git a/docs/colorized.html b/docs/colorized.html index ac709d0..bce18a0 100644 --- a/docs/colorized.html +++ b/docs/colorized.html @@ -902,23 +902,23 @@ Defines the active menu item background color.

          Typical color schemes

          Here are some color schemes picked up.

          Indigo

          -
          #define AUTOCONNECT_MENUCOLOR_TEXT        "#ffa500"
          -#define AUTOCONNECT_MENUCOLOR_BACKGROUND  "#1a237e"
          -#define AUTOCONNECT_MENUCOLOR_ACTIVE      "#283593"
          +
          #define AUTOCONNECT_MENUCOLOR_TEXT        "#ffa500"
          +#define AUTOCONNECT_MENUCOLOR_BACKGROUND  "#1a237e"
          +#define AUTOCONNECT_MENUCOLOR_ACTIVE      "#283593"
           

          Dim-gray

          -
          #define AUTOCONNECT_MENUCOLOR_TEXT        "#fffacd"
          -#define AUTOCONNECT_MENUCOLOR_BACKGROUND  "#696969"
          -#define AUTOCONNECT_MENUCOLOR_ACTIVE      "#808080"
          +
          #define AUTOCONNECT_MENUCOLOR_TEXT        "#fffacd"
          +#define AUTOCONNECT_MENUCOLOR_BACKGROUND  "#696969"
          +#define AUTOCONNECT_MENUCOLOR_ACTIVE      "#808080"
           

          Brown

          -
          #define AUTOCONNECT_MENUCOLOR_TEXT        "#e6e6fa"
          -#define AUTOCONNECT_MENUCOLOR_BACKGROUND  "#3e2723"
          -#define AUTOCONNECT_MENUCOLOR_ACTIVE      "#4e342e"
          +
          #define AUTOCONNECT_MENUCOLOR_TEXT        "#e6e6fa"
          +#define AUTOCONNECT_MENUCOLOR_BACKGROUND  "#3e2723"
          +#define AUTOCONNECT_MENUCOLOR_ACTIVE      "#4e342e"
           

          diff --git a/docs/credit.html b/docs/credit.html index 283780c..0df109a 100644 --- a/docs/credit.html +++ b/docs/credit.html @@ -1062,7 +1062,7 @@

          If you are using an Arduino core for ESP32 1.0.2 earlier and need to use credentials in EEPROM for backward compatibility, turns off the AUTOCONNECT_USE_PREFERENCES3 macro definition in AutoConnectCredentials.h file. AutoConnect behaves assuming that credentials are stored in EEPROM if AUTOCONNECT_USE_PREFERENCES is not defined.

          AutoConnectCredential

          Include header

          -
          #include <AutoConnectCredential.h>
          +
          #include <AutoConnectCredential.h>
           

          Constructors

          @@ -1157,7 +1157,7 @@ The following function is an implementation example, and you can use it to achie uint8_t ssid[32]; uint8_t password[64]; uint8_t bssid[6]; - uint8_t dhcp; /**< 0:DHCP, 1:Static IP */ + uint8_t dhcp; /**< 0:DHCP, 1:Static IP */ union _config { uint32_t addr[5]; struct _sta { diff --git a/docs/datatips.html b/docs/datatips.html index 55bc33b..5291597 100644 --- a/docs/datatips.html +++ b/docs/datatips.html @@ -999,7 +999,7 @@ You can shorten it and write as like:

          Date & Time

          The easiest way is to use the Arduino Time Library. Sketches must accommodate differences in date and time formats depending on the time zone. You can absorb the difference in DateTime format by using sscanf function.1

          -
          #include <TimeLib.h>
          +
          #include <TimeLib.h>
           
           time_t tm;
           int Year, Month, Day, Hour, Minute, Second;
          @@ -1026,9 +1026,9 @@ You can shorten it and write as like:
           

          To convert input data correctly from the string, it must match its format. The validation implementation with sketches depends on various perspectives. Usually, the tiny devices have no enough power for the lexical analysis completely. But you can reduce the burden for data verification using the pattern of AutoConnectInput.

          By giving a pattern to AutoConnectInput, you can find errors in data format while typing in custom Web pages. Specifying the input data rule as a regular expression will validate the type match during input. If there is an error in the format during input, the background color of the field will change to pink. Refer to section Handling the custom Web pages.

          However, input data will be transmitted even if the value does not match the pattern. Sketches require the validation of the received data. You can use the AutoConnectInput::isValid function to validate it. The isValid function validates whether the value member variable matches a pattern and returns true or false.

          -
          #include <ESP8266WiFi.h>
          -#include <ESP8266WebServer.h>
          -#include <AutoConnect.h>
          +
          #include <ESP8266WiFi.h>
          +#include <ESP8266WebServer.h>
          +#include <AutoConnect.h>
           
           static const char input_page[] PROGMEM = R"raw(
           [
          @@ -1108,7 +1108,7 @@ You can shorten it and write as like:
           

          email address 2

          -
          ^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$
          +
          ^[a-zA-Z0-9.!#$%&'*+\/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$
           

          IP Address

          diff --git a/docs/faq.html b/docs/faq.html index 70cb8cf..8337f73 100644 --- a/docs/faq.html +++ b/docs/faq.html @@ -1290,7 +1290,7 @@ For AutoConnect menus to work properly, call

          Disable an AutoConnectUpdate feature if you don't need.

          You can disable the AutoConnectUpdate feature by commenting out the AUTOCONNECT_USE_UPDATE macro in the AutoConnectDefs.h header file. -

          #define AUTOCONNECT_USE_UPDATE
          +
          #define AUTOCONNECT_USE_UPDATE
           

        • @@ -1329,7 +1329,7 @@ You have the following two options to avoid this conflict:

          Does not appear esp8266ap in smartphone.

          Maybe it is successfully connected at the first WiFi.begin. ESP8266 remembers the last SSID successfully connected and will use at the next. It means SoftAP will only start up when the first WiFi.begin() fails.

          The saved SSID would be cleared by WiFi.disconnect() with WIFI_STA mode. If you do not want automatic reconnection, you can erase the memorized SSID with the following simple sketch.

          -
          #include <ESP8266WiFi.h>
          +
          #include <ESP8266WiFi.h>
           
           void setup() {
             delay(1000);
          @@ -1390,7 +1390,7 @@ You have the following two options to avoid this conflict:

          You can use the AutoConnect::onDetect exit routine. For more details and an implementation example of the onDetect exit routine, refer to the chapter "Captive portal start detection".

          How change HTTP port?

          HTTP port number is defined as a macro in AutoConnectDefs.h header file. You can change it directly with several editors and must re-compile.

          -
          #define AUTOCONNECT_HTTPPORT    80
          +
          #define AUTOCONNECT_HTTPPORT    80
           

          How change SSID or Password in Captive portal?

          @@ -1399,7 +1399,7 @@ You have the following two options to avoid this conflict:

          If you don't use ArduinoJson at all, you can detach it from the library. By detaching ArduinoJson, the binary size after compilation can be reduced. You can implement custom Web pages with your sketches without using ArduinoJson. Its method is described in Custom Web pages w/o JSON.
          To completely remove ArduinoJson at compile-time from the binary, you need to define a special #define directive for it. And if you define the directive, you will not be able to use the OTA update with the update server feature as well as AutoConnectAux described by JSON.

          To exclude ArduinoJson at compile-time, give the following #define directive as a compiler option such as the arduino-cli or PlatformIO.

          -
          #define AUTOCONNECT_NOUSE_JSON
          +
          #define AUTOCONNECT_NOUSE_JSON
           

          For example, add the following description to the [env] section of the platformio.ini file with the build-flags.

          @@ -1451,9 +1451,9 @@ Also, you can check the memory running out status by rebuilding the Sketch with
          AutoConnect portal;
           AutoConnectConfig config;
           
          -config.channel = 3;     // Specifies a channel number that matches the AP
          -portal.config(config);  // Apply channel configurration
          -portal.begin();         // Start the portal
          +config.channel = 3;     // Specifies a channel number that matches the AP
          +portal.config(config);  // Apply channel configurration
          +portal.begin();         // Start the portal
           
          @@ -1470,11 +1470,11 @@ Also, you can check the memory running out status by rebuilding the Sketch with

          3. Turn on the debug log options

          To fully enable for the AutoConnect debug logging options, change the following two files.

          AutoConnectDefs.h

          -
          #define AC_DEBUG
          +
          #define AC_DEBUG
           

          PageBuilder.h 2

          -
          #define PB_DEBUG
          +
          #define PB_DEBUG
           

          4. Reports the issue to AutoConnect Github repository

          diff --git a/docs/gettingstarted.html b/docs/gettingstarted.html index 2f0ba04..1628e93 100644 --- a/docs/gettingstarted.html +++ b/docs/gettingstarted.html @@ -881,11 +881,11 @@

          Let's do the most simple sketch

          Open the Arduino IDE, write the following sketch and upload it. The feature of this sketch is that the SSID and Password are not coded.

          -
          #include <ESP8266WiFi.h>          // Replace with WiFi.h for ESP32
          -#include <ESP8266WebServer.h>     // Replace with WebServer.h for ESP32
          -#include <AutoConnect.h>
          +
          #include <ESP8266WiFi.h>          // Replace with WiFi.h for ESP32
          +#include <ESP8266WebServer.h>     // Replace with WebServer.h for ESP32
          +#include <AutoConnect.h>
           
          -ESP8266WebServer Server;          // Replace with WebServer for ESP32
          +ESP8266WebServer Server;          // Replace with WebServer for ESP32
           AutoConnect      Portal(Server);
           
           void rootPage() {
          diff --git a/docs/howtoembed.html b/docs/howtoembed.html
          index 140c4cc..34024e3 100644
          --- a/docs/howtoembed.html
          +++ b/docs/howtoembed.html
          @@ -1054,9 +1054,9 @@
           

          the Sketch, Publishes messages

          The complete code of the Sketch is mqttRSSI.ino in the AutoConnect repository. Replace the following #define in a sketch with User API Key, Write API Key and Channel ID. After Keys updated, compile the Sketch and upload it.

          -
          #define MQTT_USER_KEY        "****************"  // Replace to User API Key.
          -#define CHANNEL_ID           "******"            // Replace to Channel ID.
          -#define CHANNEL_API_KEY_WR   "****************"  // Replace to the write API Key.
          +
          #define MQTT_USER_KEY        "****************"  // Replace to User API Key.
          +#define CHANNEL_ID           "******"            // Replace to Channel ID.
          +#define CHANNEL_API_KEY_WR   "****************"  // Replace to the write API Key.
           

          Publish messages

          diff --git a/docs/menu.html b/docs/menu.html index e57d95d..94fa2b7 100644 --- a/docs/menu.html +++ b/docs/menu.html @@ -1008,7 +1008,7 @@ Enter SSID and Passphrase and tap "Apply" to start a WiFi conne

          HOME

          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.

          -
          #define AUTOCONNECT_HOMEURI     "/"
          +
          #define AUTOCONNECT_HOMEURI     "/"
           

          Also, you can change the HOME path using the AutoConnect API. The AutoConnect::home function sets the URI as a link of the HOME item in the AutoConnect menu.

          diff --git a/docs/otabrowser.html b/docs/otabrowser.html index fbe5503..e563ec0 100644 --- a/docs/otabrowser.html +++ b/docs/otabrowser.html @@ -922,32 +922,32 @@
        • Invokes AutoConnect::handleClient function in the loop().
        • -
          #include <ESP8266WiFi.h>            // Step #1
          -#include <ESP8266WebServer.h>       // Step #1
          -#include <AutoConnect.h>            // Step #1
          +
          #include <ESP8266WiFi.h>            // Step #1
          +#include <ESP8266WebServer.h>       // Step #1
          +#include <AutoConnect.h>            // Step #1
           
          -ESP8266WebServer  server;           // Step #2
          -AutoConnect       portal(server);   // Step #3
          -AutoConnectConfig config;           // Step #4
          -AutoConnectAux    hello;            // Step #5
          +ESP8266WebServer  server;           // Step #2
          +AutoConnect       portal(server);   // Step #3
          +AutoConnectConfig config;           // Step #4
          +AutoConnectAux    hello;            // Step #5
           
           static const char HELLO_PAGE[] PROGMEM = R"(
           { "title": "Hello world", "uri": "/", "menu": true, "element": [
               { "name": "caption", "type": "ACText", "value": "<h2>Hello, world</h2>",  "style": "text-align:center;color:#2f4f4f;padding:10px;" },
               { "name": "content", "type": "ACText", "value": "In this page, place the custom web page handled by the Sketch application." } ]
           }
          -)";                                 // Step #5
          +)";                                 // Step #5
           
           void setup() {
          -  config.ota = AC_OTA_BUILTIN;      // Step #6.a
          -  portal.config(config);            // Step #6.a
          -  hello.load(HELLO_PAGE);           // Step #6.b
          -  portal.join({ hello });           // Step #6.c
          -  portal.begin();                   // Step #6.d
          +  config.ota = AC_OTA_BUILTIN;      // Step #6.a
          +  portal.config(config);            // Step #6.a
          +  hello.load(HELLO_PAGE);           // Step #6.b
          +  portal.join({ hello });           // Step #6.c
          +  portal.begin();                   // Step #6.d
           }
           
           void loop() {
          -  portal.handleClient();            // Step #7
          +  portal.handleClient();            // Step #7
           }
           
          @@ -959,9 +959,9 @@ The AutoConnectOTA activates the ticker constantly regardless of the AutoConnectOTA allocation URI

          AutoConnectOTA has implemented using AutoConnectAUX. So it occupies two URIs by default. An update operation page is assigned to AUTOCONNECT_URI_UPDATE and the binary file uploader for the update is assigned to AUTOCONNECT_URI_UPDATE_ACT. These symbols are defined in the AutoConnectDefs.h header file as follows:

          -
          #define AUTOCONNECT_URI             "/_ac"
          -#define AUTOCONNECT_URI_UPDATE      AUTOCONNECT_URI "/update"
          -#define AUTOCONNECT_URI_UPDATE_ACT  AUTOCONNECT_URI "/update_act"
          +
          #define AUTOCONNECT_URI             "/_ac"
          +#define AUTOCONNECT_URI_UPDATE      AUTOCONNECT_URI "/update"
          +#define AUTOCONNECT_URI_UPDATE_ACT  AUTOCONNECT_URI "/update_act"
           

          Therefore, the normal Sketch that imports AutoConnectOTA while keeping the default, you cannot use the two URIs /_ac/update and /_ac/update_act for your specific. If you want to use the URIs for any purpose other than AutoConnectOTA, you need to override the AutoConnectDefs.h definition at compile time. It can be overwritten by giving the build flags for platformio.ini as follows with the PlatformIO environment for example.

          @@ -974,11 +974,11 @@ The AutoConnectOTA activates the ticker constantly regardless of the AutoConnect::handleClient process. AutoConnect will evaluate the enabled state of AutoConnectConfig::ota each time the handleClient is executed, and if OTA is enabled then it creates an AutoConnectAux internally and assigns it to the update page. At this time, AutoConnectOTA is also instantiated together. The generated AUX page containing AutoConnectOTA is bound to AutoConnect inside the AutoConnect::handleClient process.

          If you want to attach AutoConnectOTA dynamically with an external trigger, you can sketch like this:
          This sketch imports the OTA update feature with an external switch assigned to the GPIO pin. While the trigger not occurs, AutoConnect OTA will not be imported into Sketch and will not appear on the menu list.

          -
          #include <ESP8266WiFi.h>
          -#include <ESP8266WebServer.h>
          -#include <AutoConnect.h>
          +
          #include <ESP8266WiFi.h>
          +#include <ESP8266WebServer.h>
          +#include <AutoConnect.h>
           
          -#define TRIGGER 4   // pin assigned to external trigger switch
          +#define TRIGGER 4   // pin assigned to external trigger switch
           
           AutoConnect portal;
           AutoConnectConfig config;
          @@ -1026,11 +1026,11 @@ To embed the ESP8266HTTPUpdateServer class with AutoConnect into your sketch, ba
           
           
        • Invokes AutoConnect::handleClient function in the loop().
        • -
          #include <ESP8266WiFi.h>
          -#include <ESP8266WebServer.h>
          -#include <ESP8266HTTPUpdateServer.h>    // Step #1
          -#include <WiFiClient.h>                 // Step #1
          -#include <AutoConnect.h>
          +
          #include <ESP8266WiFi.h>
          +#include <ESP8266WebServer.h>
          +#include <ESP8266HTTPUpdateServer.h>    // Step #1
          +#include <WiFiClient.h>                 // Step #1
          +#include <AutoConnect.h>
           
           static const char HELLO_PAGE[] PROGMEM = R"(
           { "title": "Hello world", "uri": "/", "menu": true, "element": [
          @@ -1039,21 +1039,21 @@ To embed the ESP8266HTTPUpdateServer class with AutoConnect into your sketch, ba
           }
           )";
           
          -ESP8266WebServer httpServer;                // Step #2
          -ESP8266HTTPUpdateServer httpUpdate;         // Step #3
          -AutoConnect portal(httpServer);             // Step #4
          -AutoConnectAux update("/update", "UPDATE"); // Step #5, #6, #7
          -AutoConnectAux hello;                       // Step #8
          +ESP8266WebServer httpServer;                // Step #2
          +ESP8266HTTPUpdateServer httpUpdate;         // Step #3
          +AutoConnect portal(httpServer);             // Step #4
          +AutoConnectAux update("/update", "UPDATE"); // Step #5, #6, #7
          +AutoConnectAux hello;                       // Step #8
           
           void setup() {
          -  httpUpdate.setup(&httpServer, "USERNAME", "PASSWORD"); // Step #9.a
          -  hello.load(HELLO_PAGE);                   // Step #9.b
          -  portal.join({ hello, update });           // Step #9.c
          -  portal.begin();                           // Step #9.d
          +  httpUpdate.setup(&httpServer, "USERNAME", "PASSWORD"); // Step #9.a
          +  hello.load(HELLO_PAGE);                   // Step #9.b
          +  portal.join({ hello, update });           // Step #9.c
          +  portal.begin();                           // Step #9.d
           }
           
           void loop() {
          -  portal.handleClient();                    // Step #10
          +  portal.handleClient();                    // Step #10
           }
           
          diff --git a/docs/otaserver.html b/docs/otaserver.html index 7ffb462..1738d2f 100644 --- a/docs/otaserver.html +++ b/docs/otaserver.html @@ -951,22 +951,22 @@ The AutoConnect library provides an update server script implemented in Python t
        • Attach the AutoConnectUpdate object to AutoConnect using AutoConnectUpdate::attach function.
        • Invokes AutoConnect::handleClient function in the loop().
        • -
          #include <ESP8266WiFi.h>
          -#include <ESP8266WebServer.h>
          -#include <AutoConnect.h>
          +
          #include <ESP8266WiFi.h>
          +#include <ESP8266WebServer.h>
          +#include <AutoConnect.h>
           
          -ESP8266WebServer server;                          // Step #1
          -AutoConnect portal;                               // Step #2
          -AutoConnectUpdate update("192.168.0.100", 8000);  // Step #3
          +ESP8266WebServer server;                          // Step #1
          +AutoConnect portal;                               // Step #2
          +AutoConnectUpdate update("192.168.0.100", 8000);  // Step #3
           
           void setup() {
          -  if (portal.begin()) {     // Step #4
          -    update.attach(portal);  // Step #5
          +  if (portal.begin()) {     // Step #4
          +    update.attach(portal);  // Step #5
             }
           }
           
           void loop() {
          -  portal.handleClient();    // Step #6
          +  portal.handleClient();    // Step #6
           }
           
          diff --git a/docs/search/search_index.json b/docs/search/search_index.json index ce18c8a..b1f354c 100644 --- a/docs/search/search_index.json +++ b/docs/search/search_index.json @@ -1 +1 @@ -{"config":{"lang":["en"],"prebuild_index":false,"separator":"[\\s\\-]+"},"docs":[{"location":"index.html","text":"AutoConnect for ESP8266/ESP32 \u00b6 An Arduino library for ESP8266/ESP32 WLAN configuration at run time with web interface. Overview \u00b6 To the dynamic configuration for joining to WLAN with SSID and PSK accordingly. It an Arduino library united with ESP8266WebServer class for ESP8266 or WebServer class for ESP32. Easy implementing the Web interface constituting the WLAN for ESP8266/ESP32 WiFi connection. With this library to make a Sketch easily which connects from ESP8266/ESP32 to the access point at runtime by the web interface without hard-coded SSID and password. No need pre-coded SSID & password \u00b6 It is no needed hard-coding in advance the SSID and Password into the Sketch to connect between ESP8266/ESP32 and WLAN. You can input SSID & Password from a smartphone via the web interface at runtime. Simple usage \u00b6 AutoConnect control screen will be displayed automatically for establishing new connections. It aids by the captive portal when vested the connection cannot be detected. By using the AutoConnect menu , to manage the connections convenient. Store the established connection \u00b6 The connection authentication data as credentials are saved automatically in the flash of ESP8266/ESP32 and You can select the past SSID from the AutoConnect menu . Easy to embed in \u00b6 AutoConnect can be placed easily in your Sketch. It's \" begin \" and \" handleClient \" only. Lives with your Sketches \u00b6 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. Easy to add the custom Web pages ENHANCED w/v0.9.7 \u00b6 You can easily add your owned web pages 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. Quick and easy to equip the OTA update feature UPDATED w/v1.1.5 \u00b6 You can quickly and easily equip the OTA update feature to your Sketch and also you can operate the firmware update process via OTA from AutoConnect menu. Installation \u00b6 Requirements \u00b6 Supported hardware \u00b6 Generic ESP8266 modules (applying the ESP8266 Community's Arduino core) Adafruit HUZZAH ESP8266 (ESP-12) ESP-WROOM-02 Heltec WiFi Kit 8 NodeMCU 0.9 (ESP-12) / NodeMCU 1.0 (ESP-12E) Olimex MOD-WIFI-ESP8266 SparkFun Thing SweetPea ESP-210 ESP32Dev Board (applying the Espressif's arduino-esp32 core) SparkFun ESP32 Thing WEMOS LOLIN D32 Ai-Thinker NodeMCU-32S Heltec WiFi Kit 32 M5Stack And other ESP8266/ESP32 modules supported by the Additional Board Manager URLs of the Arduino-IDE. About flash size on the module The AutoConnect Sketch size is relatively large. Large flash capacity is necessary. 512Kbyte (4Mbits) flash inclusion module such as ESP-01 is not recommended. Required libraries \u00b6 AutoConnect requires the following environment and libraries. Arduino IDE The current upstream at the 1.8 level or later is needed. Please install from the official Arduino IDE download page . This step is not required if you already have a modern version. ESP8266 Arduino core AutoConnect targets Sketches made on the assumption of ESP8266 Community's Arduino core . Stable 2.4.0 or higher required and the latest release is recommended. Install third-party platform using the Boards Manager of Arduino IDE. Package URL is http://arduino.esp8266.com/stable/package_esp8266com_index.json ESP32 Arduino core Also, to apply AutoConnect to ESP32, the arduino-esp32 core provided by Espressif is needed. Stable 1.0.1 or required and the latest release is recommended. Install third-party platform using the Boards Manager of Arduino IDE. You can add multiple URLs into Additional Board Manager URLs field, separating them with commas. Package URL is https://dl.espressif.com/dl/package_esp32_index.json for ESP32. Arduino core for ESP32 1.0.3 or later For ESP32, AutoConnect v1.0.0 later is required for arduino-esp32 1.0.3 or later. Additional library (Required) The PageBuilder library to build HTML for ESP8266WebServer is needed. To install the PageBuilder library into your Arduino IDE, you can use the Library Manager . Select the board of ESP8266 series in the Arduino IDE, open the library manager and search keyword ' PageBuilder ' with the topic ' Communication ', then you can see the PageBuilder . The latest version is required 1.3.6 later . 1 Additional library (Optional) By adding the ArduinoJson library, AutoConnect will be able to handle the custom Web pages described with JSON. Since AutoConnect v0.9.7 you can insert user-owned web pages that can consist of representative HTML elements as styled TEXT, INPUT, BUTTON, CHECKBOX, SELECT, SUBMIT and invoke them from the AutoConnect menu. These HTML elements can be added by Sketches using the AutoConnect API. Further it possible importing the custom Web pages declarations described with JSON which stored in PROGMEM, SPIFFS, or SD. ArduinoJson is required to use this feature. 2 AutoConnect can work with ArduinoJson both version 5 and version 6 . Install the AutoConnect \u00b6 Clone or download from the AutoConnect GitHub repository . When you select Download, you can import it to Arduino IDE immediately. After downloaded, the AutoConnect-master.zip file will be saved in your download folder. Then in the Arduino IDE, navigate to \"Sketch > Include Library\" . At the top of the drop down list, select the option to \"Add .ZIP Library...\" . Details for Arduino official page . Supported by Library manager. AutoConnect was added to the Arduino IDE library manager. It can be used with the PlatformIO library also. window.onload = function() { Gifffer(); }; Since AutoConnect v1.1.3, PageBuilder v1.3.6 later is required. \u21a9 Using the AutoConnect API natively allows you to Sketch custom Web pages without JSON. \u21a9","title":"Overview"},{"location":"index.html#autoconnect-for-esp8266esp32","text":"An Arduino library for ESP8266/ESP32 WLAN configuration at run time with web interface.","title":"AutoConnect for ESP8266/ESP32"},{"location":"index.html#overview","text":"To the dynamic configuration for joining to WLAN with SSID and PSK accordingly. It an Arduino library united with ESP8266WebServer class for ESP8266 or WebServer class for ESP32. Easy implementing the Web interface constituting the WLAN for ESP8266/ESP32 WiFi connection. With this library to make a Sketch easily which connects from ESP8266/ESP32 to the access point at runtime by the web interface without hard-coded SSID and password.","title":"Overview"},{"location":"index.html#no-need-pre-coded-ssid-password","text":"It is no needed hard-coding in advance the SSID and Password into the Sketch to connect between ESP8266/ESP32 and WLAN. You can input SSID & Password from a smartphone via the web interface at runtime.","title":" No need pre-coded SSID & password"},{"location":"index.html#simple-usage","text":"AutoConnect control screen will be displayed automatically for establishing new connections. It aids by the captive portal when vested the connection cannot be detected. By using the AutoConnect menu , to manage the connections convenient.","title":" Simple usage"},{"location":"index.html#store-the-established-connection","text":"The connection authentication data as credentials are saved automatically in the flash of ESP8266/ESP32 and You can select the past SSID from the AutoConnect menu .","title":" Store the established connection"},{"location":"index.html#easy-to-embed-in","text":"AutoConnect can be placed easily in your Sketch. It's \" begin \" and \" handleClient \" only.","title":" Easy to embed in"},{"location":"index.html#lives-with-your-sketches","text":"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.","title":" Lives with your Sketches"},{"location":"index.html#easy-to-add-the-custom-web-pages-enhanced-wv097","text":"You can easily add your owned web pages 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.","title":" Easy to add the custom Web pages ENHANCED w/v0.9.7"},{"location":"index.html#quick-and-easy-to-equip-the-ota-update-feature-updated-wv115","text":"You can quickly and easily equip the OTA update feature to your Sketch and also you can operate the firmware update process via OTA from AutoConnect menu.","title":" Quick and easy to equip the OTA update feature UPDATED w/v1.1.5"},{"location":"index.html#installation","text":"","title":"Installation"},{"location":"index.html#requirements","text":"","title":"Requirements"},{"location":"index.html#supported-hardware","text":"Generic ESP8266 modules (applying the ESP8266 Community's Arduino core) Adafruit HUZZAH ESP8266 (ESP-12) ESP-WROOM-02 Heltec WiFi Kit 8 NodeMCU 0.9 (ESP-12) / NodeMCU 1.0 (ESP-12E) Olimex MOD-WIFI-ESP8266 SparkFun Thing SweetPea ESP-210 ESP32Dev Board (applying the Espressif's arduino-esp32 core) SparkFun ESP32 Thing WEMOS LOLIN D32 Ai-Thinker NodeMCU-32S Heltec WiFi Kit 32 M5Stack And other ESP8266/ESP32 modules supported by the Additional Board Manager URLs of the Arduino-IDE. About flash size on the module The AutoConnect Sketch size is relatively large. Large flash capacity is necessary. 512Kbyte (4Mbits) flash inclusion module such as ESP-01 is not recommended.","title":"Supported hardware"},{"location":"index.html#required-libraries","text":"AutoConnect requires the following environment and libraries. Arduino IDE The current upstream at the 1.8 level or later is needed. Please install from the official Arduino IDE download page . This step is not required if you already have a modern version. ESP8266 Arduino core AutoConnect targets Sketches made on the assumption of ESP8266 Community's Arduino core . Stable 2.4.0 or higher required and the latest release is recommended. Install third-party platform using the Boards Manager of Arduino IDE. Package URL is http://arduino.esp8266.com/stable/package_esp8266com_index.json ESP32 Arduino core Also, to apply AutoConnect to ESP32, the arduino-esp32 core provided by Espressif is needed. Stable 1.0.1 or required and the latest release is recommended. Install third-party platform using the Boards Manager of Arduino IDE. You can add multiple URLs into Additional Board Manager URLs field, separating them with commas. Package URL is https://dl.espressif.com/dl/package_esp32_index.json for ESP32. Arduino core for ESP32 1.0.3 or later For ESP32, AutoConnect v1.0.0 later is required for arduino-esp32 1.0.3 or later. Additional library (Required) The PageBuilder library to build HTML for ESP8266WebServer is needed. To install the PageBuilder library into your Arduino IDE, you can use the Library Manager . Select the board of ESP8266 series in the Arduino IDE, open the library manager and search keyword ' PageBuilder ' with the topic ' Communication ', then you can see the PageBuilder . The latest version is required 1.3.6 later . 1 Additional library (Optional) By adding the ArduinoJson library, AutoConnect will be able to handle the custom Web pages described with JSON. Since AutoConnect v0.9.7 you can insert user-owned web pages that can consist of representative HTML elements as styled TEXT, INPUT, BUTTON, CHECKBOX, SELECT, SUBMIT and invoke them from the AutoConnect menu. These HTML elements can be added by Sketches using the AutoConnect API. Further it possible importing the custom Web pages declarations described with JSON which stored in PROGMEM, SPIFFS, or SD. ArduinoJson is required to use this feature. 2 AutoConnect can work with ArduinoJson both version 5 and version 6 .","title":"Required libraries"},{"location":"index.html#install-the-autoconnect","text":"Clone or download from the AutoConnect GitHub repository . When you select Download, you can import it to Arduino IDE immediately. After downloaded, the AutoConnect-master.zip file will be saved in your download folder. Then in the Arduino IDE, navigate to \"Sketch > Include Library\" . At the top of the drop down list, select the option to \"Add .ZIP Library...\" . Details for Arduino official page . Supported by Library manager. AutoConnect was added to the Arduino IDE library manager. It can be used with the PlatformIO library also. window.onload = function() { Gifffer(); }; Since AutoConnect v1.1.3, PageBuilder v1.3.6 later is required. \u21a9 Using the AutoConnect API natively allows you to Sketch custom Web pages without JSON. \u21a9","title":"Install the AutoConnect"},{"location":"acelements.html","text":"The elements for the custom Web pages \u00b6 Representative HTML elements for making the custom Web page are provided as AutoConnectElements. AutoConnectButton : Labeled action button AutoConnectCheckbox : Labeled checkbox AutoConnectElement : General tag AutoConnectFile : File uploader AutoConnectInput : Labeled text input box AutoConnectRadio : Labeled radio button AutoConnectSelect : Selection list AutoConnectStyle : Custom CSS code AutoConnectSubmit : Submit button AutoConnectText : Style attributed text Layout on a custom Web page \u00b6 AutoConnect will not actively be involved in the layout of custom Web pages generated from AutoConnectElements. However, each element has an attribute to arrange placement on a custom web page by horizontally or vertically. Custom CSS for a custom Web page \u00b6 All custom Web page styles are limited to the built-in unique CSS embedded in the library code. Direct modification of the CSS affects AutoConnect behavior. You can use dedicated elements to relatively safely modify the style of your custom Web page. The AutoConnectStyle will insert the raw CSS code into the style block in HTML of the custom Web page. Form and AutoConnectElements \u00b6 All AutoConnectElements placed on custom web pages will be contained into one form. Its form is fixed and created by AutoConnect. The form value (usually the text or checkbox you entered) is sent by AutoConnectSubmit using the POST method with HTTP. The post method sends the actual form data which is a query string whose contents are the name and value of AutoConnectElements. You can retrieve the value for the parameter with the Sketch from the query string with ESP8266WebServer::arg function or PageArgument class of the AutoConnect::on handler when the form is submitted. AutoConnectElement - A basic class of elements \u00b6 AutoConnectElement is a base class for other element classes and has common attributes for all elements. It can also be used as a variant of each element. The following items are attributes that AutoConnectElement has and are common to other elements. Sample AutoConnectElement element(\"element\", \"
          \"); On the page: Constructor \u00b6 AutoConnectElement( const char * name, const char * value, const ACPosterior_t post) name \u00b6 Each element has a name. The name is the String data type. You can identify each element by the name to access it with sketches. value \u00b6 The value is the string which is a source to generate an HTML code. Characteristics of Value vary depending on the element. The value of AutoConnectElement is native HTML code. A string of value is output as HTML as it is. post \u00b6 The post specifies a tag to add behind the HTML code generated from the element. Its purpose is to place elements on the custom Web page as intended by the user sketch. AutoConnect will not actively be involved in the layout of custom Web pages generated from AutoConnectElements. Each element follows behind the previous one, with the exception of some elements. You can use the post value to arrange vertically or horizontal when the elements do not have the intended position on the custom Web Page specifying the following enumeration value as ACPosterior_t type for the post . AC_Tag_None : No generate additional tags. AC_Tag_BR : Add a
          tag to the end of the element. AC_Tag_P : Include the element in the

          ~

          tag. The default interpretation of the post value is specific to each element. AutoConnectElements Default interpretation of the post value AutoConnectElement AC_Tag_None AutoConnectButton AC_Tag_None AutoConnectCheckBox AC_Tag_BR AutoConnectFile AC_Tag_BR AutoConnectInput AC_Tag_BR AutoConnectRadio AC_Tag_BR AutoConnectSelect AC_Tag_BR AutoConnectSubmit AC_Tag_None AutoConnectText AC_Tag_None type \u00b6 The type indicates the type of the element and represented as the ACElement_t enumeration type in the Sketch. Since AutoConnectElement also acts as a variant of other elements, it can be applied to handle elements collectively. At that time, the type can be referred to by the typeOf() function. The following example changes the font color of all AutoConnectText elements of a custom Web page to gray. AutoConnectAux customPage; AutoConnectElementVT & elements = customPage.getElements(); for (AutoConnectElement & elm : elements) { if (elm.typeOf() == AC_Text) { AutoConnectText & text = reinterpret_cast < AutoConnectText &> (elm); text.style = \"color:gray;\" ; } } The enumerators for ACElement_t are as follows: AutoConnectButton: AC_Button AutoConnectCheckbox: AC_Checkbox AutoConnectElement: AC_Element AutoConnectFile: AC_File AutoConnectInput: AC_Input AutoConnectRadio: AC_Radio AutoConnectSelect: AC_Select AutoConnectStyle: AC_Style AutoConnectSubmit: AC_Submit AutoConnectText: AC_Text Uninitialized element: AC_Unknown Furthermore, to convert an entity that is not an AutoConnectElement to its native type, you must re-interpret that type with c++. Or, you can be coding the Sketch more easily with using the as function. AutoConnectAux customPage; AutoConnectElementVT & elements = customPage.getElements(); for (AutoConnectElement & elm : elements) { if (elm.type() == AC_Text) { AutoConnectText & text = customPage[elm.name].as < AutoConnectText > (); text.style = \"color:gray;\" ; // Or, it is also possible to write the code further reduced as follows. // customPage[elm.name].as().style = \"color:gray;\"; } } AutoConnectButton \u00b6 AutoConnectButton generates an HTML < button type = \"button\" > tag and locates a clickable button to a custom Web page. Currently AutoConnectButton corresponds only to name, value, an onclick attribute of HTML button tag. An onclick attribute is generated from an action member variable of the AutoConnectButton, which is mostly used with a JavaScript to activate a script. Sample AutoConnectButton button(\"button\", \"OK\", \"myFunction()\"); On the page: Constructor \u00b6 AutoConnectButton( const char * name, const char * value, const String & action, const ACPosterior_t post) name \u00b6 It is the name of the AutoConnectButton element and matches the name attribute of the button tag. It also becomes the parameter name of the query string when submitted. value \u00b6 It becomes a value of the value attribute of an HTML button tag. action \u00b6 action is String data type and is an onclick attribute fire on a mouse click on the element. It is mostly used with a JavaScript to activate a script. 1 For example, the following code defines a custom Web page that copies a content of Text1 to Text2 by clicking Button . const char * scCopyText = R\"( )\" ; ACInput(Text1, \"Text1\" ); ACInput(Text2, \"Text2\" ); ACButton(Button, \"COPY\" , \"CopyText()\" ); ACElement(TextCopy, scCopyText); post \u00b6 Specifies a tag to add behind the HTML code generated from the element. The default values is AC_Tag_None . AutoConnectCheckbox \u00b6 AutoConnectCheckbox generates an HTML < input type = \"checkbox\" > tag and a < label > tag. It places horizontally on a custom Web page by default. Sample AutoConnectCheckbox checkbox(\"checkbox\", \"uniqueapid\", \"Use APID unique\", false); On the page: Constructor \u00b6 AutoConnectCheckbox( const char * name, const char * value, const char * label, const bool checked, const ACPosition_t labelPosition, const ACPosterior_t post) name \u00b6 It is the name of the AutoConnectCheckbox element and matches the name attribute of the input tag. It also becomes the parameter name of the query string when submitted. value \u00b6 It becomes a value of the value attribute of an HTML < input type = \"checkbox\" > tag. label \u00b6 A label is an optional string. A label is always arranged on the right side of the checkbox. Specification of a label will generate an HTML