Merge with master, reformat
This commit is contained in:
parent
92a654b845
commit
1380fe8cac
5 changed files with 14 additions and 21 deletions
|
@ -188,6 +188,7 @@ void setup() {
|
||||||
// Setup: Neopixel
|
// Setup: Neopixel
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
strip.init();
|
strip.init();
|
||||||
|
strip.setBrightness(brightness);
|
||||||
strip.setSpeed(convertSpeed(ws2812fx_speed));
|
strip.setSpeed(convertSpeed(ws2812fx_speed));
|
||||||
//strip.setMode(FX_MODE_RAINBOW_CYCLE);
|
//strip.setMode(FX_MODE_RAINBOW_CYCLE);
|
||||||
strip.setColor(main_color.red, main_color.green, main_color.blue);
|
strip.setColor(main_color.red, main_color.green, main_color.blue);
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
// Color modes
|
// Color modes
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
|
||||||
///////////////////////
|
|
||||||
|
|
||||||
int dipInterval = 10;
|
int dipInterval = 10;
|
||||||
int darkTime = 250;
|
int darkTime = 250;
|
||||||
unsigned long currentDipTime;
|
unsigned long currentDipTime;
|
||||||
|
@ -99,7 +97,3 @@ void tv() {
|
||||||
strip.show();
|
strip.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
// Neopixel
|
// Neopixel
|
||||||
#define PIN D1 // PIN where neopixel / WS2811 strip is attached
|
#define PIN 5 // PIN (5 / D1) where neopixel / WS2811 strip is attached
|
||||||
#define NUMLEDS 7 // Number of leds in the strip
|
#define NUMLEDS 24 // Number of leds in the strip
|
||||||
//#define BUILTIN_LED 2 // ESP-12F has the built in LED on GPIO2, see https://github.com/esp8266/Arduino/issues/2192
|
//#define BUILTIN_LED 2 // ESP-12F has the built in LED on GPIO2, see https://github.com/esp8266/Arduino/issues/2192
|
||||||
#define BUTTON D2 // Input pin for switching the LED strip on / off, connect this PIN to ground to trigger button.
|
#define BUTTON 4 // Input pin (4 / D2) for switching the LED strip on / off, connect this PIN to ground to trigger button.
|
||||||
|
|
||||||
const char HOSTNAME[] = "ESP8266_VORONOI"; // Friedly hostname
|
const char HOSTNAME[] = "ESP8266_01"; // Friedly hostname
|
||||||
|
|
||||||
#define ENABLE_OTA // If defined, enable Arduino OTA code.
|
#define ENABLE_OTA // If defined, enable Arduino OTA code.
|
||||||
#define ENABLE_MQTT // If defined, enable MQTT client code.
|
#define ENABLE_MQTT // If defined, enable MQTT client code.
|
||||||
|
@ -26,7 +26,7 @@ uint32_t autoParams[][4] = { // color, speed, mode, duration (seconds)
|
||||||
char mqtt_intopic[strlen(HOSTNAME) + 4]; // Topic in will be: <HOSTNAME>/in
|
char mqtt_intopic[strlen(HOSTNAME) + 4]; // Topic in will be: <HOSTNAME>/in
|
||||||
char mqtt_outtopic[strlen(HOSTNAME) + 5]; // Topic out will be: <HOSTNAME>/out
|
char mqtt_outtopic[strlen(HOSTNAME) + 5]; // Topic out will be: <HOSTNAME>/out
|
||||||
|
|
||||||
const char mqtt_clientid[] = "McLighting"; // MQTT ClientID
|
const char mqtt_clientid[] = "ESP8266Client"; // MQTT ClientID
|
||||||
|
|
||||||
char mqtt_host[64] = "";
|
char mqtt_host[64] = "";
|
||||||
char mqtt_port[6] = "";
|
char mqtt_port[6] = "";
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
// Request handlers
|
// Request handlers
|
||||||
// ***************************************************************************
|
// ***************************************************************************
|
||||||
|
|
||||||
void getArgs() {
|
void getArgs() {
|
||||||
if (server.arg("rgb") != "") {
|
if (server.arg("rgb") != "") {
|
||||||
uint32_t rgb = (uint32_t) strtol(server.arg("rgb").c_str(), NULL, 16);
|
uint32_t rgb = (uint32_t) strtol(server.arg("rgb").c_str(), NULL, 16);
|
||||||
|
@ -124,10 +123,10 @@ void handleSetDifferentColors(uint8_t * mypayload) {
|
||||||
void handleRangeDifferentColors(uint8_t * mypayload) {
|
void handleRangeDifferentColors(uint8_t * mypayload) {
|
||||||
uint8_t* nextCommand = 0;
|
uint8_t* nextCommand = 0;
|
||||||
nextCommand = (uint8_t*) strtok((char*) mypayload, "R");
|
nextCommand = (uint8_t*) strtok((char*) mypayload, "R");
|
||||||
//While there is a range to process R0110<00ff00>
|
// While there is a range to process R0110<00ff00>
|
||||||
|
|
||||||
while (nextCommand) {
|
while (nextCommand) {
|
||||||
//Loop for each LED.
|
// Loop for each LED.
|
||||||
char startled[3] = { 0, 0, 0 };
|
char startled[3] = { 0, 0, 0 };
|
||||||
char endled[3] = { 0, 0, 0 };
|
char endled[3] = { 0, 0, 0 };
|
||||||
char colorval[7] = { 0, 0, 0, 0, 0, 0, 0 };
|
char colorval[7] = { 0, 0, 0, 0, 0, 0, 0 };
|
||||||
|
@ -141,19 +140,19 @@ void handleRangeDifferentColors(uint8_t * mypayload) {
|
||||||
while ( rangebegin <= rangeend ) {
|
while ( rangebegin <= rangeend ) {
|
||||||
char rangeData[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
char rangeData[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||||
if ( rangebegin < 10 ) {
|
if ( rangebegin < 10 ) {
|
||||||
//Create the valid 'nextCommand' structure
|
// Create the valid 'nextCommand' structure
|
||||||
sprintf(rangeData, "0%d%s", rangebegin, colorval);
|
sprintf(rangeData, "0%d%s", rangebegin, colorval);
|
||||||
}
|
}
|
||||||
if ( rangebegin >= 10 ) {
|
if ( rangebegin >= 10 ) {
|
||||||
//Create the valid 'nextCommand' structure
|
// Create the valid 'nextCommand' structure
|
||||||
sprintf(rangeData, "%d%s", rangebegin, colorval);
|
sprintf(rangeData, "%d%s", rangebegin, colorval);
|
||||||
}
|
}
|
||||||
//Set one LED
|
// Set one LED
|
||||||
handleSetSingleLED((uint8_t*) rangeData, 0);
|
handleSetSingleLED((uint8_t*) rangeData, 0);
|
||||||
rangebegin++;
|
rangebegin++;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Next Range at R
|
// Next Range at R
|
||||||
nextCommand = (uint8_t*) strtok(NULL, "R");
|
nextCommand = (uint8_t*) strtok(NULL, "R");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,4 +155,3 @@ void handleFileList() {
|
||||||
output += "]";
|
output += "]";
|
||||||
server.send(200, "text/json", output);
|
server.send(200, "text/json", output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue