Added WiFi Manager
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
//Config stuff
|
||||
|
||||
//Uncomment to enable wifi manager
|
||||
#define wifiManagerEnable
|
||||
|
||||
//
|
||||
|
||||
/* Speed Settings in Steps/Second
|
||||
* You will have to play with these values to find a
|
||||
* reliable setup. I recomend putting a small extra load
|
||||
|
||||
@@ -91,7 +91,10 @@ void ledTurn(int _mode) {
|
||||
//We will conigure Blynk with this
|
||||
void blynkConfig (){
|
||||
Blynk.config(auth,server,port);
|
||||
Blynk.connectWiFi(ssid,pass);
|
||||
|
||||
#if !(defined(wifiManagerEnabled))
|
||||
Blynk.connectWiFi(ssid,pass);
|
||||
#endif
|
||||
}
|
||||
|
||||
//This will connect or run blynk
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
|
||||
//version 2.6.0
|
||||
const int configVersion = 3;
|
||||
int safeConfigVersion = 3; //The oldest version of config that can
|
||||
//be updated from.
|
||||
|
||||
#include "structs.h"
|
||||
|
||||
@@ -37,6 +39,12 @@ long currentDistance = 0;
|
||||
#include <ArduinoOTA.h>
|
||||
#include "ota.h"
|
||||
|
||||
//wifiManager
|
||||
#ifdef wifiManagerEnable
|
||||
#include <WiFiManager.h>
|
||||
#include <ESP8266WebServer.h>
|
||||
#endif
|
||||
|
||||
//FastLED Setup
|
||||
#include <FastLED.h>
|
||||
FASTLED_USING_NAMESPACE
|
||||
@@ -179,9 +187,13 @@ pwmStruct pwm = {
|
||||
|
||||
void setup() {
|
||||
Serial.begin(74880);
|
||||
Serial.println("dsadsadaas");
|
||||
delay(50);
|
||||
|
||||
#ifdef wifiManagerEnable
|
||||
// WiFiManager intialization.
|
||||
WiFiManager wifi;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
analogWrite(PWM_PIN,0);
|
||||
@@ -206,7 +218,13 @@ void setup() {
|
||||
cmdAdd("pos",pos);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef wifiManagerEnable
|
||||
// Create AP, if necessary
|
||||
wifi.autoConnect(myHostName);
|
||||
|
||||
// Set WIFI module to STA mode
|
||||
WiFi.mode( WIFI_STA );
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -34,4 +34,4 @@ struct fastLED {
|
||||
int hue;
|
||||
int sat;
|
||||
int val;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user