added initialisation to setup so wifi is no longer global and it gets cleaned

dnsServer and webServer are also no longer global
readme updated
This commit is contained in:
Alex Tudorache
2015-10-09 18:33:41 +03:00
parent 97b74f2b19
commit ce8c9fea61
5 changed files with 40 additions and 16 deletions
+5 -5
View File
@@ -6,15 +6,15 @@
#include <DNSServer.h>
#include <WiFiManager.h> //https://github.com/tzapu/WiFiManager
//this intitilises the library, parameter is eeprom start
WiFiManager wifi;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
//WiFiManager
//Local intialization. Once its business is done, there is no need to keep it around
WiFiManager wifi;
//fetches ssid and pass from eeprom and tries to connect
//if it does not connect it starts an access point with the specified name
//here "AutoConnectAP"
@@ -28,4 +28,4 @@ void setup() {
void loop() {
// put your main code here, to run repeatedly:
}
}
@@ -1,26 +1,27 @@
#include <ESP8266WiFi.h> //https://github.com/esp8266/Arduino
//needed for library
#include <WiFiManager.h> //https://github.com/tzapu/WiFiManager
#include <EEPROM.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <DNSServer.h>
#include <WiFiManager.h> //https://github.com/tzapu/WiFiManager
//this intitilises the library, parameter is eeprom start
WiFiManager wifi;
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
//WiFiManager
//Local intialization. Once its business is done, there is no need to keep it around
WiFiManager wifi;
//reset settings - for testing
//wifi.resetSettings();
//WiFiManager
//sets timeout until configuration portal gets turned off
//useful to make it all retry or go to sleep
//in seconds