Compare commits

..

No commits in common. "master" and "3.0" have entirely different histories.
master ... 3.0

2 changed files with 11 additions and 22 deletions

View File

@ -53,7 +53,7 @@ For beginners I would recommend watching this setup tutorial below.
## 2. Software Configuration ## 2. Software Configuration
1. Download the Project from the [Releases at Github]( https://github.com/NimmLor/esp8266-nanoleaf-webserver/releases ) and extract the archive 1. Download the Project from the [Releases at Github]( https://github.com/NimmLor/esp8266-fastled-desk-light/releases ) and extract the archive
2. Open the **.ino** file inside the folder in the Arduino IDE 2. Open the **.ino** file inside the folder in the Arduino IDE
@ -77,7 +77,7 @@ For beginners I would recommend watching this setup tutorial below.
5. Configure the parameters 5. Configure the parameters
In the .ino file there are many parameters to change and tweak the essential settings are: In the .ino file there are many parameters to change and tweak the essential settings are:
- `DATA_PIN`: The pin where the LED-Strip is connected (Note: If you are using another controller such as a clone or a NodeMCU board, you may need to configure the pin assignment for FastLED, See also [this entry in the FastLED Wiki](https://github.com/FastLED/FastLED/wiki/ESP8266-notes)) - `DATA_PIN`: The pin where the LED-Strip is connected
- `LED_TYPE`: The type of LED strip that is used (WS2812B, WS2811, ...) - `LED_TYPE`: The type of LED strip that is used (WS2812B, WS2811, ...)
@ -86,7 +86,8 @@ For beginners I would recommend watching this setup tutorial below.
- `LEDS_PER_LINE`: Amount of LEDs inside **1x** slot of the core - `LEDS_PER_LINE`: Amount of LEDs inside **1x** slot of the core
- `SOUND_REACTIVE`: Uncomment to enable a sound reactive pattern when using a sound sensor - `SOUND_REACTIVE`: Uncomment to enable a sound reactive pattern when using a sound sensor
- `SENSOR_TYPE`: Model of the [Sensor](http://s.click.aliexpress.com/e/_sYiUrz) used
- `SENSOR_TYPE`: Model of the [Sensor](http://s.click.aliexpress.com/e/_sYiUrz) used
- `ENABLE_ALEXA_SUPPORT`: Uncomment to disable the Amazon Alexa Support - `ENABLE_ALEXA_SUPPORT`: Uncomment to disable the Amazon Alexa Support

View File

@ -28,7 +28,7 @@ extern "C" {
#include <EEPROM.h> #include <EEPROM.h>
#include "GradientPalettes.h" #include "GradientPalettes.h"
#include "Field.h" #include "Field.h"
#include <ESP8266mDNS.h> //Enable mDNS availability
/*######################## MAIN CONFIG ########################*/ /*######################## MAIN CONFIG ########################*/
@ -228,7 +228,9 @@ PatternAndNameList patterns = {
{ cloud2Twinkles, "Cloud 2 Twinkles" }, { cloud2Twinkles, "Cloud 2 Twinkles" },
{ oceanTwinkles, "Ocean Twinkles" }, { oceanTwinkles, "Ocean Twinkles" },
{ showSolidColor, "Solid Color" } { showSolidColor, "Solid Color" },
{ SetCustomPattern, "Custom Pattern"}
}; };
const uint8_t patternCount = ARRAY_SIZE(patterns); const uint8_t patternCount = ARRAY_SIZE(patterns);
@ -486,9 +488,7 @@ void setup() {
String g = webServer.arg("g"); String g = webServer.arg("g");
String b = webServer.arg("b"); String b = webServer.arg("b");
setSolidColor(r.toInt(), g.toInt(), b.toInt()); setSolidColor(r.toInt(), g.toInt(), b.toInt());
#ifdef ENABLE_ALEXA_SUPPORT
alexa_main->setColor(r.toInt(), g.toInt(), b.toInt()); alexa_main->setColor(r.toInt(), g.toInt(), b.toInt());
#endif
sendString(String(solidColor.r) + "," + String(solidColor.g) + "," + String(solidColor.b)); sendString(String(solidColor.r) + "," + String(solidColor.g) + "," + String(solidColor.b));
}); });
@ -519,9 +519,7 @@ void setup() {
webServer.on("/brightness", HTTP_POST, []() { webServer.on("/brightness", HTTP_POST, []() {
String value = webServer.arg("value"); String value = webServer.arg("value");
setBrightness(value.toInt()); setBrightness(value.toInt());
#ifdef ENABLE_ALEXA_SUPPORT
alexa_main->setValue(brightness); alexa_main->setValue(brightness);
#endif
sendInt(brightness); sendInt(brightness);
}); });
@ -616,17 +614,13 @@ void broadcastString(String name, String value)
} }
void loop() { void loop() {
MDNS.update();
// Add entropy to random number generator; we use a lot of it. // Add entropy to random number generator; we use a lot of it.
random16_add_entropy(random(65535)); random16_add_entropy(random(65535));
// dnsServer.processNextRequest(); // dnsServer.processNextRequest();
// webSocketsServer.loop(); // webSocketsServer.loop();
#ifdef ENABLE_ALEXA_SUPPORT
espalexa.loop();
#else
webServer.handleClient(); webServer.handleClient();
#endif
// handleIrInput(); // handleIrInput();
if (power == 0) { if (power == 0) {
@ -646,13 +640,7 @@ void loop() {
hasConnected = true; hasConnected = true;
Serial.print("Connected! Open http://"); Serial.print("Connected! Open http://");
Serial.print(WiFi.localIP()); Serial.print(WiFi.localIP());
Serial.println(" in your browser \n"); Serial.println(" in your browser");
if (!MDNS.begin(HOSTNAME)) {
Serial.println("Error setting up MDNS responder! \n");
} else {
Serial.println("mDNS responder started \n");
MDNS.addService("http", "tcp", 80);
}
} }
} }
@ -833,7 +821,7 @@ void setSolidColor(uint8_t r, uint8_t g, uint8_t b)
EEPROM.write(4, b); EEPROM.write(4, b);
EEPROM.commit(); EEPROM.commit();
setPatternName("Solid Color"); setPattern(29);
broadcastString("color", String(solidColor.r) + "," + String(solidColor.g) + "," + String(solidColor.b)); broadcastString("color", String(solidColor.r) + "," + String(solidColor.g) + "," + String(solidColor.b));
FastLED.show(); FastLED.show();