Added WiFi Manager

This commit is contained in:
mrcory
2020-03-01 23:19:43 -05:00
parent bcfd223dbe
commit 8bc4984db5
4 changed files with 30 additions and 4 deletions
+5
View File
@@ -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
+4 -1
View File
@@ -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
+20 -2
View File
@@ -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
+1 -1
View File
@@ -34,4 +34,4 @@ struct fastLED {
int hue;
int sat;
int val;
}
};