Skip to content

Commit

Permalink
Development (#2)
Browse files Browse the repository at this point in the history
* update library.properties

* clean up parameters

* oops

* clean up .h file

* fix tabs

* fix up parameters

* fixup debugging

* fixes paramid issues

paramid must be alphanumeric and adds {I} token support to use ids as input names if we make that optional.

* debugging clean

* oops

* adds exit to readme

* moved http strings to include, added token flags

* typo

* cleanup

* moved all html strings out of code

* more string tokens

* fix paramscount, oops

* doh...

* tzapu#454 adds WIFI_MANAGER_OVERRIDE_STRINGS

I dont feel like resolving conflicts

* fixup merge

* ajax test

* Bug fix for problem discovered when setting length to 1 for additional parameters

The initialization of the buffer holding the value stopped before the last character and storage did not take into account the extra-byte for end of string.

* debugsoftapconfig for esp32

* make debug funcs public

* fix esp32 examples

* fix esp32 wifi.ssid

* Update README.md

Esp32 warning

* camelcase _staShowStaticFields

* readme

* adds webclient checking for timeout delay

* remove reset, no reason for it

* converting token strings, in progress broken

* all tokens now in strings

* implemented info strings for esp32

* fix some html bugs

* change uptime

* infohelp align html

* added webserver precompiler warning

updates readme

* readme

* template

* Lower RAM usage of library

Place remaining debug messages into Flash using F().

* Update WiFiManager.cpp

* Update WiFiManager.cpp

* Update WiFiManager.cpp

* Create contributing.md

* Create ISSUE_TEMPLATE.md

* rename

* rename

* fix esp32 esp8266 bug

* moved strings to flash

* refactor ip form outputs

* adds disconnect method for users

non persistent disconnect

* publicized debug helpers

* ugh aliases

* moved all tokens to strings.h

* adds toggle for scan quality as percentage

`setScanDispPerc` until we have decent remplating

* oops

* defaulting to icons

* cleanup

* some more strings in progmem

* fix sketch size

* editing strings

* more strings cleanup

* refix memsketch

* more string cleanup

* left in debug

* comments

* typo

* dup define

* moved _wifissidprefix to progmem

* esp32 strings progmem

* strings

* file headers

* missed one file header

* Update ISSUE_TEMPLATE.md

* Update ISSUE_TEMPLATE.md

* documenting source

* change wifiscan detaisl to css for toggling

* more strings progmem

* oops broke lock icons

* bugged

* tzapu#528 adds getLastConxResult

* gitignore

no gitignore? add more stuff

* fix info page and adds esp32 aphostname

* testing tzapu#527

* fixes tzapu#527

* fix tzapu#527 for esp8266

* adds getWiFiIsSaved()

* doc blocks, reformatting code

* stability tzapu#527

* clean up

* remove debugging

* add result checking tzapu#527

* remove debugging

* change some uneeded ints

* feature tzapu#533 failure details

* allow empty ssids, bail earlier

* template update

* debuggin esp32 auth fail events

* tzapu#528

using a static var for esp32 event for now to get this working and test. Probably not the best, not sure what the best option is here for esp32 onevent static member function callbacks

* tzapu#528 WL_DISCONNECTED support for testing

* tzapu#534

* change webserver pointer to using

* remove warning

* fix some minor warnings

* adding menu control, in progress

* fix bug

* finish up menu customization

* fix template

* add param help

* fix up menus

* fix param crash

* fix menu and param save

* fix resetsettings

* adds mdns support

* change defs

* simplify debug

* comments

* fix menuids

* add wifiscan preloading with cache

This uses core scan object and assumes its lifetime, I am not sure what the scope is or how long it lives, will have to convert to local copy if its being lost, caching for 60s after startweb portal and 10s after root load, refresh bypasses cache

* fix order

* add preloadscan enable

* fix webserver pointer

* comments

* tzapu#542 handler

* tzapu#546 fix?

Since I do not know how to fix the delegated constructors properly, this should fix the issue for now

* oops tzapu#546

* adds erase

* add debugging

* remove dnsserver from readme

* adds nvs erase

// #define WM_ERASE_NVS // esp32 erase() will erase NVS

* oops

* adds opt erase flag

* fix savecallback tzapu#543

* fixup tzapu#548

* fix constructor

* move routes to strings

* oops fix constructor again

* remove preallocation of params memory

* init params as null

I started gettting odd exceptions, so I thought this should be null and not on the stack or pointing to garbage. I might be totally in the wrong here.

* fix customhtml parameters

* remove debug

* fixes tzapu#551

* disable ssid input autoformatting

autocorrect='off' autocapitalize='none'

* remove serial.prints

* fix up connection result for ondemand portal

* fix autoreconnect on auth failure

* notes

* fixes tzapu#555 oops

* added debug levels

* add esp shields

* Update README.md

* add WM_RTC def for rtc.h

* Added Custom DNS, fix newlines

* fix tabs

* comments

* oops

* remove testing

* minor layout fix to config

* add setShowDnsFields, adds edge case force hide ip fields

* adds section hrs

* showinfoerase toggle

* kludge setmenu with size so it works

Prboably going to add a vector for this, I do not want to add the overhead of std::array for something optional

* debug remove

* menuids as vector to deal with size

This kind of makes it a pain in the ass for users, not sure how to make this easier, I can take in an array of string ids, with a count arg, makes it easier, but then users can pass nonsense in, this way its enum ids, but damn it sure is convoluted. Welcome to ideas here...

```c++
  std::vector<WiFiManager::menu_page_t> menu = {wm.MENU_WIFI,wm.MENU_INFO,wm.MENU_PARAM,wm.MENU_CLOSE,wm.MENU_SEP,wm.MENU_ERASE,wm.MENU_EXIT};
  wm.setMenu(menu);
```

* adds handleClose

* add bug workaround for esp8266 softap

* oops

* fix debug blank

* travis testing

* change setmenu to take vector or array of strnig tokens

* travis testing

* change varnames

* fixing travis

* datatype fixes

* fix section compile error

* fix compiler warnings

* add esp32

* add esp32

* move menutokens

* add esp32

* add esp32

* fix debug levels

* ugh

* add esp32

* add esp32

* add esp32

* add esp32

* add esp32

* make travis build again

* Delete OnDemandConfigPortal.ino.cpp

Sigh

* fix fsparam spiffs examples for esp32

* spiffs case

* refactor connectwifi, adds save timeout

wifi save now no longer uses settimeout timeout

* fixes tzapu#573

* ugh remove test example

* fix parenths tzapu#573

* add setEnableConfigPortal(boolean enable) - if false dont open condig portal from autoConnect()

* getmodestr, handleerase(bool)

* fix handleerase add softapconfig catch fail

* fix nvs erase

* fix erroneous error debug

* adds chip revision efuse

not sure what use this is, as getChipRevision is usually the same anyway... shrug

* clean up defines, removed stuff for memory

* workaround for esp32 webserver parsearguments bug

* fixup scnanetworks

* fix some error logging

* fixes tzapu#581

adds htmlentities to ssid outputs, limited replacements for now

* comment

* fix savetimeout, too short, made optional

* fix menu output

removed test menu output, removed ref , not sure why I put that there....

* comments, debugging

* fixing up setmenu docblocks
  • Loading branch information
isots-code committed May 31, 2018
1 parent 628307d commit 033293c
Show file tree
Hide file tree
Showing 25 changed files with 3,471 additions and 733 deletions.
9 changes: 9 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Contributing PRs and ISSUES

The development branch is the active branch, no features or bugs will be fixed against master ( hotfixes may be considered ).

Please test against development branch before submitting issues, issues against master will be closed,

PRs against master may be kept open if provides something useful to other members.

Please open issues before sumbitting PRs against development, as commits might be occuring very frequently.
51 changes: 51 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@

Please fill the info fields, it helps to get you faster support ;)

if you have a stack dump decode it:
https://github.com/esp8266/Arduino/blob/master/doc/Troubleshooting/stack_dump.rst

for better debug messages:
https://github.com/esp8266/Arduino/blob/master/doc/Troubleshooting/debugging.rst

----------------------------- Remove above -----------------------------

### Basic Infos

#### Hardware
WiFimanager Branch/Release: Development

Hardware: ESP-12e, esp01, esp25

Core Version: 2.4.0, staging

### Description

Problem description

### Settings in IDE

Module: NodeMcu, Wemos D1

Additional libraries:

### Sketch

```cpp

#include <Arduino.h>

void setup() {

}

void loop() {

}
```

### Debug Messages

```
messages here
```

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
platformio.ini
44 changes: 31 additions & 13 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,52 @@
language: c
sudo: false

before_install:
- "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_1.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :1 -ac -screen 0 1280x1024x16"
- sleep 3
- export DISPLAY=:1.0
- wget http://downloads.arduino.cc/arduino-1.6.5-linux64.tar.xz
- tar xf arduino-1.6.5-linux64.tar.xz
- sudo mv arduino-1.6.5 /usr/local/share/arduino
- wget http://downloads.arduino.cc/arduino-1.8.5-linux64.tar.xz
- tar xf arduino-1.8.5-linux64.tar.xz
- sudo mv arduino-1.8.5 /usr/local/share/arduino
- sudo ln -s /usr/local/share/arduino/arduino /usr/local/bin/arduino

install:
- ln -s $PWD /usr/local/share/arduino/libraries/WiFiManager
# boards manager not working on 1.6.7 - 1.6.8
- arduino --pref "boardsmanager.additional.urls=http://arduino.esp8266.com/stable/package_esp8266com_index.json" --save-prefs
# install lib arduino json not working in 1.6.5
# - arduino --install-library "ArduinoJson"
- git clone https://github.com/bblanchon/ArduinoJson /usr/local/share/arduino/libraries/ArduinoJson
- arduino --install-library "ArduinoJson"
- arduino --install-boards esp8266:esp8266
- arduino --board esp8266:esp8266:generic --save-prefs
- arduino --pref "compiler.warning_level=all" --save-prefs
# install esp32
- pushd .
- mkdir -p ~/Arduino/hardware/espressif
- cd ~/Arduino/hardware/espressif
- git clone https://github.com/espressif/arduino-esp32.git esp32
- cd esp32
- git submodule update --init --recursive
- cd tools
- python2 get.py
- popd
# esp32 needs WebServer_tng for now
- git clone https://github.com/bbx10/WebServer_tng.git /usr/local/share/arduino/libraries/WebServer_tng

script:
- "echo $PWD"
- "echo $HOME"
- "ls $PWD"
- source $TRAVIS_BUILD_DIR/travis/common.sh
- arduino --board esp8266:esp8266:generic:CpuFrequency=80,CrystalFreq=26,FlashFreq=40,FlashMode=qio,FlashSize=4M1M,led=2,LwIPVariant=v2mss536,Debug=Serial,DebugLevel=CORE --save-prefs
- build_examples
# - "cat $PWD/examples/AutoConnect/AutoConnect.ino"
- arduino --board espressif:esp32:esp32doit-devkit-v1:FlashFreq=80,DebugLevel=info --save-prefs
# some examples fail (SPIFFS defines differ esp32 vs esp8266) so we exclude them
- excludes=("AutoConnectWithFSParametersAndCustomIP.ino" "AutoConnectWithFSParameters.ino")
- build_examples "${excludes[@]}"
# - arduino -v --verbose-build --verify $PWD/examples/AutoConnect/AutoConnect.ino
# - arduino --verify --board arduino:avr:uno $PWD/examples/IncomingCall/IncomingCall.ino
# - arduino --verify --board arduino:avr:uno $PWD/examples/AdafruitIO_GPS/AdafruitIO_GPS.ino
after_success:
- bash <(curl -s https://codecov.io/bash)

# no coverage generated, no need to run
#
#after_success:
# - bash <(curl -s https://codecov.io/bash)

notifications:
email:
on_success: change
Expand Down
65 changes: 47 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,26 @@
# WiFiManager
ESP8266 WiFi Connection manager with fallback web configuration portal

[![Build Status](https://travis-ci.org/tzapu/WiFiManager.svg?branch=master)](https://travis-ci.org/tzapu/WiFiManager)
[![Build Status](https://travis-ci.org/tzapu/WiFiManager.svg?branch=development)](https://travis-ci.org/tzapu/WiFiManager)

![ESP8266](https://img.shields.io/badge/ESP-8266-000000.svg?longCache=true&style=flat&colorA=CC101F)
![ESP32](https://img.shields.io/badge/ESP-32-000000.svg?longCache=true&style=flat&colorA=CC101F)

The configuration portal is of the captive variety, so on various devices it will present the configuration dialogue as soon as you connect to the created access point.

First attempt at a library. Lots more changes and fixes to do. Contributions are welcome.

#### This works with the ESP8266 Arduino platform with a recent stable release(2.0.0 or newer) https://github.com/esp8266/Arduino
**This works with the ESP8266 Arduino platform with a recent stable release(2.0.0 or newer)**

[https://github.com/esp8266/Arduino](https://github.com/esp8266/Arduino)

**This works with the ESP32 Arduino platform with staging , with caveats below**

[https://github.com/espressif/arduino-esp32](https://github.com/espressif/arduino-esp32)

### Known Issues
* :exclamation: ESP32 must be patched with webserver library, see [https://github.com/tzapu/WiFiManager/issues/513](https://github.com/tzapu/WiFiManager/issues/513)
* Documentation needs to be updated, see [https://github.com/tzapu/WiFiManager/issues/500](https://github.com/tzapu/WiFiManager/issues/500)

## Contents
- [How it works](#how-it-works)
Expand Down Expand Up @@ -43,16 +56,19 @@ First attempt at a library. Lots more changes and fixes to do. Contributions are
![ESP8266 WiFi Captive Portal Homepage](http://i.imgur.com/YPvW9eql.png) ![ESP8266 WiFi Captive Portal Configuration](http://i.imgur.com/oicWJ4gl.png)

## Wishlist
- ~~remove dependency on EEPROM library~~
- ~~move HTML Strings to PROGMEM~~
- ~~cleanup and streamline code~~ (although this is ongoing)
- if timeout is set, extend it when a page is fetched in AP mode
- ~~add ability to configure more parameters than ssid/password~~
- ~~maybe allow setting ip of ESP after reboot~~
- ~~add to Arduino Library Manager~~
- ~~add to PlatformIO~~
- add multiple sets of network credentials
- ~~allow users to customize CSS~~
- [x] remove dependency on EEPROM library
- [x] move HTML Strings to PROGMEM
- [x] cleanup and streamline code (although this is ongoing)
- [x] if timeout is set, extend it when a page is fetched in AP mode
- [x] add ability to configure more parameters than ssid/password
- [x] maybe allow setting ip of ESP after reboot
- [x] add to Arduino Library Manager
- [x] add to PlatformIO
- [ ] add multiple sets of network credentials
- [x] allow users to customize CSS
- [ ] ESP32 support or instructions
- [ ] rewrite documentation for simplicity, based on scenarios/goals
- [ ] rely on the SDK's built in auto connect more than forcing a connect

## Quick Start

Expand Down Expand Up @@ -179,25 +195,31 @@ void loop() {
```
See example for a more complex version. [OnDemandConfigPortal](https://github.com/tzapu/WiFiManager/tree/master/examples/OnDemandConfigPortal)

#### Exiting from the Configuration Portal
Normally, once entered, the configuration portal will continue to loop until WiFi credentials have been successfully entered or a timeout is reached.
If you'd prefer to exit without joining a WiFi network, say becuase you're going to put the ESP into AP mode, then press the "Exit" button
on the main webpage.
If started via `autoConnect` or `startConfigPortal` then it will return `false (portalAbortResult)`

#### Custom Parameters
You can use WiFiManager to collect more parameters than just SSID and password.
This could be helpful for configuring stuff like MQTT host and port, [blynk](http://www.blynk.cc) or [emoncms](http://emoncms.org) tokens, just to name a few.
**You are responsible for saving and loading these custom values.** The library just collects and displays the data for you as a convenience.
Usage scenario would be:
- load values from somewhere (EEPROM/FS) or generate some defaults
- add the custom parameters to WiFiManager using
```cpp
```cpp
// id/name, placeholder/prompt, default, length
WiFiManagerParameter custom_mqtt_server("server", "mqtt server", mqtt_server, 40);
wifiManager.addParameter(&custom_mqtt_server);

```
```
- if connection to AP fails, configuration portal starts and you can set /change the values (or use on demand configuration portal)
- once configuration is done and connection is established [save config callback]() is called
- once WiFiManager returns control to your application, read and save the new values using the `WiFiManagerParameter` object.
```cpp
```cpp
mqtt_server = custom_mqtt_server.getValue();
```
```
This feature is a lot more involved than all the others, so here are some examples to fully show how it is done.
You should also take a look at adding custom HTML to your form.

Expand Down Expand Up @@ -339,6 +361,10 @@ __THANK YOU__

[Shawn A](https://github.com/tablatronix)

[bbx10](https://github.com/bbx10)

[kentaylor](https://github.com/kentaylor)

[Maximiliano Duarte](https://github.com/domonetic)

[alltheblinkythings](https://github.com/alltheblinkythings)
Expand All @@ -363,7 +389,10 @@ __THANK YOU__

[walthercarsten](https://github.com/walthercarsten)

Sorry if i have missed anyone.
And countless others

#### Inspiration
- http://www.esp8266.com/viewtopic.php?f=29&t=2520
* http://www.esp8266.com/viewtopic.php?f=29&t=2520
* https://github.com/chriscook8/esp-arduino-apboot
* https://github.com/esp8266/Arduino/tree/master/libraries/DNSServer/examples/CaptivePortalAdvanced
* Built by AlexT https://github.com/tzapu

0 comments on commit 033293c

Please sign in to comment.