From 7ad2dc7519c3f0163048b4960ee5d8a91b11c5fd Mon Sep 17 00:00:00 2001 From: Anun Panya Date: Fri, 27 Oct 2017 18:16:54 +0700 Subject: [PATCH 1/2] Revert "Merge pull request #2 from anunpanya/master" This reverts commit 814ee37949f43a4d8a2c2e3de276fe86a3d109f8. --- examples/.DS_Store | Bin 6148 -> 6148 bytes .../Basic_WiFiManager/Basic_WiFiManager.ino | 159 ---------------- .../Basic_WiFiManager_DisconnectWiFi.ino | 178 ------------------ 3 files changed, 337 deletions(-) delete mode 100755 examples/Basic_WiFiManager/Basic_WiFiManager.ino delete mode 100755 examples/Basic_WiFiManager_DisconnectWiFi/Basic_WiFiManager_DisconnectWiFi.ino diff --git a/examples/.DS_Store b/examples/.DS_Store index d369dc2e123b8b3ee203ba270d6a3bbbefe4b20f..fcd6f5af684778d932fa2ddaa424ae322d805a0e 100644 GIT binary patch delta 86 zcmZoMXfc=|#>CJzu~2NHo}wrt0|NsP3otO`G9)tOF{Cg!GvrS!RNvgoSjD#a0V5OR lW_AvK4xon37a6}ZPv#fVB`mu~2NHo}wr-0|Nsi1A_nqLo!1=LpVbwgBwHU#EZ-8K@x%tP7H|* z#XvzMNd{k_SRN3kGo&&Ul?4~&<>cq3LyTciAglvujSJAkVxXD%Ky&hdrX(|zz^sOu qx3Qy^Z8JLuKL^mM8!vump3E -#include - -//needed for library -#include -#include -#include -#include //https://github.com/tzapu/WiFiManager - -//for LED status -#include -Ticker ticker; - -#define APPID "APPID" -#define KEY "APPKEY" -#define SECRET "APPSECRET" -#define ALIAS "esp8266" - -WiFiClient client; - -int timer = 0; -MicroGear microgear(client); - -void tick() -{ - //toggle state - int state = digitalRead(BUILTIN_LED); // get the current state of GPIO1 pin - digitalWrite(BUILTIN_LED, !state); // set pin to the opposite state -} - -//gets called when WiFiManager enters configuration mode -void configModeCallback (WiFiManager *myWiFiManager) { - Serial.println("Entered config mode"); - Serial.println(WiFi.softAPIP()); - //if you used auto generated SSID, print it - Serial.println(myWiFiManager->getConfigPortalSSID()); - //entered config mode, make led toggle faster - ticker.attach(0.2, tick); -} - -/* If a new message arrives, do this */ -void onMsghandler(char *topic, uint8_t* msg, unsigned int msglen) { - Serial.print("Incoming message --> "); - msg[msglen] = '\0'; - Serial.println((char *)msg); -} - -void onFoundgear(char *attribute, uint8_t* msg, unsigned int msglen) { - Serial.print("Found new member --> "); - for (int i=0; i "); - for (int i=0; i= 1000) { - Serial.println("Publish..."); - - /* Chat with the microgear named ALIAS which is myself */ - microgear.chat(ALIAS,"Hello"); - timer = 0; - } - else timer += 100; - } - else { - Serial.println("connection lost, reconnect..."); - if (timer >= 5000) { - microgear.connect(APPID); - timer = 0; - } - else timer += 100; - ticker.detach(); - } - delay(100); -} diff --git a/examples/Basic_WiFiManager_DisconnectWiFi/Basic_WiFiManager_DisconnectWiFi.ino b/examples/Basic_WiFiManager_DisconnectWiFi/Basic_WiFiManager_DisconnectWiFi.ino deleted file mode 100755 index 5f4d8b7..0000000 --- a/examples/Basic_WiFiManager_DisconnectWiFi/Basic_WiFiManager_DisconnectWiFi.ino +++ /dev/null @@ -1,178 +0,0 @@ -/* NETPIE ESP8266 basic sample */ -/* More information visit : https://netpie.io */ - -#include -#include - -//needed for library -#include -#include -#include -#include //https://github.com/tzapu/WiFiManager - -//for LED status -#include -Ticker ticker; - -#define APPID "APPID" -#define KEY "APPKEY" -#define SECRET "APPSECRET" -#define ALIAS "esp8266dev" - -WiFiClient client; - -int timer = 0; -int timeoutConnection = 0; -MicroGear microgear(client); - -void tick() -{ - //toggle state - int state = digitalRead(BUILTIN_LED); // get the current state of GPIO1 pin - digitalWrite(BUILTIN_LED, !state); // set pin to the opposite state -} - -//gets called when WiFiManager enters configuration mode -void configModeCallback (WiFiManager *myWiFiManager) { - Serial.println("Entered config mode"); - Serial.println(WiFi.softAPIP()); - //if you used auto generated SSID, print it - Serial.println(myWiFiManager->getConfigPortalSSID()); - //entered config mode, make led toggle faster - ticker.attach(0.2, tick); -} - -/* If a new message arrives, do this */ -void onMsghandler(char *topic, uint8_t* msg, unsigned int msglen) { - Serial.print("Incoming message --> "); - msg[msglen] = '\0'; - Serial.println((char *)msg); -} - -void onFoundgear(char *attribute, uint8_t* msg, unsigned int msglen) { - Serial.print("Found new member --> "); - for (int i=0; i "); - for (int i=0; i= 1000) { - Serial.println("Publish..."); - - /* Chat with the microgear named ALIAS which is myself */ - microgear.chat(ALIAS,"Hello"); - timer = 0; - } - else timer += 100; - } - else { - Serial.println("connection lost, reconnect..."); - if (timer >= 5000) { - microgear.connect(APPID); - timeoutConnection++; - timer = 0; - } - else timer += 100; - - if(timeoutConnection==6){ - if(WiFi.status()==WL_CONNECTED){ - WiFi.disconnect(); - } - initWiFi(); - } - ticker.detach(); - } - } - delay(100); -} From e9d582a1c6f89e65303f0f483922b8cab69ef12d Mon Sep 17 00:00:00 2001 From: Anun Panya Date: Tue, 2 Oct 2018 15:57:56 +0700 Subject: [PATCH 2/2] Revert "remove images" This reverts commit 6cbfe989055f217717421a3637fe901c05702435. --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 5557da0..10da7f6 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,9 @@ First attempt at a library. Lots more changes and fixes to do. Contributions are - choose one of the access points scanned, enter password, click save - ESP will try to connect. If successful, it relinquishes control back to your app. If not, reconnect to AP and reconfigure. +## How It Looks +![ESP8266 WiFi Captive Portal Homepage](http://i.imgur.com/YPvW9eql.png) ![ESP8266 WiFi Captive Portal Configuration](http://i.imgur.com/oicWJ4gl.png) + ## Wishlist - [x] remove dependency on EEPROM library - [x] move HTML Strings to PROGMEM