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, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||||
|
|
||||||
|
void cubeXGradientPalette() {
|
||||||
|
uint8_t hues = 8;
|
||||||
|
|
||||||
|
for (uint16_t i = 0; i < NUM_LEDS; i++) {
|
||||||
|
uint8_t x = coordsX[i];
|
||||||
|
|
||||||
|
leds[i] = ColorFromPalette(gCurrentPalette, beat8(speed) - (x * hues));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void cubeYGradientPalette() {
|
||||||
|
uint8_t hues = 8;
|
||||||
|
|
||||||
|
for (uint16_t i = 0; i < NUM_LEDS; i++) {
|
||||||
|
uint8_t y = coordsY[i];
|
||||||
|
|
||||||
|
leds[i] = ColorFromPalette(gCurrentPalette, beat8(speed) - (y * hues));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void cubeZGradientPalette() {
|
||||||
|
uint8_t hues = 8;
|
||||||
|
|
||||||
|
for (uint16_t i = 0; i < NUM_LEDS; i++) {
|
||||||
|
uint8_t z = coordsZ[i];
|
||||||
|
|
||||||
|
leds[i] = ColorFromPalette(gCurrentPalette, beat8(speed) - (z * hues));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void cubeXYGradientPalette() {
|
||||||
|
uint8_t hues = 8;
|
||||||
|
|
||||||
|
for (uint16_t i = 0; i < NUM_LEDS; i++) {
|
||||||
|
uint8_t x = coordsX[i];
|
||||||
|
uint8_t y = coordsY[i];
|
||||||
|
|
||||||
|
leds[i] = ColorFromPalette(gCurrentPalette, beat8(speed) - ((x + y) * hues));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void cubeXZGradientPalette() {
|
||||||
|
uint8_t hues = 8;
|
||||||
|
|
||||||
|
for (uint16_t i = 0; i < NUM_LEDS; i++) {
|
||||||
|
uint8_t x = coordsX[i];
|
||||||
|
uint8_t z = coordsZ[i];
|
||||||
|
|
||||||
|
leds[i] = ColorFromPalette(gCurrentPalette, beat8(speed) - ((x + z) * hues));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void cubeYZGradientPalette() {
|
||||||
|
uint8_t hues = 8;
|
||||||
|
|
||||||
|
for (uint16_t i = 0; i < NUM_LEDS; i++) {
|
||||||
|
uint8_t y = coordsY[i];
|
||||||
|
uint8_t z = coordsZ[i];
|
||||||
|
|
||||||
|
leds[i] = ColorFromPalette(gCurrentPalette, beat8(speed) - ((y + z) * hues));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void cubeXYZGradientPalette() {
|
||||||
|
uint8_t hues = 8;
|
||||||
|
|
||||||
|
for (uint16_t i = 0; i < NUM_LEDS; i++) {
|
||||||
|
uint8_t x = coordsX[i];
|
||||||
|
uint8_t y = coordsY[i];
|
||||||
|
uint8_t z = coordsZ[i];
|
||||||
|
|
||||||
|
leds[i] = ColorFromPalette(gCurrentPalette, beat8(speed) - ((x + y + z) * hues));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
212
Noise.h
Normal file
212
Noise.h
Normal file
@ -0,0 +1,212 @@
|
|||||||
|
/*
|
||||||
|
ESP8266 + FastLED + IR Remote: https://github.com/jasoncoon/esp8266-fastled-webserver
|
||||||
|
Copyright (C) 2015-2016 Jason Coon
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// The 16 bit version of our coordinates
|
||||||
|
uint16_t noisex;
|
||||||
|
uint16_t noisey;
|
||||||
|
uint16_t noisez;
|
||||||
|
|
||||||
|
// We're using the x/y dimensions to map to the x/y pixels on the matrix. We'll
|
||||||
|
// use the z-axis for "time". speed determines how fast time moves forward. Try
|
||||||
|
// 1 for a very slow moving effect, or 60 for something that ends up looking like
|
||||||
|
// water.
|
||||||
|
int8_t noisespeedx = 0;
|
||||||
|
int8_t noisespeedy = 1;
|
||||||
|
int8_t noisespeedz = 0;
|
||||||
|
|
||||||
|
// Scale determines how far apart the pixels in our noise matrix are. Try
|
||||||
|
// changing these values around to see how it affects the motion of the display. The
|
||||||
|
// higher the value of scale, the more "zoomed out" the noise will be. A value
|
||||||
|
// of 1 will be so zoomed in, you'll mostly see solid colors.
|
||||||
|
uint16_t noisescale = 1; // scale is set dynamically once we've started up
|
||||||
|
|
||||||
|
uint8_t colorLoop = 0;
|
||||||
|
|
||||||
|
CRGBPalette16 blackAndWhiteStripedPalette;
|
||||||
|
|
||||||
|
// This function sets up a palette of black and white stripes,
|
||||||
|
// using code. Since the palette is effectively an array of
|
||||||
|
// sixteen CRGB colors, the various fill_* functions can be used
|
||||||
|
// to set them up.
|
||||||
|
void SetupBlackAndWhiteStripedPalette()
|
||||||
|
{
|
||||||
|
// 'black out' all 16 palette entries...
|
||||||
|
fill_solid( blackAndWhiteStripedPalette, 16, CRGB::Black);
|
||||||
|
// and set every fourth one to white.
|
||||||
|
blackAndWhiteStripedPalette[0] = CRGB::White;
|
||||||
|
blackAndWhiteStripedPalette[4] = CRGB::White;
|
||||||
|
blackAndWhiteStripedPalette[8] = CRGB::White;
|
||||||
|
blackAndWhiteStripedPalette[12] = CRGB::White;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
CRGBPalette16 blackAndBlueStripedPalette;
|
||||||
|
|
||||||
|
// This function sets up a palette of black and blue stripes,
|
||||||
|
// using code. Since the palette is effectively an array of
|
||||||
|
// sixteen CRGB colors, the various fill_* functions can be used
|
||||||
|
// to set them up.
|
||||||
|
void SetupBlackAndBlueStripedPalette()
|
||||||
|
{
|
||||||
|
// 'black out' all 16 palette entries...
|
||||||
|
fill_solid( blackAndBlueStripedPalette, 16, CRGB::Black);
|
||||||
|
|
||||||
|
for(uint8_t i = 0; i < 6; i++) {
|
||||||
|
blackAndBlueStripedPalette[i] = CRGB::Blue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// There are several different palettes of colors demonstrated here.
|
||||||
|
//
|
||||||
|
// FastLED provides several 'preset' palettes: RainbowColors_p, RainbowStripeColors_p,
|
||||||
|
// OceanColors_p, CloudColors_p, LavaColors_p, ForestColors_p, and PartyColors_p.
|
||||||
|
//
|
||||||
|
// Additionally, you can manually define your own color palettes, or you can write
|
||||||
|
// code that creates color palettes on the fly.
|
||||||
|
|
||||||
|
void drawNoise3d(CRGBPalette16 palette, uint8_t hueReduce = 0)
|
||||||
|
{
|
||||||
|
for(uint16_t i = 0; i < NUM_LEDS; i++) {
|
||||||
|
uint8_t x = coordsX[i];
|
||||||
|
uint8_t y = coordsY[i];
|
||||||
|
uint8_t z = coordsZ[i];
|
||||||
|
|
||||||
|
int xoffset = noisescale * x;
|
||||||
|
int yoffset = noisescale * y;
|
||||||
|
int zoffset = noisescale * z;
|
||||||
|
|
||||||
|
uint8_t data = inoise8(x + xoffset + noisex, y + yoffset + noisey, z + zoffset + noisez);
|
||||||
|
|
||||||
|
// The range of the inoise8 function is roughly 16-238.
|
||||||
|
// These two operations expand those values out to roughly 0..255
|
||||||
|
// You can comment them out if you want the raw noise data.
|
||||||
|
data = qsub8(data, 16);
|
||||||
|
data = qadd8(data, scale8(data, 39));
|
||||||
|
|
||||||
|
if(hueReduce > 0 && data >= hueReduce)
|
||||||
|
data -= hueReduce;
|
||||||
|
|
||||||
|
leds[i] = ColorFromPalette(palette, data, 255, LINEARBLEND);
|
||||||
|
}
|
||||||
|
|
||||||
|
noisex += noisespeedx;
|
||||||
|
noisey += noisespeedy;
|
||||||
|
noisez += noisespeedz;
|
||||||
|
}
|
||||||
|
|
||||||
|
void rainbowNoise3d() {
|
||||||
|
noisespeedx = 0;
|
||||||
|
noisespeedy = 0;
|
||||||
|
noisespeedz = -1;
|
||||||
|
noisescale = 24;
|
||||||
|
colorLoop = 0;
|
||||||
|
drawNoise3d(RainbowColors_p);
|
||||||
|
}
|
||||||
|
|
||||||
|
void rainbowStripeNoise3d() {
|
||||||
|
noisespeedx = 0;
|
||||||
|
noisespeedy = 0;
|
||||||
|
noisespeedz = -2;
|
||||||
|
noisescale = 24;
|
||||||
|
colorLoop = 0;
|
||||||
|
drawNoise3d(RainbowStripeColors_p);
|
||||||
|
}
|
||||||
|
|
||||||
|
void partyNoise3d() {
|
||||||
|
noisespeedx = -9;
|
||||||
|
noisespeedy = 0;
|
||||||
|
noisespeedz = 0;
|
||||||
|
noisescale = 32;
|
||||||
|
colorLoop = 0;
|
||||||
|
drawNoise3d(PartyColors_p);
|
||||||
|
}
|
||||||
|
|
||||||
|
void forestNoise3d() {
|
||||||
|
noisespeedx = -9;
|
||||||
|
noisespeedy = 0;
|
||||||
|
noisespeedz = 0;
|
||||||
|
noisescale = 32;
|
||||||
|
colorLoop = 0;
|
||||||
|
drawNoise3d(ForestColors_p);
|
||||||
|
}
|
||||||
|
|
||||||
|
void cloudNoise3d() {
|
||||||
|
noisespeedx = -2;
|
||||||
|
noisespeedy = 0;
|
||||||
|
noisespeedz = 0;
|
||||||
|
noisescale = 24;
|
||||||
|
colorLoop = 0;
|
||||||
|
drawNoise3d(CloudColors_p);
|
||||||
|
}
|
||||||
|
|
||||||
|
void fireNoise3d() {
|
||||||
|
noisespeedx = 16;
|
||||||
|
noisespeedy = 16;
|
||||||
|
noisespeedz = 16;
|
||||||
|
noisescale = 64;
|
||||||
|
colorLoop = 0;
|
||||||
|
drawNoise3d(HeatColors_p, 60);
|
||||||
|
}
|
||||||
|
|
||||||
|
void fireNoise23d() {
|
||||||
|
noisespeedx = 3;
|
||||||
|
noisespeedy = 3;
|
||||||
|
noisespeedz = 3;
|
||||||
|
noisescale = 32;
|
||||||
|
colorLoop = 0;
|
||||||
|
drawNoise3d(HeatColors_p);
|
||||||
|
}
|
||||||
|
|
||||||
|
void lavaNoise3d() {
|
||||||
|
noisespeedx = -4;
|
||||||
|
noisespeedy = -4;
|
||||||
|
noisespeedz = -4;
|
||||||
|
noisescale = 32;
|
||||||
|
colorLoop = 0;
|
||||||
|
drawNoise3d(LavaColors_p);
|
||||||
|
}
|
||||||
|
|
||||||
|
void oceanNoise3d() {
|
||||||
|
noisespeedx = -2;
|
||||||
|
noisespeedy = 0;
|
||||||
|
noisespeedz = 4;
|
||||||
|
noisescale = 24;
|
||||||
|
colorLoop = 0;
|
||||||
|
drawNoise3d(OceanColors_p);
|
||||||
|
}
|
||||||
|
|
||||||
|
void blackAndWhiteNoise3d() {
|
||||||
|
SetupBlackAndWhiteStripedPalette();
|
||||||
|
noisespeedx = -12;
|
||||||
|
noisespeedy = 0;
|
||||||
|
noisespeedz = 0;
|
||||||
|
noisescale = 24;
|
||||||
|
colorLoop = 0;
|
||||||
|
drawNoise3d(blackAndWhiteStripedPalette);
|
||||||
|
}
|
||||||
|
|
||||||
|
void blackAndBlueNoise3d() {
|
||||||
|
SetupBlackAndBlueStripedPalette();
|
||||||
|
noisespeedx = -4;
|
||||||
|
noisespeedy = -4;
|
||||||
|
noisespeedz = -4;
|
||||||
|
noisescale = 32;
|
||||||
|
colorLoop = 0;
|
||||||
|
drawNoise3d(blackAndBlueStripedPalette);
|
||||||
|
}
|
||||||
|
|
@ -1,21 +1,23 @@
|
|||||||
/*
|
/*
|
||||||
* ESP8266 + FastLED + IR Remote: https://github.com/jasoncoon/esp8266-fastled-webserver
|
ESP8266 + FastLED + IR Remote: https://github.com/jasoncoon/esp8266-fastled-webserver
|
||||||
* Copyright (C) 2015-2016 Jason Coon
|
Copyright (C) 2015-2016 Jason Coon
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
* (at your option) any later version.
|
(at your option) any later version.
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
GNU General Public License for more details.
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//#define FASTLED_ALLOW_INTERRUPTS 0
|
||||||
|
#define FASTLED_INTERRUPT_RETRY_COUNT 0
|
||||||
#include <FastLED.h>
|
#include <FastLED.h>
|
||||||
FASTLED_USING_NAMESPACE
|
FASTLED_USING_NAMESPACE
|
||||||
|
|
||||||
@ -39,10 +41,10 @@ extern "C" {
|
|||||||
|
|
||||||
#define HOSTNAME "ESP8266-" ///< Hostname. The setup function adds the Chip ID at the end.
|
#define HOSTNAME "ESP8266-" ///< Hostname. The setup function adds the Chip ID at the end.
|
||||||
|
|
||||||
#define RECV_PIN D4
|
//#define RECV_PIN D4
|
||||||
IRrecv irReceiver(RECV_PIN);
|
//IRrecv irReceiver(RECV_PIN);
|
||||||
|
|
||||||
#include "Commands.h"
|
//#include "Commands.h"
|
||||||
|
|
||||||
const bool apMode = false;
|
const bool apMode = false;
|
||||||
|
|
||||||
@ -59,10 +61,10 @@ ESP8266HTTPUpdateServer httpUpdateServer;
|
|||||||
|
|
||||||
#include "FSBrowser.h"
|
#include "FSBrowser.h"
|
||||||
|
|
||||||
#define DATA_PIN D8
|
#define DATA_PIN D5
|
||||||
#define LED_TYPE WS2811
|
#define LED_TYPE WS2812B
|
||||||
#define COLOR_ORDER GRB
|
#define COLOR_ORDER GRB
|
||||||
#define NUM_LEDS 24
|
#define NUM_LEDS 8 * 8 * 6
|
||||||
|
|
||||||
#define MILLI_AMPS 2000 // IMPORTANT: set the max milli-Amps of your power supply (4A = 4000mA)
|
#define MILLI_AMPS 2000 // IMPORTANT: set the max milli-Amps of your power supply (4A = 4000mA)
|
||||||
#define FRAMES_PER_SECOND 120 // here you can control the speed. With the Access Point / Web Server the animations run a bit slower.
|
#define FRAMES_PER_SECOND 120 // here you can control the speed. With the Access Point / Web Server the animations run a bit slower.
|
||||||
@ -133,6 +135,8 @@ typedef PatternAndName PatternAndNameList[];
|
|||||||
|
|
||||||
#include "Twinkles.h"
|
#include "Twinkles.h"
|
||||||
#include "TwinkleFOX.h"
|
#include "TwinkleFOX.h"
|
||||||
|
#include "Map.h"
|
||||||
|
#include "Noise.h"
|
||||||
|
|
||||||
// List of patterns to cycle through. Each is defined as a separate function below.
|
// List of patterns to cycle through. Each is defined as a separate function below.
|
||||||
|
|
||||||
@ -140,6 +144,28 @@ PatternAndNameList patterns = {
|
|||||||
{ pride, "Pride" },
|
{ pride, "Pride" },
|
||||||
{ colorWaves, "Color Waves" },
|
{ colorWaves, "Color Waves" },
|
||||||
|
|
||||||
|
{ cubeXGradientPalette, "Cube X Gradient Palette" },
|
||||||
|
{ cubeYGradientPalette, "Cube Y Gradient Palette" },
|
||||||
|
{ cubeZGradientPalette, "Cube Z Gradient Palette" },
|
||||||
|
|
||||||
|
{ cubeXYGradientPalette, "Cube XY Gradient Palette" },
|
||||||
|
{ cubeXZGradientPalette, "Cube XZ Gradient Palette" },
|
||||||
|
{ cubeYZGradientPalette, "Cube YZ Gradient Palette" },
|
||||||
|
{ cubeXYZGradientPalette, "Cube XYZ Gradient Palette" },
|
||||||
|
|
||||||
|
// 3d noise patterns
|
||||||
|
{ fireNoise3d, "Fire Noise 3D" },
|
||||||
|
{ fireNoise23d, "Fire Noise 2 3D" },
|
||||||
|
{ lavaNoise3d, "Lava Noise 3D" },
|
||||||
|
{ rainbowNoise3d, "Rainbow Noise 3D" },
|
||||||
|
{ rainbowStripeNoise3d, "Rainbow Stripe Noise 3D" },
|
||||||
|
{ partyNoise3d, "Party Noise 3D" },
|
||||||
|
{ forestNoise3d, "Forest Noise 3D" },
|
||||||
|
{ cloudNoise3d, "Cloud Noise 3D" },
|
||||||
|
{ oceanNoise3d, "Ocean Noise 3D" },
|
||||||
|
{ blackAndWhiteNoise3d, "Black & White Noise 3D" },
|
||||||
|
{ blackAndBlueNoise3d, "Black & Blue Noise 3D" },
|
||||||
|
|
||||||
// twinkle patterns
|
// twinkle patterns
|
||||||
{ rainbowTwinkles, "Rainbow Twinkles" },
|
{ rainbowTwinkles, "Rainbow Twinkles" },
|
||||||
{ snowTwinkles, "Snow Twinkles" },
|
{ snowTwinkles, "Snow Twinkles" },
|
||||||
@ -210,6 +236,8 @@ const String paletteNames[paletteCount] = {
|
|||||||
#include "Fields.h"
|
#include "Fields.h"
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
|
WiFi.setSleepMode(WIFI_NONE_SLEEP);
|
||||||
|
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
delay(100);
|
delay(100);
|
||||||
Serial.setDebugOutput(true);
|
Serial.setDebugOutput(true);
|
||||||
@ -228,7 +256,7 @@ void setup() {
|
|||||||
|
|
||||||
FastLED.setBrightness(brightness);
|
FastLED.setBrightness(brightness);
|
||||||
|
|
||||||
irReceiver.enableIRIn(); // Start the receiver
|
// irReceiver.enableIRIn(); // Start the receiver
|
||||||
|
|
||||||
Serial.println();
|
Serial.println();
|
||||||
Serial.print( F("Heap: ") ); Serial.println(system_get_free_heap_size());
|
Serial.print( F("Heap: ") ); Serial.println(system_get_free_heap_size());
|
||||||
@ -476,7 +504,7 @@ void loop() {
|
|||||||
webSocketsServer.loop();
|
webSocketsServer.loop();
|
||||||
webServer.handleClient();
|
webServer.handleClient();
|
||||||
|
|
||||||
handleIrInput();
|
// handleIrInput();
|
||||||
|
|
||||||
if (power == 0) {
|
if (power == 0) {
|
||||||
fill_solid(leds, NUM_LEDS, CRGB::Black);
|
fill_solid(leds, NUM_LEDS, CRGB::Black);
|
||||||
@ -552,212 +580,212 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t length
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void handleIrInput()
|
//void handleIrInput()
|
||||||
{
|
//{
|
||||||
InputCommand command = readCommand();
|
// InputCommand command = readCommand();
|
||||||
|
//
|
||||||
if (command != InputCommand::None) {
|
// if (command != InputCommand::None) {
|
||||||
Serial.print("command: ");
|
// Serial.print("command: ");
|
||||||
Serial.println((int) command);
|
// Serial.println((int) command);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
switch (command) {
|
// switch (command) {
|
||||||
case InputCommand::Up: {
|
// case InputCommand::Up: {
|
||||||
adjustPattern(true);
|
// adjustPattern(true);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case InputCommand::Down: {
|
// case InputCommand::Down: {
|
||||||
adjustPattern(false);
|
// adjustPattern(false);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case InputCommand::Power: {
|
// case InputCommand::Power: {
|
||||||
setPower(power == 0 ? 1 : 0);
|
// setPower(power == 0 ? 1 : 0);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case InputCommand::BrightnessUp: {
|
// case InputCommand::BrightnessUp: {
|
||||||
adjustBrightness(true);
|
// adjustBrightness(true);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case InputCommand::BrightnessDown: {
|
// case InputCommand::BrightnessDown: {
|
||||||
adjustBrightness(false);
|
// adjustBrightness(false);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case InputCommand::PlayMode: { // toggle pause/play
|
// case InputCommand::PlayMode: { // toggle pause/play
|
||||||
setAutoplay(!autoplay);
|
// setAutoplay(!autoplay);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
// pattern buttons
|
// // pattern buttons
|
||||||
|
//
|
||||||
case InputCommand::Pattern1: {
|
// case InputCommand::Pattern1: {
|
||||||
setPattern(0);
|
// setPattern(0);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case InputCommand::Pattern2: {
|
// case InputCommand::Pattern2: {
|
||||||
setPattern(1);
|
// setPattern(1);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case InputCommand::Pattern3: {
|
// case InputCommand::Pattern3: {
|
||||||
setPattern(2);
|
// setPattern(2);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case InputCommand::Pattern4: {
|
// case InputCommand::Pattern4: {
|
||||||
setPattern(3);
|
// setPattern(3);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case InputCommand::Pattern5: {
|
// case InputCommand::Pattern5: {
|
||||||
setPattern(4);
|
// setPattern(4);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case InputCommand::Pattern6: {
|
// case InputCommand::Pattern6: {
|
||||||
setPattern(5);
|
// setPattern(5);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case InputCommand::Pattern7: {
|
// case InputCommand::Pattern7: {
|
||||||
setPattern(6);
|
// setPattern(6);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case InputCommand::Pattern8: {
|
// case InputCommand::Pattern8: {
|
||||||
setPattern(7);
|
// setPattern(7);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case InputCommand::Pattern9: {
|
// case InputCommand::Pattern9: {
|
||||||
setPattern(8);
|
// setPattern(8);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case InputCommand::Pattern10: {
|
// case InputCommand::Pattern10: {
|
||||||
setPattern(9);
|
// setPattern(9);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case InputCommand::Pattern11: {
|
// case InputCommand::Pattern11: {
|
||||||
setPattern(10);
|
// setPattern(10);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case InputCommand::Pattern12: {
|
// case InputCommand::Pattern12: {
|
||||||
setPattern(11);
|
// setPattern(11);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
// custom color adjustment buttons
|
// // custom color adjustment buttons
|
||||||
|
//
|
||||||
case InputCommand::RedUp: {
|
// case InputCommand::RedUp: {
|
||||||
solidColor.red += 8;
|
// solidColor.red += 8;
|
||||||
setSolidColor(solidColor);
|
// setSolidColor(solidColor);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case InputCommand::RedDown: {
|
// case InputCommand::RedDown: {
|
||||||
solidColor.red -= 8;
|
// solidColor.red -= 8;
|
||||||
setSolidColor(solidColor);
|
// setSolidColor(solidColor);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case InputCommand::GreenUp: {
|
// case InputCommand::GreenUp: {
|
||||||
solidColor.green += 8;
|
// solidColor.green += 8;
|
||||||
setSolidColor(solidColor);
|
// setSolidColor(solidColor);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case InputCommand::GreenDown: {
|
// case InputCommand::GreenDown: {
|
||||||
solidColor.green -= 8;
|
// solidColor.green -= 8;
|
||||||
setSolidColor(solidColor);
|
// setSolidColor(solidColor);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case InputCommand::BlueUp: {
|
// case InputCommand::BlueUp: {
|
||||||
solidColor.blue += 8;
|
// solidColor.blue += 8;
|
||||||
setSolidColor(solidColor);
|
// setSolidColor(solidColor);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case InputCommand::BlueDown: {
|
// case InputCommand::BlueDown: {
|
||||||
solidColor.blue -= 8;
|
// solidColor.blue -= 8;
|
||||||
setSolidColor(solidColor);
|
// setSolidColor(solidColor);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
// color buttons
|
// // color buttons
|
||||||
|
//
|
||||||
case InputCommand::Red: {
|
// case InputCommand::Red: {
|
||||||
setSolidColor(CRGB::Red);
|
// setSolidColor(CRGB::Red);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case InputCommand::RedOrange: {
|
// case InputCommand::RedOrange: {
|
||||||
setSolidColor(CRGB::OrangeRed);
|
// setSolidColor(CRGB::OrangeRed);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case InputCommand::Orange: {
|
// case InputCommand::Orange: {
|
||||||
setSolidColor(CRGB::Orange);
|
// setSolidColor(CRGB::Orange);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case InputCommand::YellowOrange: {
|
// case InputCommand::YellowOrange: {
|
||||||
setSolidColor(CRGB::Goldenrod);
|
// setSolidColor(CRGB::Goldenrod);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case InputCommand::Yellow: {
|
// case InputCommand::Yellow: {
|
||||||
setSolidColor(CRGB::Yellow);
|
// setSolidColor(CRGB::Yellow);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
case InputCommand::Green: {
|
// case InputCommand::Green: {
|
||||||
setSolidColor(CRGB::Green);
|
// setSolidColor(CRGB::Green);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case InputCommand::Lime: {
|
// case InputCommand::Lime: {
|
||||||
setSolidColor(CRGB::Lime);
|
// setSolidColor(CRGB::Lime);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case InputCommand::Aqua: {
|
// case InputCommand::Aqua: {
|
||||||
setSolidColor(CRGB::Aqua);
|
// setSolidColor(CRGB::Aqua);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case InputCommand::Teal: {
|
// case InputCommand::Teal: {
|
||||||
setSolidColor(CRGB::Teal);
|
// setSolidColor(CRGB::Teal);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case InputCommand::Navy: {
|
// case InputCommand::Navy: {
|
||||||
setSolidColor(CRGB::Navy);
|
// setSolidColor(CRGB::Navy);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
case InputCommand::Blue: {
|
// case InputCommand::Blue: {
|
||||||
setSolidColor(CRGB::Blue);
|
// setSolidColor(CRGB::Blue);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case InputCommand::RoyalBlue: {
|
// case InputCommand::RoyalBlue: {
|
||||||
setSolidColor(CRGB::RoyalBlue);
|
// setSolidColor(CRGB::RoyalBlue);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case InputCommand::Purple: {
|
// case InputCommand::Purple: {
|
||||||
setSolidColor(CRGB::Purple);
|
// setSolidColor(CRGB::Purple);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case InputCommand::Indigo: {
|
// case InputCommand::Indigo: {
|
||||||
setSolidColor(CRGB::Indigo);
|
// setSolidColor(CRGB::Indigo);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case InputCommand::Magenta: {
|
// case InputCommand::Magenta: {
|
||||||
setSolidColor(CRGB::Magenta);
|
// setSolidColor(CRGB::Magenta);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
case InputCommand::White: {
|
// case InputCommand::White: {
|
||||||
setSolidColor(CRGB::White);
|
// setSolidColor(CRGB::White);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case InputCommand::Pink: {
|
// case InputCommand::Pink: {
|
||||||
setSolidColor(CRGB::Pink);
|
// setSolidColor(CRGB::Pink);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case InputCommand::LightPink: {
|
// case InputCommand::LightPink: {
|
||||||
setSolidColor(CRGB::LightPink);
|
// setSolidColor(CRGB::LightPink);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case InputCommand::BabyBlue: {
|
// case InputCommand::BabyBlue: {
|
||||||
setSolidColor(CRGB::CornflowerBlue);
|
// setSolidColor(CRGB::CornflowerBlue);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
case InputCommand::LightBlue: {
|
// case InputCommand::LightBlue: {
|
||||||
setSolidColor(CRGB::LightBlue);
|
// setSolidColor(CRGB::LightBlue);
|
||||||
break;
|
// break;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
void loadSettings()
|
void loadSettings()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user