All working!

This commit is contained in:
cschwinne 2016-09-14 20:42:46 +02:00
parent 01ce8971a7
commit 5a26df0b94

View File

@ -7,7 +7,7 @@
#include <NeoPixelBus.h> #include <NeoPixelBus.h>
#include <FS.h> #include <FS.h>
NeoPixelBus<NeoGrbFeature, Neo800KbpsMethod> strip(16); NeoPixelBus<NeoGrbFeature, NeoEsp8266Uart800KbpsMethod> strip(16, 1);
String clientssid = "Your_Network_Here"; String clientssid = "Your_Network_Here";
String clientpass = "Dummy_Pass"; String clientpass = "Dummy_Pass";
@ -21,8 +21,8 @@ IPAddress staticip(0, 0, 0, 0);
IPAddress staticgateway(0, 0, 0, 0); IPAddress staticgateway(0, 0, 0, 0);
IPAddress staticsubnet(255, 255, 255, 0); IPAddress staticsubnet(255, 255, 255, 0);
byte col[3]; byte col[]{256, 128, 0};
byte bri; byte bri = 128;
byte hue, sat; byte hue, sat;
boolean ota_lock = false; boolean ota_lock = false;
int led_amount = 16; int led_amount = 16;
@ -329,6 +329,7 @@ void handleSettingsSet()
clientpass = server.arg("CPASS"); clientpass = server.arg("CPASS");
} }
} }
if (server.hasArg("CMDNS")) cmdns = server.arg("CMDNS");
if (server.hasArg("APSSID")) apssid = server.arg("APSSID"); if (server.hasArg("APSSID")) apssid = server.arg("APSSID");
if (server.hasArg("APPASS")) if (server.hasArg("APPASS"))
{ {
@ -371,6 +372,7 @@ boolean handleSet(String req)
Serial.println(col[0]); Serial.println(col[0]);
XML_response(); XML_response();
setLeds();
return true; return true;
} }
@ -498,8 +500,10 @@ void handleFileList() {
void setLeds() { void setLeds() {
double d = bri;
double val = d /256;
for (int i=0; i<16; i++) { for (int i=0; i<16; i++) {
strip.SetPixelColor(i, RgbColor(col[0], col[1], col[2])); strip.SetPixelColor(i, RgbColor(col[0]*val, col[1]*val, col[2]*val));
} }
strip.Show(); strip.Show();
} }
@ -618,13 +622,13 @@ void setup() {
// Add service to MDNS // Add service to MDNS
MDNS.addService("http", "tcp", 80); MDNS.addService("http", "tcp", 80);
/*/ Initialize NeoPixel Strip // Initialize NeoPixel Strip
strip.Begin(); strip.Begin();
strip.Show();*/ setLeds();
if (nopwrled == 0) /*if (nopwrled == 0)
{ {
pinMode(BUILTIN_LED, OUTPUT); pinMode(BUILTIN_LED, OUTPUT);
} }*/
} }
void loop() { void loop() {
@ -647,7 +651,10 @@ void initCon()
{ {
WiFi.disconnect(); WiFi.disconnect();
Serial.println("Can't connect to network. Opening AP..."); Serial.println("Can't connect to network. Opening AP...");
String save = apssid;
apssid = "WLED-RECOVERY";
initAP(); initAP();
apssid = save;
return; return;
} }
} }