Added mapping for half-cube
This commit is contained in:
parent
c0c7879c0b
commit
41146d118e
193
Map.h
Normal file
193
Map.h
Normal file
@ -0,0 +1,193 @@
|
||||
uint8_t cubeWidth = 8;
|
||||
uint8_t cubeDepth = 8;
|
||||
uint8_t cubeHeight = 8;
|
||||
|
||||
uint8_t coordsX[NUM_LEDS] = { 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 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, 0, 0, 0, 0, 0, 0, 0, 0, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7 };
|
||||
uint8_t coordsY[NUM_LEDS] = { 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, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
uint8_t coordsZ[NUM_LEDS] = { 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 7, 7, 6, 5, 4, 3, 2, 1, 0, 0, 1, 2, 3, 4, 5, 6, 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 cubeTest() {
|
||||
static uint8_t x = 0;
|
||||
static uint8_t y = 0;
|
||||
static uint8_t z = 0;
|
||||
|
||||
EVERY_N_MILLIS(255 - speed) {
|
||||
x++;
|
||||
if(x >= cubeWidth) {
|
||||
x = 0;
|
||||
y++;
|
||||
if(y >= cubeDepth) {
|
||||
y = 0;
|
||||
z++;
|
||||
if(z >= cubeHeight) {
|
||||
z = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FastLED.clear();
|
||||
|
||||
CHSV color = CHSV(gHue, 255, 255);
|
||||
|
||||
for(uint8_t i = 0; i < NUM_LEDS; i++) {
|
||||
uint8_t cx = coordsX[i];
|
||||
uint8_t cy = coordsY[i];
|
||||
uint8_t cz = coordsZ[i];
|
||||
|
||||
if((cx == x && cy == y) || (cx == x && cz == z) || (cy == y && cz == z)) {
|
||||
leds[i] = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void cubeXPalette() {
|
||||
uint8_t hues = 8;
|
||||
|
||||
for (uint8_t i = 0; i < NUM_LEDS; i++) {
|
||||
uint8_t x = coordsX[i];
|
||||
|
||||
leds[i] = ColorFromPalette(palettes[currentPaletteIndex], beat8(speed) - (x * hues));
|
||||
}
|
||||
}
|
||||
|
||||
void cubeYPalette() {
|
||||
uint8_t hues = 8;
|
||||
|
||||
for (uint8_t i = 0; i < NUM_LEDS; i++) {
|
||||
uint8_t y = coordsY[i];
|
||||
|
||||
leds[i] = ColorFromPalette(palettes[currentPaletteIndex], beat8(speed) - (y * hues));
|
||||
}
|
||||
}
|
||||
|
||||
void cubeZPalette() {
|
||||
uint8_t hues = 8;
|
||||
|
||||
for (uint8_t i = 0; i < NUM_LEDS; i++) {
|
||||
uint8_t z = coordsZ[i];
|
||||
|
||||
leds[i] = ColorFromPalette(palettes[currentPaletteIndex], beat8(speed) - (z * hues));
|
||||
}
|
||||
}
|
||||
|
||||
void cubeXYPalette() {
|
||||
uint8_t hues = 8;
|
||||
|
||||
for (uint8_t i = 0; i < NUM_LEDS; i++) {
|
||||
uint8_t x = coordsX[i];
|
||||
uint8_t y = coordsY[i];
|
||||
|
||||
leds[i] = ColorFromPalette(palettes[currentPaletteIndex], beat8(speed) - ((x + y) * hues));
|
||||
}
|
||||
}
|
||||
|
||||
void cubeXZPalette() {
|
||||
uint8_t hues = 8;
|
||||
|
||||
for (uint8_t i = 0; i < NUM_LEDS; i++) {
|
||||
uint8_t x = coordsX[i];
|
||||
uint8_t z = coordsZ[i];
|
||||
|
||||
leds[i] = ColorFromPalette(palettes[currentPaletteIndex], beat8(speed) - ((x + z) * hues));
|
||||
}
|
||||
}
|
||||
|
||||
void cubeYZPalette() {
|
||||
uint8_t hues = 8;
|
||||
|
||||
for (uint8_t i = 0; i < NUM_LEDS; i++) {
|
||||
uint8_t y = coordsY[i];
|
||||
uint8_t z = coordsZ[i];
|
||||
|
||||
leds[i] = ColorFromPalette(palettes[currentPaletteIndex], beat8(speed) - ((y + z) * hues));
|
||||
}
|
||||
}
|
||||
|
||||
void cubeXYZPalette() {
|
||||
uint8_t hues = 8;
|
||||
|
||||
for (uint8_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(palettes[currentPaletteIndex], beat8(speed) - ((x + y + z) * hues));
|
||||
}
|
||||
}
|
||||
|
||||
void cubeXGradientPalette() {
|
||||
uint8_t hues = 8;
|
||||
|
||||
for (uint8_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 (uint8_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 (uint8_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 (uint8_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 (uint8_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 (uint8_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 (uint8_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));
|
||||
}
|
||||
}
|
||||
|
131
Noise.h
131
Noise.h
@ -113,6 +113,36 @@ void drawNoise(CRGBPalette16 palette, uint8_t hueReduce = 0)
|
||||
noisez += noisespeedz;
|
||||
}
|
||||
|
||||
void drawNoise3d(CRGBPalette16 palette, uint8_t hueReduce = 0)
|
||||
{
|
||||
for(uint8_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 rainbowNoise() {
|
||||
noisespeedx = 0;
|
||||
noisespeedy = -1;
|
||||
@ -122,6 +152,15 @@ void rainbowNoise() {
|
||||
drawNoise(RainbowColors_p);
|
||||
}
|
||||
|
||||
void rainbowNoise3d() {
|
||||
noisespeedx = 0;
|
||||
noisespeedy = 0;
|
||||
noisespeedz = -1;
|
||||
noisescale = 24;
|
||||
colorLoop = 0;
|
||||
drawNoise3d(RainbowColors_p);
|
||||
}
|
||||
|
||||
void rainbowStripeNoise() {
|
||||
noisespeedx = 0;
|
||||
noisespeedy = -2;
|
||||
@ -131,6 +170,15 @@ void rainbowStripeNoise() {
|
||||
drawNoise(RainbowStripeColors_p);
|
||||
}
|
||||
|
||||
void rainbowStripeNoise3d() {
|
||||
noisespeedx = 0;
|
||||
noisespeedy = 0;
|
||||
noisespeedz = -2;
|
||||
noisescale = 24;
|
||||
colorLoop = 0;
|
||||
drawNoise3d(RainbowStripeColors_p);
|
||||
}
|
||||
|
||||
void partyNoise() {
|
||||
noisespeedx = -9;
|
||||
noisespeedy = 0;
|
||||
@ -140,6 +188,15 @@ void partyNoise() {
|
||||
drawNoise(PartyColors_p);
|
||||
}
|
||||
|
||||
void partyNoise3d() {
|
||||
noisespeedx = -9;
|
||||
noisespeedy = 0;
|
||||
noisespeedz = 0;
|
||||
noisescale = 32;
|
||||
colorLoop = 0;
|
||||
drawNoise3d(PartyColors_p);
|
||||
}
|
||||
|
||||
void forestNoise() {
|
||||
noisespeedx = -9;
|
||||
noisespeedy = 0;
|
||||
@ -149,6 +206,15 @@ void forestNoise() {
|
||||
drawNoise(ForestColors_p);
|
||||
}
|
||||
|
||||
void forestNoise3d() {
|
||||
noisespeedx = -9;
|
||||
noisespeedy = 0;
|
||||
noisespeedz = 0;
|
||||
noisescale = 32;
|
||||
colorLoop = 0;
|
||||
drawNoise3d(ForestColors_p);
|
||||
}
|
||||
|
||||
void cloudNoise() {
|
||||
noisespeedx = -2;
|
||||
noisespeedy = 0;
|
||||
@ -158,6 +224,15 @@ void cloudNoise() {
|
||||
drawNoise(CloudColors_p);
|
||||
}
|
||||
|
||||
void cloudNoise3d() {
|
||||
noisespeedx = -2;
|
||||
noisespeedy = 0;
|
||||
noisespeedz = 0;
|
||||
noisescale = 24;
|
||||
colorLoop = 0;
|
||||
drawNoise3d(CloudColors_p);
|
||||
}
|
||||
|
||||
void fireNoise() {
|
||||
noisespeedx = 0; // 24;
|
||||
noisespeedy = -32;
|
||||
@ -167,6 +242,15 @@ void fireNoise() {
|
||||
drawNoise(HeatColors_p, 60);
|
||||
}
|
||||
|
||||
void fireNoise3d() {
|
||||
noisespeedx = 0;
|
||||
noisespeedy = 0;
|
||||
noisespeedz = 32;
|
||||
noisescale = 64;
|
||||
colorLoop = 0;
|
||||
drawNoise3d(HeatColors_p, 60);
|
||||
}
|
||||
|
||||
void fireNoise2() {
|
||||
noisespeedx = 0;
|
||||
noisespeedy = -8;
|
||||
@ -176,6 +260,15 @@ void fireNoise2() {
|
||||
drawNoise(HeatColors_p);
|
||||
}
|
||||
|
||||
void fireNoise23d() {
|
||||
noisespeedx = 1;
|
||||
noisespeedy = 3;
|
||||
noisespeedz = 8;
|
||||
noisescale = 32;
|
||||
colorLoop = 0;
|
||||
drawNoise3d(HeatColors_p);
|
||||
}
|
||||
|
||||
void lavaNoise() {
|
||||
noisespeedx = 0;
|
||||
noisespeedy = -1;
|
||||
@ -185,6 +278,15 @@ void lavaNoise() {
|
||||
drawNoise(LavaColors_p);
|
||||
}
|
||||
|
||||
void lavaNoise3d() {
|
||||
noisespeedx = 1;
|
||||
noisespeedy = 3;
|
||||
noisespeedz = -8;
|
||||
noisescale = 32;
|
||||
colorLoop = 0;
|
||||
drawNoise3d(LavaColors_p);
|
||||
}
|
||||
|
||||
void oceanNoise() {
|
||||
noisespeedx = -2;
|
||||
noisespeedy = 0;
|
||||
@ -194,6 +296,15 @@ void oceanNoise() {
|
||||
drawNoise(OceanColors_p);
|
||||
}
|
||||
|
||||
void oceanNoise3d() {
|
||||
noisespeedx = -2;
|
||||
noisespeedy = 0;
|
||||
noisespeedz = 4;
|
||||
noisescale = 24;
|
||||
colorLoop = 0;
|
||||
drawNoise3d(OceanColors_p);
|
||||
}
|
||||
|
||||
void blackAndWhiteNoise() {
|
||||
SetupBlackAndWhiteStripedPalette();
|
||||
noisespeedx = -12;
|
||||
@ -204,6 +315,16 @@ void blackAndWhiteNoise() {
|
||||
drawNoise(blackAndWhiteStripedPalette);
|
||||
}
|
||||
|
||||
void blackAndWhiteNoise3d() {
|
||||
SetupBlackAndWhiteStripedPalette();
|
||||
noisespeedx = -12;
|
||||
noisespeedy = 0;
|
||||
noisespeedz = 0;
|
||||
noisescale = 24;
|
||||
colorLoop = 0;
|
||||
drawNoise3d(blackAndWhiteStripedPalette);
|
||||
}
|
||||
|
||||
void blackAndBlueNoise() {
|
||||
SetupBlackAndBlueStripedPalette();
|
||||
noisespeedx = 0;
|
||||
@ -213,3 +334,13 @@ void blackAndBlueNoise() {
|
||||
colorLoop = 0;
|
||||
drawNoise(blackAndBlueStripedPalette);
|
||||
}
|
||||
|
||||
void blackAndBlueNoise3d() {
|
||||
SetupBlackAndBlueStripedPalette();
|
||||
noisespeedx = -4;
|
||||
noisespeedy = -4;
|
||||
noisespeedz = -4;
|
||||
noisescale = 32;
|
||||
colorLoop = 0;
|
||||
drawNoise3d(blackAndBlueStripedPalette);
|
||||
}
|
||||
|
@ -1,19 +1,19 @@
|
||||
/*
|
||||
* 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/>.
|
||||
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/>.
|
||||
*/
|
||||
|
||||
#include <FastLED.h>
|
||||
@ -150,6 +150,36 @@ void dimAll(byte value)
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
CRGBPalette16 palette;
|
||||
String name;
|
||||
} PaletteAndName;
|
||||
typedef PaletteAndName PaletteAndNameList[];
|
||||
|
||||
const CRGBPalette16 palettes[] = {
|
||||
RainbowColors_p,
|
||||
RainbowStripeColors_p,
|
||||
CloudColors_p,
|
||||
LavaColors_p,
|
||||
OceanColors_p,
|
||||
ForestColors_p,
|
||||
PartyColors_p,
|
||||
HeatColors_p
|
||||
};
|
||||
|
||||
const uint8_t paletteCount = ARRAY_SIZE(palettes);
|
||||
|
||||
const String paletteNames[paletteCount] = {
|
||||
"Rainbow",
|
||||
"Rainbow Stripe",
|
||||
"Cloud",
|
||||
"Lava",
|
||||
"Ocean",
|
||||
"Forest",
|
||||
"Party",
|
||||
"Heat",
|
||||
};
|
||||
|
||||
typedef void (*Pattern)();
|
||||
typedef Pattern PatternList[];
|
||||
typedef struct {
|
||||
@ -160,6 +190,7 @@ typedef PatternAndName PatternAndNameList[];
|
||||
|
||||
#include "Twinkles.h"
|
||||
#include "TwinkleFOX.h"
|
||||
#include "Map.h"
|
||||
#include "Noise.h"
|
||||
|
||||
// List of patterns to cycle through. Each is defined as a separate function below.
|
||||
@ -170,6 +201,39 @@ PatternAndNameList patterns = {
|
||||
{ colorWaves, "Color Waves" },
|
||||
{ colorWaves2, "Color Waves 2" },
|
||||
|
||||
{ cubeTest, "Cube XYZ Test" },
|
||||
|
||||
{ cubeXPalette, "Cube X Palette" },
|
||||
{ cubeYPalette, "Cube Y Palette" },
|
||||
{ cubeZPalette, "Cube Z Palette" },
|
||||
|
||||
{ cubeXYPalette, "Cube XY Palette" },
|
||||
{ cubeXZPalette, "Cube XZ Palette" },
|
||||
{ cubeYZPalette, "Cube YZ Palette" },
|
||||
{ cubeXYZPalette, "Cube XYZ Palette" },
|
||||
|
||||
{ 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" },
|
||||
|
||||
{ xyMatrixTest, "Matrix Test" },
|
||||
|
||||
{ verticalPalette, "Vertical Palette" },
|
||||
@ -230,36 +294,6 @@ PatternAndNameList patterns = {
|
||||
|
||||
const uint8_t patternCount = ARRAY_SIZE(patterns);
|
||||
|
||||
typedef struct {
|
||||
CRGBPalette16 palette;
|
||||
String name;
|
||||
} PaletteAndName;
|
||||
typedef PaletteAndName PaletteAndNameList[];
|
||||
|
||||
const CRGBPalette16 palettes[] = {
|
||||
RainbowColors_p,
|
||||
RainbowStripeColors_p,
|
||||
CloudColors_p,
|
||||
LavaColors_p,
|
||||
OceanColors_p,
|
||||
ForestColors_p,
|
||||
PartyColors_p,
|
||||
HeatColors_p
|
||||
};
|
||||
|
||||
const uint8_t paletteCount = ARRAY_SIZE(palettes);
|
||||
|
||||
const String paletteNames[paletteCount] = {
|
||||
"Rainbow",
|
||||
"Rainbow Stripe",
|
||||
"Cloud",
|
||||
"Lava",
|
||||
"Ocean",
|
||||
"Forest",
|
||||
"Party",
|
||||
"Heat",
|
||||
};
|
||||
|
||||
#include "Fields.h"
|
||||
|
||||
void setup() {
|
||||
@ -269,7 +303,7 @@ void setup() {
|
||||
|
||||
//FastLED.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS); // for WS2812 (Neopixel)
|
||||
FastLED.addLeds<LED_TYPE, DATA_PIN, CLK_PIN, COLOR_ORDER>(leds, NUM_LEDS); // for APA102 (Dotstar)
|
||||
FastLED.setDither(false);
|
||||
FastLED.setDither(true);
|
||||
FastLED.setCorrection(TypicalLEDStrip);
|
||||
FastLED.setBrightness(brightness);
|
||||
FastLED.setMaxPowerInVoltsAndMilliamps(5, MILLI_AMPS);
|
||||
@ -399,7 +433,7 @@ void setup() {
|
||||
|
||||
webServer.on("/speed", HTTP_POST, []() {
|
||||
String value = webServer.arg("value");
|
||||
speed = value.toInt();
|
||||
setSpeed(value.toInt());
|
||||
broadcastInt("speed", speed);
|
||||
sendInt(speed);
|
||||
});
|
||||
@ -565,7 +599,7 @@ void loop() {
|
||||
FastLED.show();
|
||||
|
||||
// insert a delay to keep the framerate modest
|
||||
// FastLED.delay(1000 / FRAMES_PER_SECOND);
|
||||
FastLED.delay(1000 / FRAMES_PER_SECOND);
|
||||
}
|
||||
|
||||
void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t length) {
|
||||
@ -844,6 +878,8 @@ void loadSettings()
|
||||
currentPaletteIndex = 0;
|
||||
else if (currentPaletteIndex >= paletteCount)
|
||||
currentPaletteIndex = paletteCount - 1;
|
||||
|
||||
speed = EEPROM.read(9);
|
||||
}
|
||||
|
||||
void setPower(uint8_t value)
|
||||
@ -967,6 +1003,16 @@ void setPaletteName(String name)
|
||||
}
|
||||
}
|
||||
|
||||
void setSpeed(uint8_t value)
|
||||
{
|
||||
speed = value;
|
||||
|
||||
EEPROM.write(9, value);
|
||||
EEPROM.commit();
|
||||
|
||||
broadcastInt("speed", speed);
|
||||
}
|
||||
|
||||
void adjustBrightness(bool up)
|
||||
{
|
||||
if (up && brightnessIndex < brightnessCount - 1)
|
||||
|
Loading…
Reference in New Issue
Block a user