Giter VIP home page Giter VIP logo

autoconnect's Introduction

AutoConnect for ESP8266/ESP32

GitHub release Build Status arduino-library-badge PlatformIO Registry License

An Arduino library for ESP8266/ESP32 WLAN configuration at run time with web interface.

Overview

To the dynamic configuration for joining to WLAN with SSID and PSK accordingly. It an Arduino library united with ESP8266WebServer class of ESP8266 or WebServer class of ESP32. Easily 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.

Overview   Captiveportal

No need pre-coded SSID & password

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

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

The connection authentication data as credentials are saved automatically in EEPROM of ESP8266/ESP32 and You can select the past SSID from the AutoConnect menu.

Easy to embed in

AutoConnect can be embedded easily into your sketch, just "begin" and "handleClient".

Lives with the your sketches

The sketches which provide the web page using ESP8266WebServer/WebServer there is, AutoConnect will not disturb it. AutoConnect can use an already instantiated ESP8266WebServer object(ESP8266) or WebServer object(ESP32), or itself can assign it.

Easily add user-owned web screen and parameters ENHANCED w/ v0.9.7

You can easily add your own web screen that can consist of representative HTML elements as the styled TEXT, INPUT, BUTTON, CHECKBOX, RADIO, SELECT, SUBMIT into the menu. It can be invoked from the AutoConnect menu and parameters can be passed.

Just loading the JSON description ENHANCED w/ v0.9.7

These HTML elements that make up the user-owned screen can be easily loaded from the JSON description stored in PROGMEM, SPIFFS or SD.

Quick and easy to equip the OTA update feature ENHANCED w/ v1.0.0

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.

Supported hardware

Apply the Arduino core of the ESP8266 Community.

  • Generic ESP8266 modules
  • 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

Alter the platform applying the arduino-esp32 for the ESP32 modules.

  • ESP32Dev Board
  • SparkFun ESP32 Thing
  • WEMOS LOLIN D32
  • Ai-Thinker NodeMCU-32S
  • Heltec WiFi Kit 32
  • M5Stack
  • Unexpected Maker TinyPICO
  • And other ESP32 modules supported by the Additional Board Manager URLs of the Arduino-IDE.

Simple usage

The AutoConnect menu

How embed the AutoConnect to the sketches you have

Most simple approach to applying AutoConnect for the existing sketches, follow the below steps.

More usages and Documentation

Full documentation is available on https://Hieromon.github.io/AutoConnect, some quick links at the list:

  • The Installation is the installation procedure and requirements for the library.
  • Getting started with the most simple sketch for using AutoConnect.
  • The Basic usage guides to using the library correctly.
  • Details are explained in the Advanced usage.
  • Details and usage of custom Web pages are explained in the Custom Web pages.
  • The API reference describes the AutoConnect functions specification.
  • There are hints in Examples for making sketches with AutoConnect.
  • FAQ.

Change log

[1.4.2] Jan. 31, 2023

  • Supports whileConnecting exit called while waiting for WiFi connection. (Discussions #553)
  • Added AutoConnect::portalStatus function.
  • Fixed compilation error with ESP8266 Arduino Core 3.1.0 or later. (Issue #567)

[1.4.1] Jan. 5, 2023

  • Supports asynchronous communication of custom web pages using the Fetch API. This allows interaction with the user without page transitions. See the AutoConnect documentation for details. (Discussions #503)
  • Added the FetchLED example.
  • Added an AutoConnect::locate function.
  • Fixed AutoConnectConfigBase constructor missing to AutoConnectConfigExt. (Issue #551)

[1.4.0] Nov. 20, 2022

  • Custom web page related features were decoupled to allow for two different configurations, AutoConnectCore and AutoConnect. AutoConnectCore reduces memory consumption by focusing only on WiFi connectivity utilities. See the chapter Reducing Binary Size in the documentation for more information.
  • Supports credentials backup and restoration.
  • Added an AutoConnect::getCurrentCredential function.
  • Added an AutoConnectAux::referer function.
  • Added an AutoConnectConfig::preserveIP setting.
  • Added the WebSocketServer example.
  • Allow navigate to a custom URL once a WiFi connection is established. (Discussions #523)
  • Revised mqttRSSI examples program structure.
  • Fixed updateserver.py script security vulnerability. (Issue #526)

[1.3.7] Aug. 20, 2022

  • Fixed an authentication failure in Captive Portal state. (Issue #518)
  • Fixed loss of current SSID.

[1.3.6] Jul. 26, 2022

  • Fixed OTA being incomplete. (Issue #325)

[1.3.5] Jun. 03, 2022

  • Fixed Fixed OTA exit not being called. (Issue #325)
  • Fixed an ambiguous type call with IPAddress. (Issue #480)
  • Fixed loss of response due to OTA session reset occurrence.
  • Made fit the mqttRSSI examples to ThingSpeak's updated channel authentication.

[1.3.4] Mar. 02, 2022

  • Supports LittleFS_esp32 legacy library with ESP32 Arduino core 1.0.6 or less.
  • Added enablement of credentials removal function with Open SSIDs menu. (Discussions #433)
  • Fixed AutoConnectOTA crashing if there is no OTA partition.
  • Fixed AutoConnectUpdate crashing if there is no OTA partition.
  • Migrate the CI platform to GitHub actions.
Breaking changes:
  • Authentication has been applied to RESET menu. This avoids resetting modules in an unauthenticated state by direct access to /_ac/reset.

[1.3.3] Jan. 25, 2022

  • Fixed the missing initialization of MQTT parameter settings of mqttRSSI.ino example sketch.
  • Reverted the MQTT API endpoint of Thingspeak.com in the mqttRSSI example sketches.
  • Changed ESP32Cam XCLK to be attenuated to avoid interference with WiFi signals.

[1.3.2] Jan. 1, 2022

  • Supports AutoConnectRange as a new AutoConnectElement.
  • Added the responsive parameter with AutoConnectAux.
  • Added an AutoConnectAux::redirect function.
  • Added an example for using AutoConnect with the ESP32 camera driver as WebCamServer. This example includes examples of using the new AutoConnectRange and an AutoConnectAux::redirect function.
  • Fixed an issue where password is lost when SoftAP is stopped. (issue #425)

[1.3.1] Oct. 09, 2021

  • Fixed an issue that was incompatible with ArduinoJson version 5. (issue #408)
  • Fixed LittleFS mount check not working with ESP32.
  • Fixed autoReconnect not being able to restore a static IP setting. (issue #400)
  • Fixed that static IP settings were not cleared when loading credential.

[1.3.0] Sep. 25, 2021

  • Supports ESP8266 3.0.0 Arduino core.
  • Supports ESP32 Arduino core 2.0.0.
  • Supports LittleFS with ESP32.
  • Supports a callback with OTA status change. (issue #325)
  • Supports to save credentials always. (Discussions #385)
  • Supports AutoConnectConfigAux.
  • Added AutoConnect::getConfig function.
  • Added AutoConnectOTA status notification.
  • Added a style attribute for AutoConnectInput.
  • Added the div tag generation with the AutoConnectElement.
  • Fixed AUTOCONNECT_JSONDOCUMENT_SIZE was inoperative.
  • Fixed garbage being mixed in a loaded credential.
  • Fixed the layout on the page being corrupted with NUMBER type of AutoConnectInput.
  • Fixed the output place of Posterior attribute for AutoConnectRadio.
  • Fixed Incomplete deletion with AutoConnectCredential. (issue #388)
  • Fixed credentials not erased correctly. (issue #388)
  • Fixed AutoConnectText posterior being unavailable.
Important Notes:
  1. Upgraded Arduino core 2.0.0 for ESP32 will increase the compiled sketch binary size. Your sketch may not fit in the flash and may occur an error during the linkage phase.
    In ESP32 Arduino core 2.0.0, the default maximum sketch binary size is 1280 KB, an area of the same size is reserved for OTA. 1472 KB is added as a file system area to this. You can change this partition definition at will with Arduino IDE for each build. You can also reallocate the SPIFFS area to the sketch binary if the sketch does not require a large file. Select menu Tool > Partition Scheme, you will be able to find a partition scheme that fits your sketch. Also, in the PlatformIO environment, it can be changed by adding the board_build.partitions directive to the platformio.ini file. See FAQ of Documentation for details.
  2. When building a sketch in the PlatformIO environment, a compile error may appear that says: File system header file not found. This error can be avoided by setting the library search mode to the deep in with the platformio.ini file. See FAQ of Documentation for details.

[1.2.3] Jan. 3, 2021

Since AutoConnect v1.2.3, PageBuilder v1.5.0 or later is required. Please update PageBuilder latest.

  • Improved memory management

[1.2.2] Dec. 13, 2020

  • Fixed an issue where OTA updates would crash on the ESP32 platform. (issue #284)

[1.2.1] Dec. 5, 2020

  • Fixed that not declared error with AUTOCONNECT_NOUSE_JSON. (issue #282)

[1.2.0] Dec. 3, 2020

  • Supports LittleFS file system with ESP8266 platform.
  • Supports HTTP authentication. (issue #171)
  • Supports AutoConnectConfig::preserveAPMode setting. (issue #210)
  • Supports an onConnect exit.
  • Supports a whileCaptivePortal exit. (issue #149, issue #244)
  • Enhanced ticker to work even in handleClient loop.
  • Enhanced the ability to upload a regular file with AutoConnectOTA. (issue #236)
  • Enhanced AutoConnectInput to allow accepts password and number type. (issue #237, issue #255)
  • Enhanced handleClient to launch the captive portal when losing WiFi connection.
  • Added getEEPROMUsedSize that notifies the occupied size of the credential storage area. (issue #209)
  • Added the append and the detach function that can be dynamically AutoConnectAux attaching and detaching. (issue #230)
  • Added AUTOCONNECT_APKEY_SSID definition to seek access points by SSID. (issue #251)
  • Added AutoConnectConfig::beginTimeout setting. (issue #247)
  • Improved atuoReconnect to work even in handleClient loop. (issue #234, issue #251)
  • Fixed incorrect connection wait time. (issue #216)
  • Fixed an exception in the AutoConnect::end function.
  • Avoids an empty-body warning when AC_DEBUG is disabled. (issue #218)
  • Fixed not being able to specify channel ID with a mqttRSSI.ino example. (issue #262)
  • Fixed an invalid SPIFFS compile error with ESP32.
  • Fixed a core panic in the regex with ESP32.
  • Fixed posterior being disabled in AutoConnectElement.
  • Fixed deficiently forward references with HandleClient.ino example. (PR #275)

[1.1.7] Apr. 19, 2020

  • Fixed Apply button not work. (issue #206)

[1.1.6] Apr. 17, 2020

  • Fixed OTA page translation not work. (issue #204)

[1.1.5] Apr. 15, 2020

  • Changed the bootUri behavior to be an automatic pop-up at the captive portal. (PR #181)
  • Supports AutoConnect menu configuration.
  • Supports the built-in OTA feature.
  • Supports an attempt order when available APs would be found multiple, and RSSI lower bound on AP signal strength. This option can specify the order of connection attempting according to the WiFi signal strength indicated with RSSI. (PR #187)

[1.1.4] Feb. 14, 2020

  • Supports for overriding text of the menu items with user-defined labels.
  • Fixed the compiler warning with experimental WiFi mode of ESP8266.

[1.1.3] Jan. 1, 2020

  • Added AUTOCONNECT_NOUSE_JSON directive. (issue #167)
  • Removed compiler warning of unused.
  • Improved Config New button behavior. (issue #150)
  • Fixed relocate Config New menu URI inability.

[1.1.2] Oct. 22, 2019

  • Fixed crash when no SSID found.
  • Fixed memory leak on destruction. (PR #144)

[1.1.1] Oct. 17, 2019

  • Fixed crash with unique_ptr deleting reference content. (issue #138)
  • Fixed disconnection request initialization missing. (issue #139)

[1.1.0] Oct. 15, 2019

  • Supports static IPs with the 'Configure new AP' menu. (issue #132)
  • Fixed compilation error that no member named 'printTo' with ArduinoJson 5.

[1.0.3] Sept. 30, 2019

  • Fixed a return of AutoConnectCredential::entries(). (issue #133)

[1.0.2] Sept. 19, 2019

  • Fixed compilation error that no member named 'success' with ArduinoJson 5. (issue #130)
  • Fixed SSID non termination. (issue #128)
  • Fixed compilation error that getBytesLength missing with ESP32. (issue #125)
  • Added #include directive restriction for EEPROM and ESP8266httpUpdate to FAQ. (issue #127)

[1.0.1] Sept. 13, 2019

  • Added a sketch for ESP32 boards that migrates credentials stored in EEPROM partition to the Preferences.

[1.0.0] Sept. 7, 2019

  • Supports Arduino core for ESP32 1.0.3.
  • Supports AutoConnectUpdate for the OTA update.
  • Supports Preferences for saving credentials with ESP32 core 1.0.3 and later. In ESP32, the credentials stored past in EEPROM will lose.
  • Supports AutoConnectAux::isValid function.
  • Supports the global attribute with all AutoConnectElements.

[0.9.12] Aug. 18, 2019

  • Fixed missing captive portal notifications on the newer mobile OS client. As a result of this fix, the SoftAP default IP address and gateway have been changed to 172.217.28.1. (issue #85)

[0.9.11] July 13, 2019

  • Supports new element as AutoConnectSytle that can insert the custom CSS into AutoConnectAux page. (PR#96)
  • Supports that <br> tags can now be added to each element. (PR #95)
  • Supports that able to place the checkbox label forward or backward. (PR #99)
  • Supports flicker signal output according to the status of WiFi_mode. (issue #98)
  • Supports AutoConnectAux::fetchElement function to retrieve inputted element values via a custom Web page.
  • Fixed bug in AutoConnectCredential when offset is >256. (PR #103)

[0.9.10] June 12, 2019

  • Fixed the unable to get AutoConnectElemets values in the sketch with ESP8266 arduino core 2.5.2. (issue #90)
  • Fixed missing psram allocator. (issue #102)

[0.9.9] May 25, 2019

  • Supports ESP8266 Arduino core 2.5.2.
  • Menu text/background color can be statically customized. refer to the Custom colorized for the detailed specification for the menu colorizing.
  • Added ID attribute to HTML tag generated from AutoConnectText.
  • Added the enable attribute to the AutoConnectElements.
  • Fixed the input box layout collapsed.
  • Fixed that the decoration of AutoConnectButton was disabled.
  • Fixed that the value remains even after clearing the option with AutoConnectSelect.
  • Fixed that an alignment violation exception occurred when loading AutoConnectAux described by JSON with PROGMEM attribute.

[0.9.8] May 3, 2019

  • Supports ArduinoJson 6.9.1 or later.
  • Supports allocating JsonDocument buffer to PSRAM on ESP32 with ArduinoJson 6.10.0 or later.
  • Supports operator[] as a shortcut for AutoConnectAux::getElement function.
  • Supports AutoConnectElement::as<T> function to easily coding for conversion from an AutoConnectElement to an actual type.
  • Supports new element type AutoConnectFile and built-in file uploader.
  • Supports a format attribute with the AutoConnectText element.
  • Supports a selected attribute with the AutoConnectSelect element.
  • Supports multiple element loading with AutoConnectAux::loadElement.
  • Changed menu labels placement in source files structure.
  • Changed API interface of AutoConnect::where function.
  • Fixed blank page responds with Configure new.
  • Fixed loading elements value missing.
  • Fixed losing elements in saveElement with ArduinoJson V6.
  • Fixed compile error with older than ESP8266 core 2.5.0.

[0.9.7] Feb. 25, 2019

  • Fixed crash in some environments. Thank you @ageurtse
  • Supports AutoConnect menu extension by user sketch with AutoConnectAux.
  • Supports loading and saving of user-defined parameters with JSON format.
  • Improved the WiFi connection sequence at the first WiFi.begin. Even if AutoConnectConfig::autoReconnect is disabled when SSID and PSK are not specified, it will use the information of the last established access point. The autoReconnect option will achieve trying the connect after a previous connection failed.
  • Supports the AutoConnectConfig::immediateStart option and immediately starts the portal without first trying WiFi.begin. You can start the captive portal at any time in combination with the AutoConnectConfig::autoRise option.
  • Improved boot uri after reset. AutoConnectConfig::bootUri can be specified either /_ac or HOME path as the uri to be accessed after invoking Reset from AutoConnect menu.
  • Improved source code placement of predefined macros. Defined common macros have been moved to AutoConnectDefs.h.
  • Supports AutoConnectConfig::hostName. It activates WiFi.hostname().
  • Supports the captive portal time-out. It can be controlled by AutoConnectConfig::portalTimeout and AutoConnectConfig::retainPortal.

[0.9.6] Sept. 27, 2018

  • Improvement of RSSI detection for saved SSIDs.
  • Fixed disconnection SoftAP completely at the first connection phase of the AutoConnect::begin.

[0.9.5] Aug. 27, 2018

  • Supports the espressif arduino-esp32 core.
  • Fixed that crash may occur if the number of stored credentials in the EEPROM is smaller than the number of found WiFi networks.

[0.9.4] May 5, 2018.

  • Automatically focus passphrase after selecting SSID with Configure New AP.
  • Supports AutoConnectConfig::autoReconnect option, it will scan the WLAN when it can not connect to the default SSID, apply the applicable credentials if it is saved, and try reconnecting.

[0.9.3] March 23, 2018.

  • Supports a static IP address assignment.

[0.9.2] March 19, 2018.

  • Improvement of string literal declaration with the examples, no library change.

[0.9.1] March 13, 2018.

  • A release of the stable.

License

License under the MIT license.

autoconnect's People

Contributors

ariken74 avatar cremus avatar d-a-v avatar dmaixner avatar draco2003 avatar dumarjo avatar faanskit avatar gw8484 avatar hieromon avatar ivankravets avatar joehacksalot avatar per1234 avatar softwaregravy avatar tktf50 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

autoconnect's Issues

How do you load parameters?

I am following the mqttRSSI example for custom parameters.

I have it working - I can set 2 values, and they are saved to flash.

How do I load them when the ESP32 is rebooted? Currently, while they are saved to flash, the values of my variables in my code are not set unless they are set via the web console.

I don't see where they are loaded in mqttRSSI on power-on.

error compiling for board generic esp8266

hi,
im new to your library and i tried uploading simple and hello world example and neither would compile. ive been working with generic esp8266 for a bit and i believe i have the arduino 1.8.8 IDE setup correctly. is ther a change that i must make in the sketch or in src folders? i just downloaded the library today so im hoping its the latest issue. thanks for your hard work

Stackoverflow when accessing _ac page

Hi I'm using your library on a LoLin D32 Pro (ESP32 WROVER).

The start of the Access Point is OK and I can get the root page on my smartphone. However as soon as I try to access (automatically or manually) the _ac page, I get the following error.

[AC] 192.168.244.1/_ac
***ERROR*** A stack overflow in task loopTask has been detected.
abort() was called at PC 0x4008f554 on core 1
0x4008f554: vApplicationStackOverflowHook at /home/mfreeze/esp/esp-idf/components/esp32/panic.c:680


Backtrace: 0x4008f310:0x3ffbd710 0x4008f53d:0x3ffbd730 0x4008f554:0x3ffbd750 0x4008ca17:0x3ffbd770 0x4008e3b0:0x3ffbd790 0x4008e366:0x3ffbd918
0x4008f310: invoke_abort at /home/mfreeze/esp/esp-idf/components/esp32/panic.c:680

0x4008f53d: abort at /home/mfreeze/esp/esp-idf/components/esp32/panic.c:680

0x4008f554: vApplicationStackOverflowHook at /home/mfreeze/esp/esp-idf/components/esp32/panic.c:680

0x4008ca17: vTaskSwitchContext at /home/mfreeze/esp/esp-idf/components/freertos/tasks.c:3564

0x4008e3b0: _frxt_dispatch at /home/mfreeze/esp/esp-idf/components/freertos/portasm.S:406

0x4008e366: _frxt_int_exit at /home/mfreeze/esp/esp-idf/components/freertos/portasm.S:206


Rebooting...

I'm not using the Arduino IDE (I use the toolchain instead) and I don't have anything else running on the board.

I'm using the code provided in the Readme:

/* WeatherStation for ValueBugs Project
 *  Written to be run on ESP32 board
 *  Connect to WiFi
 *  Get measures from sensors : 2 BME260 sensor (temperature/humidity/pressure) + 1 DS18B20 (temperature) + 1 HL-69 (moisture)
 *  Write values on influxdb
 *  Print values on screen
 *  
 *  
 */


/*-----------------------------------------------------------------------------
 *  Libraries
 *-----------------------------------------------------------------------------*/
/* {{{ -------- Libraries -------- */
#include <WiFi.h>
#include <WebServer.h>
#include <AutoConnect.h>
/* }}} */



/*-----------------------------------------------------------------------------
 *  Constants
 *-----------------------------------------------------------------------------*/
/* {{{ -------- Constants -------- */
WebServer Server;
AutoConnect Portal(Server);
/* }}} */

/*-----------------------------------------------------------------------------
 *  Functions
 *-----------------------------------------------------------------------------*/
/* {{{ -------- Functions -------- */
void rootPage() {
    char content[] = "Hello, world";
    Server.send(200, "text/plain", content);
}
/* }}} */

void setup()
{
    /* Initialisation du port série */
    Serial.begin(115200);

    Server.on("/", rootPage);
    if (Portal.begin()) {
        Serial.println("WiFi connected: " + WiFi.localIP().toString());
    }
}

void loop()
{
    Portal.handleClient();

    //delay(5000); //Delay 5 sec.
}

Error Compiling

Hi trying for days to compile the basic code on arduino for auto connect and keep getting the same error in the log. I've checked against the source code for AutoConnectPage.cpp and the code looks identical?, Im probably doing something wrong but for the life in me I can't figure it out. i'm trying to run on to a esp32 dev board with the following..

#include <WiFi.h>
#include <WebServer.h>
#include <AutoConnect.h>
WebServer Server;
AutoConnect Portal(Server);
void rootPage() {
char content[] = "Hello, world";
Server.send(200, "text/plain", content);
}
void setup() {
delay(1000);
Serial.begin(115200);
Serial.println();
Server.on("/", rootPage);
if (Portal.begin()) {
Serial.println("HTTP server:" + WiFi.localIP().toString());
}
}
void loop() {
Portal.handleClient();
}

And keep getting the same on the console log.....

/Documents/Arduino/libraries/AutoConnect/src/AutoConnectPage.cpp: In member function 'String AutoConnect::_token_STATION_STATUS(PageArgument&)':
/Users/Documents/Arduino/libraries/AutoConnect/src/AutoConnectPage.cpp:892:57: error: 'wlStatusSymbol' may be used uninitialized in this function [-Werror=maybe-uninitialized]
return "(" + String(st) + ") " + String(wlStatusSymbol);
^

FSBrowser does not work

Hello ! First of all, I have to say thank you for your great work !

Hardware:

Board: ESP32 DEVKIT1

Core Installation version: 1.0.1-git this one

IDE name: Arduino IDE

Flash Frequency: 80Mhz

PSRAM enabled: no

Upload Speed: 115200

Computer OS: Linux Mint 19.1 Mate

Secondly, I've been trying to remake the FSBrowser example but with no luck. I've uploaded 4 files into the ESP32 and the only thing that works is this piece of code:

SPIFFS.begin();
  {
    File root = SPIFFS.open("/");
    File file = root.openNextFile();
    while(file){
      String fileName = file.name();
      size_t fileSize = file.size();
      DBG_OUTPUT_PORT.printf("FS File: %s, size: %s\n", fileName.c_str(), formatBytes(fileSize).c_str());
      file = root.openNextFile();
    }
    DBG_OUTPUT_PORT.printf("\n");
  }

Here is one output:

16:44:51.800 -> ets Jun 8 2016 00:22:57
16:44:51.800 ->
16:44:51.800 -> rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
16:44:51.800 -> configsip: 0, SPIWP:0xee
16:44:51.800 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
16:44:51.833 -> mode:DIO, clock div:1
16:44:51.833 -> load:0x3fff0018,len:4
16:44:51.833 -> load:0x3fff001c,len:1100
16:44:51.833 -> load:0x40078000,len:10088
16:44:51.833 -> load:0x40080400,len:6380
16:44:51.833 -> entry 0x400806a4
16:44:53.127 ->
16:44:53.293 -> FS File: /logo.png, size: 3.80KB
16:44:53.293 -> FS File: /login.css, size: 1.62KB
16:44:53.293 -> FS File: /index.html, size: 880B
16:44:53.326 -> FS File: /back-image.jpg, size: 146.42KB
16:44:53.359 ->
16:44:53.359 -> Connecting to wifi-ssid
16:44:53.525 -> [D][WiFiGeneric.cpp:342] _eventCallback(): Event: 0 - WIFI_READY
16:44:53.558 -> [D][WiFiGeneric.cpp:342] _eventCallback(): Event: 2 - STA_START
16:44:53.624 -> [AC] WiFi.config(IP=0.0.0.0, Gateway=0.0.0.0, Subnetmask=0.0.0.0, DNS1=0.0.0.0, DNS2=0.0.0.0) [AC] WiFi.begin()
16:44:53.658 -> [AC] Connecting...[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 4 - STA_CONNECTED
16:44:54.553 -> .[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 7 - STA_GOT_IP
16:44:54.553 -> [D][WiFiGeneric.cpp:385] _eventCallback(): STA IP: 192.168.1.102, MASK: 255.255.255.0, GW: 192.168.1.1
16:44:54.852 -> [AC] established IP:192.168.1.102
16:44:54.852 -> [AC] http server started
16:44:54.852 -> HTTP server started
16:44:54.852 ->
16:44:54.852 -> Connected! IP address: 192.168.1.102
16:44:54.852 -> Open http://esp32fs.local/edit to see the file browser
16:45:19.404 -> [AC] /_ac
16:45:19.404 -> [AC] Page[/_ac] allocated
16:45:19.404 -> [AC] 192.168.1.102/_ac
16:45:19.404 -> [E][WString.cpp:185] changeBuffer(): realloc failed! Buffer unchanged
16:45:19.438 -> [D][WiFiClient.cpp:463] connected(): Disconnected: RES: 0, ERR: 128
16:45:19.603 -> [AC] 192.168.1.102/_ac

/edit, /list don't work.

/edit returns FileNotFound

/list returns BAD ARGS

Do you have any idea on why isn't it working ?

Also, where should I start if I want to serve another webpage/webinterface when pressing HOME ?

Or, what if I want to customize the AutoConnect page ? Should I be able to do that ?

Error Compiling AutoConnectUploadImpl

Hi trying for days to compile the basic code on arduino for auto connect and keep getting the same error in the log. I've checked against the source code for AutoConnectUploadImpl.h and the code looks identical?, Im probably doing something wrong but for the life in me I can't figure it out. i'm trying to run on to a esp8266 dev board with the following..

#include <AutoConnect.h>

#include <ESP8266WiFi.h> // Replace with WiFi.h for ESP32
#include <ESP8266WebServer.h> // Replace with WebServer.h for ESP32

ESP8266WebServer Server; // Replace with WebServer for ESP32
AutoConnect Portal(Server);

void rootPage() {
char content[] = "Hello, world";
Server.send(200, "text/plain", content);
}

void setup() {
delay(1000);
Serial.begin(115200);
Serial.println();

Server.on("/", rootPage);
if (Portal.begin()) {
Serial.println("WiFi connected: " + WiFi.localIP().toString());
}
}

My error: Arduino: 1.8.8 (Windows 10), Board: "NodeMCU 0.9 (ESP-12 Module), 80 MHz, Flash, 4M (1M SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

In file included from C:\Users\vladp\Documents\Arduino\libraries\AutoConnect-master\src\AutoConnectAux.cpp:13:0:

C:\Users\vladp\Documents\Arduino\libraries\AutoConnect-master\src\AutoConnectUploadImpl.h: In member function 'virtual void AutoConnectUploadSD::_close()':

C:\Users\vladp\Documents\Arduino\libraries\AutoConnect-master\src\AutoConnectUploadImpl.h:135:13: error: 'SDClassT' has no member named 'end'

 _media->end();

         ^

exit status 1
Error compiling for board NodeMCU 0.9 (ESP-12 Module).

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Thanks,
Vlad

Error when compiling Simple.ino : PageBuilder.h: No such file or directory

In file included from
...\AppData\Local\Temp\arduino_modified_sketch_331069\Simple.ino:18:0:

...\My Documents\Arduino\libraries\AutoConnect-master\src/AutoConnect.h:30:25: fatal error: PageBuilder.h: No such file or directory

#include <PageBuilder.h>

                     ^

compilation terminated.

exit status 1
Error compiling for board WeMos D1 R2 & mini.

Custom parameters ?

Hello,

This is a great Tutorial and a great library. Thank you!
Is it possible to transmit "Custom Parameters" via the Autoconnect menu (/ _ac)? I would like to be able to enter the address and topic of the MQTT Broker in the Autoconnect menu to use it later in my Sketch.

Thank you Flo

wdt error on autoconnect-enhance-autoConnectAux

When using Autoconnect-enhance-autoConnectAux, i get an wdt error when using:

config.apid = "arnoldg"; config.hostName = "arnoldg"; Portal.config(config); Portal.begin();

when programming
config.apid = String(AUTOCONNECT_APID)+"_"+String(ESP.getChipId(),HEX); config.hostName = "arnoldg"; Portal.config(config); Portal.begin();
the app runs fine, looks like config.apid can't handel a " " string

Notice for the update feature planned in v1.0.0

To all contributors and Users,

Thank you for your interest in AutoConnect. I prepared for the prototype of the update server and application sketch which for sketch binary updating via OTA. I will implementation for v0.99 based on this prototype and will also add automatic updates by version level according to each device.
The OTA update feature will be incorporated by only one parameter with AutoConnectConfig.
Related issue #26 #50

Please evaluate this prototype if you can and post any comments if you have any requirements that I need to consider for implementation.

The following menu is in interactive mode. In automatic update mode, it will behave in the background.

update_catalog update_during update_restart

issue with sample ino : HandlePortalEx.ino

Hi,

just discover your lib and I try a sample to test the ac menu.
First, I thing a error appear in line 41
/head
head seem more appropriate.

After, could you explain me this line :
static const char PROGMEM mold_page[] = R"*lit( and particulary R"lit expression ?

I compile the file and wen I try to connect to the ESP32 (core v1.0.1), I have the following trace :

[AC] WiFi.config(IP=0.0.0.0, Gateway=0.0.0.0, Subnetmask=0.0.0.0, DNS1=0.0.0.0, DNS2=0.0.0.0)
[AC] WiFi.begin()
[AC] Connecting.....................................................................................................
[AC] time out IP:0.0.0.0
[AC] http server started
[AC] SoftAP esp32ap/12345678 CH(1) H(0) IP:192.168.11.1
Captive portal started, SoftAP IP:192.168.11.1
[AC] DNS server started
E (389186) event: mismatch or invalid event, id=63
E (389187) event: default event handler failed!
dhcps: send_offer>>udp_sendto result 0
[AC] /generate_204
[AC] Page[] allocated

but I have nothing on my smartphone web browser ? And I can't know what?
Could you help me ?
Best regards
Nomi

PS : I use the library v0.9.6 with PageBuilder v1.3.1 and ArduinoJSon v5.13.4

How to recover the STA MAC parameter for use in my scketch?

Hi,

Autoconnect is an excellent library with a great user manual. On behalf of the community : Thank you!

Here is my problem (probably simple, but I can not ...) : I would like to recover the STA MAC parameter for use in my sketch on ESP32. How to recover this value?
If I use STA_MAC in my Sketch, I get the following error message STA_MAC was not declared in this scope. I looked in the different files of the directory src, but I don't understand how to pass this parameter in my Sketch.

I have the option to retrieve this setting by using ESP.getEfuseMac (), but STA_MAC is already used by the Autoconnect library (visible on the main menu), and that would simplify my code.
Can you help me please ?

Thank you in advance.
Joel

Example for mqtt sucribe

Please, I'm doing the example of mqttRSSI, but I need to do some action in the esp8266, for that I have to subscribe but your example is only to publish.
Best Regards

Request: in AP mode, change SSID name

Hello,

I prever to have a uniq SSID when in softAP mode.
So i alter in file AutoConnect.h at line 117
apid(String(AUTOCONNECT_APID),
into
apid(String(AUTOCONNECT_APID)+"_"+String(ESP.getChipId(),HEX)),

maybee this could be implemented in the next release.
With this small modification, you dont get any trouble when there are more then one devices in softAP mode.

Next thing i changed is a setting for hostname, maybe later it could be implemented in a setup page so it is stored in eeprom.

in AutoConnect.h after line 214: ESP8266WebServer& host();
i added String AP_hostname;

in AutoConnect.cpp before line 110: // Try to connect by STA immediately.
i added WiFi.hostname(AP_hostname);

now you could set the hostname in the main ino file just before portal.begin() enter
Portal.AP_hostname = "name_of_host";

Shows older version

Even if one installs the latest version 0.9.6, it shows as 0.9.5. I guess the library.json still has the older ver no.

Sketch crashes

I have Arduino 1.8.9, ESP8266 v2.5, ESP32 v1.1 and ArduinoJson v6.10 all loaded on a frsh Arduino install. I get the following error message;
Error while detecting libraries included by C:\Arduino189\portable\sketchbook\libraries\AutoConnect\src\AutoConnectAux.cpp
and then I get a huge list of errors mentioning JSON. The lis is so long I can't paste it here
Do you have any idea what is wrong? please. I have tried loading the library from Library manager and manually from the zip download.

cursor position

When I select the SSID, the cursor should be positioned in the text box of the key, because if we have more than 10 networks (for example), we would have to scroll to write the key but that would not be necessary if the function for example: document.getElementById ('password'). focus ();

ondemand AP

Thanks for the useful library. Is there any example for an On Demand AP? Say I use a button press to put this into WiFi configuration mode ( even if it is connected to an existing WiFi station ). If I press the button for 5 seconds then I want the WiFi credentials to be wiped off and the ESP32 should restart in AP mode. The button press / delay and all I have written but need a robust way of getting the ESP32 into the AP mode. I think I did try setting the autoConnection to false but it would not get back into the AP mode unless I erase the eeprom.

The best would be that the button press gets the ESP32 into AP mode ( even if there is any saved wifi credentials ) ... then times out after a while if no new AP is set. This way one can also switch from one AP to another AP.

change of labels

Now you have 2 labels, Reset... and Disconnect.

one is for ereasing the device and one for rebooting. Why not name what they do.

Erasing device...
Rebooting device...

reboot after connect

I'm testing AutoConnect with the SimpleExample and always have the problem that immediately after the connection to pc, iPad or mobile is established the ESP2866 is rebooting:

[AC] WiFi.config(IP=(IP unset), Gateway=(IP unset), Subnetmask=(IP unset), DNS1=(IP unset), DNS2=(IP unset)) [AC] DHCP client(STARTED)
[AC] WiFi.begin()
[AC] Connecting....................................................................................................[AC] time out IP:(IP unset)
[AC] http server started
[AC] SoftAP esp8266ap/12345678 CH(1) H(0) IP:192.168.244.1
[AC] DNS server started
[AC] /connecttest.txt
[AC] Page[] allocated
[AC] www.msftconnecttest.com/bag
[AC] Page[] allocated
[AC] init-p01st.push.apple.com/connecttest.txt
[AC] Page[] allocated
[AC] www.msftconnecttest.com/redirect
[AC] Page[] allocated
[AC] www.msftconnecttest.com/_ac
[AC] Page[/_ac] allocated
[AC] 192.168.244.1/_ac

ets Jan 8 2013,rst cause:4, boot mode:(1,6)

wdt reset

I tested it with NodeMcu v1 and Lolin V3. Same behaviour.
I have two sensors and an oled connected. Which is running fine.
Even if I disconnect everything it's not working.

Thanks for your help.

how to change the Soft ap user name and password

Hi sorry may I as you how to change this sentence

[AC] SoftAP esp32ap/12345678 Ch(1) IP:192.168.244.1

the wifi name as "esp32ap and password 12345678" can I change the name and the password ?

Example for data types entry (integer, IP Address, string values) and retrieval

Please consider crafting an example that includes a simple data entry page, possibly using pagebuilder.

Lacking practical experience with HTML, my attempts to extend the existing autoconnect, or pagebuilder examples to include a simple data entry page (i..e integers, ip address, string values) has been difficult for all the moving parts in learning autoconnect and pagebuilder, and HTML.

Very slow to populate the list of wifi networks - possibly needs user feedback

If used in an area where many wifi networks are visible it may take a number of seconds (10? 20?) to populate the list of wifi access points. It would be great if there was some sort of feedback given to the user that this is happening - to avoid the user thinking the device has hung.

If no one is working on this I'll try to send in a PR someday - but I wanted to record it.

Downstream issue here: geeksville/ezdevice-esp32#1

Automatic open browser after connect to AP to load index.html saved on the SPIFFS

I really having difficulty to have a automatic loading index.html saved on the SPIFFS. I need to automatically open index.html without user require open browser and type the IP.

server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
Serial.println("/");
Serial.println("redirecting to /index.html");
request->redirect("/index.html");
});
#if ESP8266
if(!SPIFFS.begin()){
Serial.println("SPIFFS Mount Failed");
}
#endif
#if ESP32
if(!SPIFFS.begin(true)){
Serial.println("SPIFFS Mount Failed on ..");
}
#endif

listDir(SPIFFS, "/", 0);
server.serveStatic("/", SPIFFS, "/").setCacheControl("max-age=600").setDefaultFile("index.html");
server.begin();
Thank you

#define max issue

Arduino: 1.8.5 (Windows 10), Board: "Adafruit HUZZAH ESP8266, 80 MHz, 115200, 4M (3M SPIFFS)"

In file included from C:\Users\xxx\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/WiFiClient.h:25:0,

             from C:\Users\xxx\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\libraries\ESP8266WiFi\src/ESP8266WiFi.h:39,

             from C:\Users\xxx\Arduino\libraries\AutoConnect\src\AutoConnectPage.cpp:10:

c:\users\xxx\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_vector.h: In member function 'std::vector<_Tp, _Alloc>::size_type std::vector<_Tp, _Alloc>::_M_check_len(std::vector<_Tp, _Alloc>::size_type, const char*) const':

C:\Users\xxx\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/Arduino.h:253:18: error: expected unqualified-id before '(' token

#define max(a,b) ((a)>(b)?(a):(b))

              ^

c:\users\xxx\appdata\local\arduino15\packages\esp8266\tools\xtensa-lx106-elf-gcc\1.20.0-26-gb404fb9-2\xtensa-lx106-elf\include\c++\4.8.2\bits\stl_bvector.h: In member function 'std::vector<bool, _Alloc>::size_type std::vector<bool, _Alloc>::_M_check_len(std::vector<bool, _Alloc>::size_type, const char*) const':

C:\Users\xxx\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\2.3.0\cores\esp8266/Arduino.h:253:18: error: expected unqualified-id before '(' token

#define max(a,b) ((a)>(b)?(a):(b))

              ^

exit status 1
Error compiling for board Adafruit HUZZAH ESP8266.

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

ESP32 crashes example "Simple"

Using unmodified example "Simple" om am ESP32 Devkit1 results in a dump:

Decoding stack results
0x400ee4dd: _unsetenv_r at ../../../.././newlib/libc/stdlib/setenv_r.c line 159
0x400f5a0e: nvs::Page::findItem(unsigned char, nvs::ItemType, char const*, unsigned int&, nvs::Item&, unsigned char, nvs::VerOffset) at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/nvs_flash/src/nvs_page.cpp line 761
0x400f5a46: nvs::Page::findItem(unsigned char, nvs::ItemType, char const*, unsigned int&, nvs::Item&, unsigned char, nvs::VerOffset) at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/nvs_flash/src/nvs_types.hpp line 65
0x400de96e: WebServer::_handleRequest() at C:\Users\xxx\Documents\Arduino\hardware\espressif\esp32\libraries\WebServer\src\WebServer.cpp line 635
0x400d3092: receivedCallback(char*, unsigned char*, unsigned int) at C:\Users\xxx\Documents\Arduino\ActionNode_V1.5V_light/ActionNode_V1.5V_light.ino line 1792
0x400d33ed: receivedCallback(char*, unsigned char*, unsigned int) at C:\Users\xxx\Documents\Arduino\ActionNode_V1.5V_light/ActionNode_V1.5V_light.ino line 1884
0x4008e85d: rtc_init at /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/soc/esp32/rtc_init.c line 34

`018,len:4
load:0x3fff001c,len:1100
load:0x40078000,len:10088
load:0x40080400,len:6380
entry 0x400806a4

[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 0 - WIFI_READY
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 13 - AP_START
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 3 - STA_STOP
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 3 - STA_STOP
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 13 - AP_START
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 3 - STA_STOP
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 14 - AP_STOP
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 14 - AP_STOP
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 0 - WIFI_READY
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 14 - AP_STOP
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 2 - STA_START
[AC] WiFi.config(IP=0.0.0.0, Gateway=0.0.0.0, Subnetmask=0.0.0.0, DNS1=0.0.0.0, DNS2=0.0.0.0) [E][WiFiSTA.cpp:211] begin(): connect failed!
[AC] WiFi.begin()
[AC] Connecting.....................................................................................................[AC] time out IP:0.0.0.0
[AC] http server started
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 0 - WIFI_READY
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 13 - AP_START
[AC] SoftAP esp32ap/12345678 CH(1) H(0) IP:192.168.244.1
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 13 - AP_START
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 13 - AP_START
[AC] DNS server started
E (49379) event: mismatch or invalid event, id=63
E (49379) event: default event handler failed!
Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x400014dc PS : 0x00060c30 A0 : 0x800ee4e0 A1 : 0x3ffb8f40
A2 : 0x070518ff A3 : 0x070518fb A4 : 0x000000ff A5 : 0x0000ff00
A6 : 0x00ff0000 A7 : 0xff000000 A8 : 0x00000000 A9 : 0x00000000
A10 : 0x00000000 A11 : 0x3ffb9142 A12 : 0x00000000 A13 : 0x00000000
A14 : 0x60000000 A15 : 0x00000000 SAR : 0x00000004 EXCCAUSE: 0x0000001c
EXCVADDR: 0x070518ff LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xfffffffc

Backtrace: 0x400014dc:0x3ffb8f40 0x400ee4dd:0x3ffb8f50 0x400f5a0e:0x3ffb9260 0x400f5a46:0x3ffb92f0 0x400de96e:0x3ffb9330 0x400d3092:0x3ffb9390 0x400d33ed:0x3ffb94b0 0x4008e85d:0x3ffb94e0

Rebooting...
ets Jun 8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1100
load:0x40078000,len:10088
load:0x40080400,len:6380
entry 0x400806a4

[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 0 - WIFI_READY
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 13 - AP_START
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 3 - STA_STOP
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 3 - STA_STOP
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 13 - AP_START
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 3 - STA_STOP
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 14 - AP_STOP
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 14 - AP_STOP
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 0 - WIFI_READY
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 14 - AP_STOP
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 2 - STA_START
[AC] WiFi.config(IP=0.0.0.0, Gateway=0.0.0.0, Subnetmask=0.0.0.0, DNS1=0.0.0.0, DNS2=0.0.0.0) [E][WiFiSTA.cpp:211] begin(): connect failed!
[AC] WiFi.begin()
[AC] Connecting.....................................................................................................[AC] time out IP:0.0.0.0
[AC] http server started
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 0 - WIFI_READY
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 2 - STA_START
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 13 - AP_START
[AC] SoftAP esp32ap/12345678 CH(1) H(0) IP:192.168.244.1
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 13 - AP_START
[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 13 - AP_START
[AC] DNS server started
`

error when disabeling debug

Hi Hieromon,

when commenting out AC_DEBUG in AutoConnectDefs.h i get an error.
The error is in file AutoConnectEllementBasisImpl.h on line 86 you have AC_DEBUG this should be AC_DBG

after changing the file is compiling, please update this little bug.

Example for Mobile App

Hi, I have Android App , I will want connect AP point from my mobile app, but when i connect to AP I embebed web in my app however AutoConnect Open brower with you interface.
how i can disable open browser automatily? because i will open browen in my internal mobile app.
Thanks.

Crash when specify a custom config

Hi,

I'm trying to change the name of the SSID and password for SoftAP but each time I try to specify a config I have a big instability on my esp.

Here my code, may be I've done something wrong.... When I don't specify a SoftAP config the ESP and the connection is stable but each time I activate the line "Portal.config("Test", "testtest"); " the ESP connect to my AP and crash every 5 seconds. with this message :

HTTPUpdateServer ready! Open http://test.local/update in your browser
WiFi connected:MyAP
IP:192.168.1.223

ets Jan 8 2013,rst cause:4, boot mode:(3,7)

wdt reset
load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v614f7c32
~ld

If you have a complete example with a custom SoftAP config I'm interested ! :)
Thanks


`#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <AutoConnect.h>
#include <ESP8266WebServer.h>
#include <PubSubClient.h>
#include <ESP8266mDNS.h>
#include <ESP8266HTTPUpdateServer.h>
#include <Adafruit_NeoPixel.h>
#include <ArduinoJson.h>
#include <EasyNeoPixels.h>

ESP8266WebServer Server;
AutoConnect Portal(Server);
AutoConnectConfig Config("TestTest", "testtest");
//AutoConnectConfig Config;

WiFiClient wifiClient;
PubSubClient mqttClient(wifiClient);
ESP8266HTTPUpdateServer httpUpdater;

void setup() {

delay(1000);
Serial.begin(115200);
Serial.println();

Server.on("/", rootPage);

// update on web page
httpUpdater.setup(&Server);
Serial.printf("HTTPUpdateServer ready! Open http://pluie.local/update in your browser\n");

// Portal.config("Test", "testtest"); // ->> iF I activate this the ESP crash
// Portal.config(Config);

Serial.print("WiFi ");
if (Portal.begin()) {
Serial.println("connected:" + WiFi.SSID());
Serial.println("IP:" + WiFi.localIP().toString());
} else {
Serial.println("connection failed:" + String(WiFi.status()));
while (1) {
delay(100);
yield();
}
}

// We add a DNS name Test.local
if (MDNS.begin("Test")) {
MDNS.addService("http", "tcp", 80);
}

}

void loop() {
Portal.handleClient();
}

Simple HTTP GET Request doesn't work

Hardware:

Board: ESP32 DEVKIT1

Core Installation version: 1.0.1-git this one

IDE name: Arduino IDE

Flash Frequency: 80Mhz

PSRAM enabled: no

Upload Speed: 115200

Computer OS: Linux Mint 19.1 Mate

Description:

I'm trying to integrate a simple GET Request inside a simple sketch containing AutoConnect but combining the two nothing works. The /_ac doesn't work, the simple "Hello, world !" page doesn't work, the GET Request doesn't work.

Sketch:

#include <WiFi.h>
#include <WebServer.h>
#include <AutoConnect.h>
#include <HTTPClient.h>

WebServer Server;
AutoConnect Portal(Server);

void rootPage() {
    char content[] = "Hello, world !";
    Server.send(200, "text/plain", content);
  }

void setup () {
    delay(1000);
    Serial.begin(115200);
    Serial.println();
  
    Server.on("/", rootPage);
    if (Portal.begin()) {
        Serial.println("WiFi Connected: " + WiFi.localIP().toString());
      }
  }

void loop() {
    
    HTTPClient http;
    
    http.begin("http://jsonplaceholder.typicode.com/comments?id=10"); //Specify the URL
    int httpCode = http.GET();
  
    if(httpCode > 0) {
        String payload = http.getString();
        Serial.println(httpCode);
        Serial.println(payload);
        
      } else {
          Serial.println("Error on HTTP request");
        }
     http.end();

     Portal.handleClient();     

     delay(10000);
  }

Debug Messages:

14:00:02.188 -> ets Jun  8 2016 00:22:57
14:00:02.188 -> 
14:00:02.188 -> rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
14:00:02.188 -> configsip: 0, SPIWP:0xee
14:00:02.188 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
14:00:02.188 -> mode:DIO, clock div:1
14:00:02.188 -> load:0x3fff0018,len:4
14:00:02.188 -> load:0x3fff001c,len:1100
14:00:02.188 -> load:0x40078000,len:10088
14:00:02.188 -> load:0x40080400,len:6380
14:00:02.188 -> entry 0x400806a4
14:00:03.505 -> 
14:00:03.505 -> [W][WiFiGeneric.cpp:570] setSleep(): STA has not been started
14:00:03.704 -> [D][WiFiGeneric.cpp:342] _eventCallback(): Event: 0 - WIFI_READY
14:00:03.704 -> [D][WiFiGeneric.cpp:342] _eventCallback(): Event: 2 - STA_START
14:00:03.803 -> [AC] WiFi.config(IP=0.0.0.0, Gateway=0.0.0.0, Subnetmask=0.0.0.0, DNS1=0.0.0.0, DNS2=0.0.0.0) [AC] WiFi.begin()
14:00:03.803 -> [AC] Connecting...[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 4 - STA_CONNECTED
14:00:04.699 -> .[D][WiFiGeneric.cpp:342] _eventCallback(): Event: 7 - STA_GOT_IP
14:00:04.732 -> [D][WiFiGeneric.cpp:385] _eventCallback(): STA IP: 192.168.1.101, MASK: 255.255.255.0, GW: 192.168.1.1
14:00:04.997 -> [AC] established IP:192.168.1.101
14:00:04.997 -> [AC] http server started
14:00:05.031 -> WiFi Connected: 192.168.1.101
14:00:05.031 -> [D][HTTPClient.cpp:265] beginInternal(): host: jsonplaceholder.typicode.com port: 80 url: /comments?id=10
14:00:05.064 -> [D][HTTPClient.cpp:977] connect():  connected to jsonplaceholder.typicode.com:80
14:00:05.130 -> [D][HTTPClient.cpp:1102] handleHeaderResponse(): code: 200
14:00:05.130 -> [D][HTTPClient.cpp:1105] handleHeaderResponse(): size: 322
14:00:05.130 -> [D][WiFiClient.cpp:463] connected(): Disconnected: RES: 0, ERR: 128
14:00:05.163 -> [D][HTTPClient.cpp:1239] writeToStreamDataBlock(): connection closed or file end (written: 322).
14:00:05.163 -> [D][HTTPClient.cpp:369] disconnect(): tcp is closed
14:00:05.163 -> 
14:00:05.163 ->  [D][HTTPClient.cpp:369] disconnect(): tcp is closed
14:00:05.163 -> 
14:00:15.146 -> [D][HTTPClient.cpp:265] beginInternal(): host: jsonplaceholder.typicode.com port: 80 url: /comments?id=10
14:00:15.179 -> [D][HTTPClient.cpp:977] connect():  connected to jsonplaceholder.typicode.com:80
14:00:15.312 -> [D][HTTPClient.cpp:1102] handleHeaderResponse(): code: 200
14:00:15.312 -> [D][HTTPClient.cpp:1105] handleHeaderResponse(): size: 322
14:00:15.312 -> [D][WiFiClient.cpp:463] connected(): Disconnected: RES: 0, ERR: 128
14:00:15.312 -> [D][HTTPClient.cpp:1239] writeToStreamDataBlock(): connection closed or file end (written: 322).
14:00:15.345 -> [D][HTTPClient.cpp:369] disconnect(): tcp is closed
14:00:15.345 -> 
14:00:15.345 -> is nobis reprehenderit ipsum amet nulla\nquia quas dolores velit et non\naut quia necessitatibus\nnostrum quaerat nulla et accusamus nisi facilis"
14:00:15.345 ->   }
14:00:15.345 -> ]
14:00:15.345 -> [D][HTTPClient.cpp:369] disconnect(): tcp is closed
14:00:15.345 -> 

And so on. 

Announcement - Transmission incomplete with large HTML occurs

In the case that an HTML content length exceeds around 6000 bytes (depending on remaining RAM) when HTML generated by AutoConnect is merged with HTML output of the user sketch side, TCP stack will not be able to allocate the temporary storage and transmission will become incomplete. I found the cause of this problem in the process of v0.9.7 support. Also, it is related to #16 and the solution hint is in esp8266/Arduino#3205.
The solution is to implement Chunked-encoding with the PageBuilder library which is the HTML generation part included in AutoConnect. I'm revising it now and will be released ahead of AutoConnect v0.9.7.

Error compiling examples caused by AutoConnect.h: "'WebServer' does not name a type"

Tried googling as much as I could and indeed an error like this is over my head... I have the Arduino IDE error log below if it's any use, also newly flashed my ESP32 with nodemcu and it's been working with other sketches just fine:

In file included from C:\Users\kevin\AppData\Local\Temp\arduino_modified_sketch_461112\Simple.ino:15:0:

C:\Users\kevin\Documents\Arduino\libraries\AutoConnect\src/AutoConnect.h:27:24: error: 'WebServer' does not name a type

 using WebServerClass = WebServer;

                        ^

In file included from C:\Users\kevin\Documents\Arduino\libraries\AutoConnect\src/AutoConnect.h:30:0,

                 from C:\Users\kevin\AppData\Local\Temp\arduino_modified_sketch_461112\Simple.ino:15:

C:\Users\kevin\Documents\Arduino\libraries\PageBuilder\src/PageBuilder.h:29:24: error: 'WebServer' does not name a type

 using WebServerClass = WebServer;

                        ^

C:\Users\kevin\Documents\Arduino\libraries\PageBuilder\src/PageBuilder.h:114:28: error: 'HTTPMethod' was not declared in this scope

 typedef std::function<bool(HTTPMethod, String)> PrepareFuncT;

                            ^

C:\Users\kevin\Documents\Arduino\libraries\PageBuilder\src/PageBuilder.h:114:46: error: expression list treated as compound expression in functional cast [-fpermissive]

 typedef std::function<bool(HTTPMethod, String)> PrepareFuncT;

                                              ^

C:\Users\kevin\Documents\Arduino\libraries\PageBuilder\src/PageBuilder.h:114:47: error: template argument 1 is invalid

 typedef std::function<bool(HTTPMethod, String)> PrepareFuncT;

                                               ^

C:\Users\kevin\Documents\Arduino\libraries\PageBuilder\src/PageBuilder.h:123:43: error: expected class-name before '{' token

 class PageBuilder : public RequestHandler {

                                           ^

C:\Users\kevin\Documents\Arduino\libraries\PageBuilder\src/PageBuilder.h:126:37: error: 'HTTPMethod' has not been declared

  PageBuilder(PageElementVT element, HTTPMethod method = HTTP_ANY, bool noCache = true, bool cancel = false) :

                                     ^

C:\Users\kevin\Documents\Arduino\libraries\PageBuilder\src/PageBuilder.h:134:54: error: 'HTTPMethod' has not been declared

  PageBuilder(const char* uri, PageElementVT element, HTTPMethod method = HTTP_ANY, bool noCache = true, bool cancel = false) :

                                                      ^

C:\Users\kevin\Documents\Arduino\libraries\PageBuilder\src/PageBuilder.h:145:17: error: 'HTTPMethod' has not been declared

  bool canHandle(HTTPMethod requestMethod, String requestUri) override;

                 ^

C:\Users\kevin\Documents\Arduino\libraries\PageBuilder\src/PageBuilder.h:147:14: error: 'WebServerClass' has not been declared

  bool handle(WebServerClass& server, HTTPMethod requestMethod, String requestUri) override;

              ^

C:\Users\kevin\Documents\Arduino\libraries\PageBuilder\src/PageBuilder.h:147:38: error: 'HTTPMethod' has not been declared

  bool handle(WebServerClass& server, HTTPMethod requestMethod, String requestUri) override;

                                      ^

C:\Users\kevin\Documents\Arduino\libraries\PageBuilder\src/PageBuilder.h:151:14: error: 'WebServerClass' has not been declared

  void insert(WebServerClass& server) { server.addHandler(this); }

              ^

C:\Users\kevin\Documents\Arduino\libraries\PageBuilder\src/PageBuilder.h:154:32: error: 'WebServerClass' has not been declared

  static void sendNocacheHeader(WebServerClass& server);

                                ^

C:\Users\kevin\Documents\Arduino\libraries\PageBuilder\src/PageBuilder.h:157:18: error: 'WebServerClass' has not been declared

  void atNotFound(WebServerClass& server);

                  ^

C:\Users\kevin\Documents\Arduino\libraries\PageBuilder\src/PageBuilder.h:165:2: error: 'HTTPMethod' does not name a type

  HTTPMethod  _method;  /**< Method of http request to which this page applies. */

  ^

C:\Users\kevin\Documents\Arduino\libraries\PageBuilder\src/PageBuilder.h:168:23: error: 'WebServerClass' has not been declared

  bool _sink(int code, WebServerClass& server); //, HTTPMethod requestMethod, String requestUri);

                       ^

C:\Users\kevin\Documents\Arduino\libraries\PageBuilder\src/PageBuilder.h:171:2: error: 'WebServerClass' does not name a type

  WebServerClass* _server;

  ^

C:\Users\kevin\Documents\Arduino\libraries\PageBuilder\src/PageBuilder.h:145:7: error: 'bool PageBuilder::canHandle(int, String)' marked 'override', but does not override

  bool canHandle(HTTPMethod requestMethod, String requestUri) override;

       ^

C:\Users\kevin\Documents\Arduino\libraries\PageBuilder\src/PageBuilder.h:146:7: error: 'bool PageBuilder::canUpload(String)' marked 'override', but does not override

  bool canUpload(String requestUri) override;

       ^

C:\Users\kevin\Documents\Arduino\libraries\PageBuilder\src/PageBuilder.h:147:7: error: 'bool PageBuilder::handle(int&, int, String)' marked 'override', but does not override

  bool handle(WebServerClass& server, HTTPMethod requestMethod, String requestUri) override;

       ^

C:\Users\kevin\Documents\Arduino\libraries\PageBuilder\src/PageBuilder.h:126:57: error: 'HTTP_ANY' was not declared in this scope

  PageBuilder(PageElementVT element, HTTPMethod method = HTTP_ANY, bool noCache = true, bool cancel = false) :

                                                         ^

C:\Users\kevin\Documents\Arduino\libraries\PageBuilder\src/PageBuilder.h:134:74: error: 'HTTP_ANY' was not declared in this scope

  PageBuilder(const char* uri, PageElementVT element, HTTPMethod method = HTTP_ANY, bool noCache = true, bool cancel = false) :

                                                                          ^

C:\Users\kevin\Documents\Arduino\libraries\PageBuilder\src/PageBuilder.h: In constructor 'PageBuilder::PageBuilder()':

C:\Users\kevin\Documents\Arduino\libraries\PageBuilder\src/PageBuilder.h:125:33: error: class 'PageBuilder' does not have any field named '_method'

  PageBuilder() : _uri(nullptr), _method(HTTP_ANY), _server(nullptr) {}

                                 ^

C:\Users\kevin\Documents\Arduino\libraries\PageBuilder\src/PageBuilder.h:125:41: error: 'HTTP_ANY' was not declared in this scope

  PageBuilder() : _uri(nullptr), _method(HTTP_ANY), _server(nullptr) {}

                                         ^

C:\Users\kevin\Documents\Arduino\libraries\PageBuilder\src/PageBuilder.h:125:52: error: class 'PageBuilder' does not have any field named '_server'

  PageBuilder() : _uri(nullptr), _method(HTTP_ANY), _server(nullptr) {}

                                                    ^

C:\Users\kevin\Documents\Arduino\libraries\PageBuilder\src/PageBuilder.h: In constructor 'PageBuilder::PageBuilder(PageElementVT, int, bool, bool)':

C:\Users\kevin\Documents\Arduino\libraries\PageBuilder\src/PageBuilder.h:129:3: error: class 'PageBuilder' does not have any field named '_method'

   _method(method),

   ^

C:\Users\kevin\Documents\Arduino\libraries\PageBuilder\src/PageBuilder.h:132:3: error: class 'PageBuilder' does not have any field named '_server'

   _server(nullptr),

   ^

C:\Users\kevin\Documents\Arduino\libraries\PageBuilder\src/PageBuilder.h:133:21: error: cannot convert 'std::nullptr_t' to 'PrepareFuncT {aka int}' in initialization

   _canHandle(nullptr) {}

                     ^

C:\Users\kevin\Documents\Arduino\libraries\PageBuilder\src/PageBuilder.h: In constructor 'PageBuilder::PageBuilder(const char*, PageElementVT, int, bool, bool)':

C:\Users\kevin\Documents\Arduino\libraries\PageBuilder\src/PageBuilder.h:137:3: error: class 'PageBuilder' does not have any field named '_method'

   _method(method),

   ^

C:\Users\kevin\Documents\Arduino\libraries\PageBuilder\src/PageBuilder.h:140:3: error: class 'PageBuilder' does not have any field named '_server'

   _server(nullptr),

   ^

C:\Users\kevin\Documents\Arduino\libraries\PageBuilder\src/PageBuilder.h:141:21: error: cannot convert 'std::nullptr_t' to 'PrepareFuncT {aka int}' in initialization

   _canHandle(nullptr) {}

                     ^

C:\Users\kevin\Documents\Arduino\libraries\PageBuilder\src/PageBuilder.h: In destructor 'PageBuilder::~PageBuilder()':

C:\Users\kevin\Documents\Arduino\libraries\PageBuilder\src/PageBuilder.h:143:35: error: '_server' was not declared in this scope

  ~PageBuilder() { _uri = nullptr; _server = nullptr; clearElement(); }

                                   ^

C:\Users\kevin\Documents\Arduino\libraries\PageBuilder\src/PageBuilder.h: In member function 'void PageBuilder::insert(int&)':

C:\Users\kevin\Documents\Arduino\libraries\PageBuilder\src/PageBuilder.h:151:47: error: request for member 'addHandler' in 'server', which is of non-class type 'int'

  void insert(WebServerClass& server) { server.addHandler(this); }

                                               ^

In file included from C:\Users\kevin\AppData\Local\Temp\arduino_modified_sketch_461112\Simple.ino:15:0:

C:\Users\kevin\Documents\Arduino\libraries\AutoConnect\src/AutoConnect.h: At global scope:

C:\Users\kevin\Documents\Arduino\libraries\AutoConnect\src/AutoConnect.h:213:29: error: expected ')' before '&' token

   AutoConnect(WebServerClass& webServer);

                             ^

C:\Users\kevin\Documents\Arduino\libraries\AutoConnect\src/AutoConnect.h:223:3: error: 'WebServerClass' does not name a type

   WebServerClass& host();

   ^

C:\Users\kevin\Documents\Arduino\libraries\AutoConnect\src/AutoConnect.h:227:20: error: 'WebServerClass' has not been declared

   void  onNotFound(WebServerClass::THandlerFunction fn);

                    ^

C:\Users\kevin\Documents\Arduino\libraries\AutoConnect\src/AutoConnect.h:227:53: error: expected ',' or '...' before 'fn'

   void  onNotFound(WebServerClass::THandlerFunction fn);

                                                     ^

C:\Users\kevin\Documents\Arduino\libraries\AutoConnect\src/AutoConnect.h:242:25: error: 'HTTPMethod' has not been declared

   bool  _classifyHandle(HTTPMethod mothod, String uri);

                         ^

C:\Users\kevin\Documents\Arduino\libraries\AutoConnect\src/AutoConnect.h:263:3: error: 'WebServerClass' does not name a type

   WebServerClass::THandlerFunction _notFoundHandler;

   ^

C:\Users\kevin\Documents\Arduino\libraries\AutoConnect\src/AutoConnect.h:265:19: error: 'WebServerClass' was not declared in this scope

   std::unique_ptr<WebServerClass> _webServer;

                   ^

C:\Users\kevin\Documents\Arduino\libraries\AutoConnect\src/AutoConnect.h:265:33: error: template argument 1 is invalid

   std::unique_ptr<WebServerClass> _webServer;

                                 ^

C:\Users\kevin\Documents\Arduino\libraries\AutoConnect\src/AutoConnect.h:265:33: error: template argument 2 is invalid

Simple:20: error: 'WebServer' does not name a type

 WebServer Server;

 ^

Simple:22: error: cannot declare parameter to be of abstract type 'Server'

 AutoConnect      Portal(Server);

                               ^

In file included from C:\Users\kevin\Documents\Arduino\hardware\espressif\esp32\cores\esp32/Arduino.h:156:0,

                 from sketch\Simple.ino.cpp:1:

C:\Users\kevin\Documents\Arduino\hardware\espressif\esp32\cores\esp32/Server.h:25:7: note:   because the following virtual functions are pure within 'Server':

 class Server: public Print

       ^

In file included from C:\Users\kevin\Documents\Arduino\hardware\espressif\esp32\cores\esp32/Stream.h:26:0,

                 from C:\Users\kevin\Documents\Arduino\hardware\espressif\esp32\cores\esp32/Arduino.h:151,

                 from sketch\Simple.ino.cpp:1:

C:\Users\kevin\Documents\Arduino\hardware\espressif\esp32\cores\esp32/Print.h:60:20: note: 	virtual size_t Print::write(uint8_t)

     virtual size_t write(uint8_t) = 0;

                    ^

In file included from C:\Users\kevin\Documents\Arduino\hardware\espressif\esp32\cores\esp32/Arduino.h:156:0,

                 from sketch\Simple.ino.cpp:1:

C:\Users\kevin\Documents\Arduino\hardware\espressif\esp32\cores\esp32/Server.h:28:18: note: 	virtual void Server::begin()

     virtual void begin() =0;

                  ^

C:\Users\kevin\AppData\Local\Temp\arduino_modified_sketch_461112\Simple.ino: In function 'void rootPage()':

Simple:53: error: expected unqualified-id before '.' token

   Server.send(200, "text/html", content);

         ^

C:\Users\kevin\AppData\Local\Temp\arduino_modified_sketch_461112\Simple.ino: In function 'void setup()':

Simple:62: error: expected unqualified-id before '.' token

   Server.on("/", rootPage);

         ^

Simple:67: error: request for member 'config' in 'Portal', which is of non-class type 'AutoConnect(Server)'

   Portal.config(Config);

          ^

Simple:70: error: request for member 'begin' in 'Portal', which is of non-class type 'AutoConnect(Server)'

   if (Portal.begin()) {

              ^

C:\Users\kevin\AppData\Local\Temp\arduino_modified_sketch_461112\Simple.ino: In function 'void loop()':

Simple:77: error: request for member 'handleClient' in 'Portal', which is of non-class type 'AutoConnect(Server)'

   Portal.handleClient();

          ^

exit status 1
'WebServer' does not name a type

Turning off the AP

When the device (esp8266) has already connected to the Wi-Fi network, the AP mode should be turned off, since some intruder could connect to the AP and change the configuration of the device (Esp8266).
When the key has been changed in the modem the AP should start again in order to update the key and after the connection is established it should be switched off again

possible bug, rebooting after reflash

Hello Hieromon,

i'm running in some problem's which is from the start of using your piece of code.
after editing the code, i have to erease the hole esp8266 device otherwise the device keeps rebooting.
Could it be that, some variables for wifi network are stored in program memory ?
with editing i mean add some code, not change a hard code parameter setting.

Configure new AP blank at times

Hey the page "Configure new AP" renders blank at times, after multiple refresh it loads, its usually happening when more than 7+ ssid are found. Is it a bug or is there any workaround for that or is it some issue with my code?

UPDATE :
Tried the library with the most basic sketch and still the same issue, so its an issue with the library i guess when there's more than 6-7 SSID are found.

Out of topic, is there any way to reset wifi credentials?

My Code - Gdrive Link

is it possible to have update feather in the menu

i would like to see a webupdate feather in the menu, now in the main file i add ArduinoOta.h and ESP8266HTTPUpdateServer.h.
But it would realy be nice that this is implemented within autoconnect.

Fatal exception 3(LoadStoreErrorCause) when using Simple example (any example actually)

I was trying the library and it crashes for me using the any of the examples (Simple example used bellow) on every wifi connect. Any ideas? Can you help me use interpret the stack?

Thank you.

MY CONFIGURATION:

Hardware: nodemcu v3 12e (Lolin)
Core Version: 2.4.1 stable

Settings in IDE
ide 1.8.5

Module: nodemcu 1.0 12e
Flash Size: 4MB/1MB
IwIP Variant: v2 low memory (tried high bandwith as well)
CPU Frequency: 80Mhz
Flash Frequency: 80Mhz
Upload Using: SERIAL

AutoConnect version: 1.9.2
PageBuilder: 1.0.1
Example: Simple.ino

SKETCH

/*
  Simple.ino, Example for the AutoConnect library.
  Copyright (c) 2018, Hieromon Ikasamo
  https://github.com/Hieromon/AutoConnect

  This software is released under the MIT License.
  https://opensource.org/licenses/MIT
*/

#include <ESP8266WiFi.h>
#include <ESP8266WebServer.h>
#include <time.h>
#include <AutoConnect.h>

ESP8266WebServer Server;
AutoConnect      Portal(Server);

#define TIMEZONE    (3600 * 9)    // Tokyo
#define NTPServer1  "ntp.nict.jp" // NICT japan.
#define NTPServer2  "time1.google.com"

void rootPage() {
  String  content = 
    "<html>"
    "<head>"
    "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">"
    "</head>"
    "<body>"
    "<h2 align=\"center\" style=\"color:blue;margin:20px;\">Hello, world</h2>"
    "<h3 align=\"center\" style=\"color:gray;margin:10px;\">{{DateTime}}</h3>"
    "<p style=\"padding-top:10px;text-align:center\">" AUTOCONNECT_LINK(COG_32) "</p>"
    "</body>"
    "</html>";
  static const char *wd[7] = { "Sun","Mon","Tue","Wed","Thr","Fri","Sat" };
  struct tm *tm;
  time_t  t;
  char    dateTime[26];

  t = time(NULL);
  tm = localtime(&t);
  sprintf(dateTime, "%04d/%02d/%02d(%s) %02d:%02d:%02d.",
    tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
    wd[tm->tm_wday],
    tm->tm_hour, tm->tm_min, tm->tm_sec);
  content.replace("{{DateTime}}", String(dateTime));
  Server.send(200, "text/html", content);
}

void setup() {
  delay(1000);
  Serial.begin(115200);
  Serial.println();

  Server.on("/", rootPage);
  if (Portal.begin()) {
    Serial.println("WiFi connected: " + WiFi.localIP().toString());
    configTime(TIMEZONE, 0, NTPServer1, NTPServer2);
  }
}

void loop() {
  Portal.handleClient();
}

LOGS

wifi evt: 7
wifi evt: 7
wifi evt: 7
:urn 58
:urd 58, 58, 0
:urn 60
:urch 60, 35
:urd 60, 60, 0
:urd 35, 35, 0
:urn 35
:urd 35, 35, 0
WS:ac
:rn 131
:ref 1
WS:av
:ref 2
:ur 2
New client
:ref 2
:ur 2
method: GET url: /hotspot-detect.html search:
headerName: Host
headerValue: captive.apple.com
headerName: Connection
headerValue: close
headerName: User-Agent
headerValue: CaptiveNetworkSupport-355.30.1 wispr
:c0 1, 131
args:
Request: /hotspot-detect.html
Arguments:
request handler not found
:ref 2
:ur 2
:wr 122 122 0
:wrc 122 122 0
:ref 2
wifi evt: 7
:ur 2
:ref 2
:close
:ur 2
:ur 1
WS:dis
:del
WS:ac
:ref 1
WS:av
:ref 2
:ur 2
New client
:ref 2
:ur 2
:rn 111
method: GET url: /_ac search:
Fatal exception 3(LoadStoreErrorCause):
epc1=0x40214024, epc2=0x00000000, epc3=0x00000000, excvaddr=0x4024657e, depc=0x00000000

Exception (3):
epc1=0x40214024 epc2=0x00000000 epc3=0x00000000 excvaddr=0x4024657e depc=0x00000000

ctx: cont
sp: 3fff16c0 end: 3fff1b40 offset: 01a0

stack>>>
3fff1860: 3fff0a2c 0000041a 3fff18b0 402103e1
3fff1870: 00000000 3fff0570 3fff18b0 4021042e
3fff1880: 4024657e 3fff0570 3fff18a0 40210300
3fff1890: 0000001c 0000001c 3fff4114 4020df2d
3fff18a0: 00000000 00000000 00000000 40210364
3fff18b0: 3fff4134 0000000f 00000004 402103af
3fff18c0: 3fff0a2c 000000da 3fff1900 402103e1
3fff18d0: 3fff1930 3fff1900 3fff1900 402104e8
3fff18e0: 3ffea4a7 3fff0670 3fff0570 00000000
3fff18f0: 3fff1930 3fff0670 3fff0570 4020c405
3fff1900: 3fff2734 0000000f 00000004 402103af
3fff1910: 00000011 00000001 3fff195c 00000001
3fff1920: 3fff0570 00000001 4020c3b0 4020bf7f
3fff1930: 3fff2714 0000000f 00000004 40210510
3fff1940: 00000001 4020bf48 3fff2a6c 4020f040
3fff1950: 00000000 00000000 00000000 00000000
3fff1960: 00000000 00000000 3fff069c 40210510
3fff1970: 3ffea4a7 3fff0a50 3fff069c 4020b8e1
3fff1980: 3fff26f4 0000000f 00000004 00000001
3fff1990: 3fff077c 3fff0670 00000000 00000030
3fff19a0: ffffffff 3fffc6fc 00000001 3fff0570
3fff19b0: 3fff077c 3fff0670 00000000 00000030
3fff19c0: 00000000 00000001 3fff3fec 0000000f
3fff19d0: 00000000 3fff3fcc 0000000f 00000001
3fff19e0: 3fff2d94 0000000f 00000004 3fff3ef4
3fff19f0: 0000000f 00000003 3fff3cf4 0000001f
3fff1a00: 00000011 00000000 40210dd0 3fff0b20
3fff1a10: 3fff06c4 00000000 3fff06e0 3fff06c4
3fff1a20: 00000001 4020f008 00000001 3fff2a6c
3fff1a30: 00000000 3fff2d54 3fff069c 00000000
3fff1a40: 00000001 3fff06c4 3fff069c 4020a5ff
3fff1a50: 3fff0670 3fff077c 3fff376c 4020ee54
3fff1a60: 4023b873 00000000 40210dd0 3fff0b20
3fff1a70: 3fff0670 3fff077c 3fff0570 4020c80c
3fff1a80: 3fff0670 3fff077c 3fff0570 4020c986
3fff1a90: 40107530 01f4a8c0 40107530 01f4a8c0
3fff1aa0: 40107530 00000000 40212124 40212110
3fff1ab0: 00000000 0000012c 0000012c 4010020c
3fff1ac0: 3fffdad0 00000000 3fff29bc 3fff0b10
3fff1ad0: 3fffdad0 00000000 3fff0a50 4020c9bc
3fff1ae0: feefeffe 00000000 3fff0a50 4020717b
3fff1af0: 40207054 feefeffe 40212124 40212110
3fff1b00: 00000000 00000000 00000000 feefeffe
3fff1b10: feefeffe feefeffe feefeffe feefeffe
3fff1b20: feefeffe feefeffe 3fff0b08 40210e14
3fff1b30: feefeffe feefeffe 3fff0b20 40100a2c
<<<stack<<<

DECODED STACK

Decoding stack results

0x402103e1: String::copy(char const*, unsigned int) at /Users/user123/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/cores/esp8266/WString.cpp line 170
0x4021042e: String::String(char const*) at /Users/user123/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/cores/esp8266/WString.cpp line 36
0x40210300: String::~String() at /Users/user123/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/cores/esp8266/WString.cpp line 120
0x4020df2d: AutoConnect::_setupPage(String) at /Users/user123/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/xtensa-lx106-elf/include/c++/4.8.2/functional line 1336
0x40210364: String::changeBuffer(unsigned int) at /Users/user123/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/cores/esp8266/WString.cpp line 151
0x402103af: String::reserve(unsigned int) at /Users/user123/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/cores/esp8266/WString.cpp line 141
0x402103e1: String::copy(char const*, unsigned int) at /Users/user123/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/cores/esp8266/WString.cpp line 170
0x402104e8: String::operator=(String const&) at /Users/user123/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/cores/esp8266/WString.cpp line 215
0x4020c405: AutoConnect::_classifyHandle(HTTPMethod, String) at /Users/user123/Documents/Arduino/libraries/AutoConnect/src/AutoConnect.cpp line 509
0x402103af: String::reserve(unsigned int) at /Users/user123/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/cores/esp8266/WString.cpp line 141
0x4020c3b0: AutoConnect::_classifyHandle(HTTPMethod, String) at /Users/user123/Documents/Arduino/libraries/AutoConnect/src/AutoConnect.cpp line 496
0x4020bf7f: std::_Function_handler (AutoConnect*, std::_Placeholder1>, std::_Placeholder2>)> >::_M_invoke(std::_Any_data const&, HTTPMethod, String) at /Users/user123/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/xtensa-lx106-elf/include/c++/4.8.2/functional line 601
0x40210510: String::String(String const&) at /Users/user123/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/cores/esp8266/WString.cpp line 41
0x4020bf48: std::_Function_handler (AutoConnect*, std::_Placeholder1>, std::_Placeholder2>)> >::_M_invoke(std::_Any_data const&, HTTPMethod, String) at /Users/user123/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/xtensa-lx106-elf/include/c++/4.8.2/functional line 2054
0x4020f040: PageBuilder::canHandle(HTTPMethod, String) at /Users/user123/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/xtensa-lx106-elf/include/c++/4.8.2/functional line 2464
0x40210510: String::String(String const&) at /Users/user123/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/cores/esp8266/WString.cpp line 41
0x4020b8e1: ESP8266WebServer::_parseRequest(WiFiClient&) at /Users/user123/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/libraries/ESP8266WebServer/src/Parsing.cpp line 130
0x40210dd0: esp_yield() at /Users/user123/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/cores/esp8266/core_esp8266_main.cpp line 87
0x4020f008: PageBuilder::canHandle(HTTPMethod, String) at /Users/user123/Documents/Arduino/libraries/PageBuilder/src/PageBuilder.cpp line 45
0x4020a5ff: ESP8266WebServer::handleClient() at /Users/user123/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/libraries/ESP8266WebServer/src/ESP8266WebServer.cpp line 298
0x4020ee54: DNSServer::processNextRequest() at /Users/user123/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/libraries/DNSServer/src/DNSServer.cpp line 51
0x40210dd0: esp_yield() at /Users/user123/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/cores/esp8266/core_esp8266_main.cpp line 87
0x4020c80c: AutoConnect::handleClient() at /Users/user123/Documents/Arduino/libraries/AutoConnect/src/AutoConnect.cpp line 276
0x4020c986: AutoConnect::begin(char const*, char const*) at /Users/user123/Documents/Arduino/libraries/AutoConnect/src/AutoConnect.cpp line 139
0x40212124: std::_Function_base::_Base_manager ::_M_manager(std::_Any_data&, std::_Any_data const&, std::_Manager_operation) at /Users/user123/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/xtensa-lx106-elf/include/c++/4.8.2/functional line 1934
0x40212110: std::_Function_handler ::_M_invoke(std::_Any_data const&) at /Users/user123/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/xtensa-lx106-elf/include/c++/4.8.2/functional line 2069
0x4010020c: _umm_free at /Users/user123/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/cores/esp8266/umm_malloc/umm_malloc.c line 1291
0x4020c9bc: AutoConnect::begin() at /Users/user123/Documents/Arduino/libraries/AutoConnect/src/AutoConnect.cpp line 57
0x4020717b: setup() at /Users/user123/Documents/Arduino/libraries/AutoConnect/examples/Simple/Simple.ino line 55
0x40207054: rootPage() at /Users/user123/Documents/Arduino/libraries/AutoConnect/examples/Simple/Simple.ino line 22
0x40212124: std::_Function_base::_Base_manager ::_M_manager(std::_Any_data&, std::_Any_data const&, std::_Manager_operation) at /Users/user123/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/xtensa-lx106-elf/include/c++/4.8.2/functional line 1934
0x40212110: std::_Function_handler ::_M_invoke(std::_Any_data const&) at /Users/user123/Library/Arduino15/packages/esp8266/tools/xtensa-lx106-elf-gcc/1.20.0-26-gb404fb9-2/xtensa-lx106-elf/include/c++/4.8.2/functional line 2069
0x40210e14: loop_wrapper() at /Users/user123/Library/Arduino15/packages/esp8266/hardware/esp8266/2.4.1/cores/esp8266/core_esp8266_main.cpp line 118

timing will not change from home pages

how to take the timing from the computer or RTC? the home page timing keep remind as 1970/01/01(Thr) 00:04:25. seems it didn't get timing from the website .

Portmapping prohibits loading index.html

I'm using AutoConnect with static ip address. First starting with captive portal to obtain a dynamic ip-address. Then setting static ip address. It's working great, except for remote access to the index.html page on my esp8266.
While within my lan index.html can be reached direcly, from wan/internet/outside my lan it seems portmapping forces startup with captive portal, i.e. /_ac. Can this be fixed?

send value to custom config page as initial values.

hi Hieromon,

i can't make a sence on hot to set the initial values on a custom config page.

this is what i have so var:

// Loading from PROGMEM
const char settings[] PROGMEM = R"raw(
{
  "title" : "Dimmer Settings",
  "uri" : "/Settings",
  "menu" : true,
  "element" : [
    {
      "name" : "caption",
      "type" : "ACText",
      "value" : "Dimmer settings"
    },
    { "name" : "Dimvalue1",
      "type" : "ACInput",
      "value" : "10",
      "pattern": "^[0-6]?[0-9]$",    //review
      "label" : "Minimum dimvalue"
    },
    {
      "name": "save",
      "type": "ACSubmit",
      "value": "Save",
      "uri": "/saveDim"
    }
  ]
}
`)raw";

and this is my variable to send to the page
byte minDimValue;

this is in my setup

  portal.load(settings);
  portol.on("/Settings",settingsOn, AC_EXIT_AHEAD);   //is this right, and how should settingsOn look like
  portal.config(config);

Specify dynamically determined SSID

This topic from #3 .

Another thing your module when I start the AP I notice that it is good and it works but I think you should have the way to start with a dynamic SSID (for example the Mac or chip name) as well as start it with a key or without a password, that way the bookstore WiFi anafe, eh opted for you Liberia because in my opinion it is better developed.

json response instead of html

Is there a possibility of sending json response (a REST API or something) instead of html? This would give developers different ways of integrating AutoConnect into their projects. Thanks

How to turn on captive portal when the ESP8266 already connected to WiFi Connection

Hi, I just found this great library, and I think it's very useful and fits my needs. When I try to configure my ESP8266 WiFi through my phone, it works great and normal. But, I have problem when I want to change my ESP8266 WiFi connection while it's already connected to another WiFi connection that i already set before. I can't find my ESP8266 AP WiFi Connection and the only way to change the WiFi connection is by connect to the same router and find out the ESP8266 IP Address. Is there any other way to connect to the captive portal through ESP8266 AP?
Anyone have this same problem?

How to make the Username and password persistant

Good day All who might be monitoring this git. I would like to know how to make the username and password persistent, such that if the device can't connect to its current WiFi, the existing username and passwords are not over-written/erased until a new one is written. From what I gather whenever the http server is started" SoftAP" the existing values are erased. How can I change this? Thanks in advance

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.