Compare commits
57 Commits
wifi-exper
...
2.0
Author | SHA1 | Date | |
---|---|---|---|
1aa0b191be | |||
200d3c06c9 | |||
539804fbc8 | |||
3132613ad5 | |||
18db8e2882 | |||
bdabc3f7cd | |||
938a2bd773 | |||
92c879b499 | |||
519e070130 | |||
489259711a | |||
b7c672a53f | |||
7a5feb09be | |||
053fbf1aed | |||
f2542fe996 | |||
88c6dc6e51 | |||
40c9ac4536 | |||
1e9861d6d0 | |||
f377ae2742 | |||
e205f8bece | |||
dc07ab11e4 | |||
b83e48016c | |||
1b9535651a | |||
5c9ab4f749 | |||
0db34d27ef | |||
b31c73e217 | |||
85d99b6a7f | |||
0c16edc65c | |||
1edb9517cb | |||
2d08fa5b96 | |||
94700bf4d3 | |||
cec7952757 | |||
3376514e01 | |||
e57869202e | |||
757e3b2fd8 | |||
e2d546bf8c | |||
cdb02c9bbf | |||
04103b80a3 | |||
669acec2c8 | |||
813970de78 | |||
83cc76340a | |||
f58c2b3dbd | |||
a974f0c481 | |||
d9ee4b6816 | |||
432fbb95d9 | |||
350feed191 | |||
410186e6a5 | |||
c17cea3426 | |||
407fd536c2 | |||
020b0b0e43 | |||
681c29a877 | |||
9bc7b7a5e7 | |||
e28346a6ee | |||
95e5f27caf | |||
608a7827d2 | |||
f49ca2d1f9 | |||
1e9b486cfd | |||
f5702fe80f |
3
.vs/ProjectSettings.json
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"CurrentProjectSetting": "Visual Micro"
|
||||||
|
}
|
9
.vs/VSWorkspaceState.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"ExpandedNodes": [
|
||||||
|
"",
|
||||||
|
"\\data",
|
||||||
|
"\\data\\images"
|
||||||
|
],
|
||||||
|
"SelectedNode": "\\esp8266-fastled-webserver.ino",
|
||||||
|
"PreviewInSolutionExplorer": false
|
||||||
|
}
|
113
.vs/__vm/.vsarduino.h
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
/*
|
||||||
|
Editor: https://www.visualmicro.com/
|
||||||
|
visual micro and the arduino ide ignore this code during compilation. this code is automatically maintained by visualmicro, manual changes to this file will be overwritten
|
||||||
|
the contents of the Visual Micro sketch sub folder can be deleted prior to publishing a project
|
||||||
|
all non-arduino files created by visual micro and all visual studio project or solution files can be freely deleted and are not required to compile a sketch (do not delete your own code!).
|
||||||
|
note: debugger breakpoints are stored in '.sln' or '.asln' files, knowledge of last uploaded breakpoints is stored in the upload.vmps.xml file. Both files are required to continue a previous debug session without needing to compile and upload again
|
||||||
|
|
||||||
|
Hardware: WeMos D1 R2 & mini, Platform=esp8266, Package=esp8266
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(_VMICRO_INTELLISENSE)
|
||||||
|
|
||||||
|
#ifndef _VSARDUINO_H_
|
||||||
|
#define _VSARDUINO_H_
|
||||||
|
#define __ESP8266_ESp8266__
|
||||||
|
#define __ESP8266_ESP8266__
|
||||||
|
#define __ets__
|
||||||
|
#define ICACHE_FLASH
|
||||||
|
#define F_CPU 80000000L
|
||||||
|
#define LWIP_OPEN_SRC
|
||||||
|
#define TCP_MSS 536
|
||||||
|
#define ARDUINO 10807
|
||||||
|
#define ARDUINO_ESP8266_WEMOS_D1MINI
|
||||||
|
#define ARDUINO_ARCH_ESP8266
|
||||||
|
#define ESP8266
|
||||||
|
#define __cplusplus 201103L
|
||||||
|
#undef __cplusplus
|
||||||
|
#define __cplusplus 201103L
|
||||||
|
#define __STDC__
|
||||||
|
#define __ARM__
|
||||||
|
#define __arm__
|
||||||
|
#define __inline__
|
||||||
|
#define __asm__(x)
|
||||||
|
#define __asm__
|
||||||
|
#define __extension__
|
||||||
|
#define __ATTR_PURE__
|
||||||
|
#define __ATTR_CONST__
|
||||||
|
#define __volatile__
|
||||||
|
|
||||||
|
|
||||||
|
#define __ASM
|
||||||
|
#define __INLINE
|
||||||
|
#define __attribute__(noinline)
|
||||||
|
|
||||||
|
//#define _STD_BEGIN
|
||||||
|
//#define EMIT
|
||||||
|
#define WARNING
|
||||||
|
#define _Lockit
|
||||||
|
#define __CLR_OR_THIS_CALL
|
||||||
|
#define C4005
|
||||||
|
#define _NEW
|
||||||
|
|
||||||
|
//typedef int uint8_t;
|
||||||
|
//#define __ARMCC_VERSION 400678
|
||||||
|
//#define PROGMEM
|
||||||
|
//#define string_literal
|
||||||
|
//
|
||||||
|
//#define prog_void
|
||||||
|
//#define PGM_VOID_P int
|
||||||
|
//
|
||||||
|
|
||||||
|
typedef int _read;
|
||||||
|
typedef int _seek;
|
||||||
|
typedef int _write;
|
||||||
|
typedef int _close;
|
||||||
|
typedef int __cleanup;
|
||||||
|
|
||||||
|
//#define inline
|
||||||
|
|
||||||
|
#define __builtin_clz
|
||||||
|
#define __builtin_clzl
|
||||||
|
#define __builtin_clzll
|
||||||
|
#define __builtin_labs
|
||||||
|
#define __builtin_va_list
|
||||||
|
typedef int __gnuc_va_list;
|
||||||
|
|
||||||
|
#define __ATOMIC_ACQ_REL
|
||||||
|
|
||||||
|
#define __CHAR_BIT__
|
||||||
|
#define _EXFUN()
|
||||||
|
|
||||||
|
typedef unsigned char byte;
|
||||||
|
extern "C" void __cxa_pure_virtual() {;}
|
||||||
|
|
||||||
|
|
||||||
|
typedef long __INTPTR_TYPE__ ;
|
||||||
|
typedef long __UINTPTR_TYPE__ ;
|
||||||
|
typedef long __SIZE_TYPE__ ;
|
||||||
|
typedef long __PTRDIFF_TYPE__;
|
||||||
|
|
||||||
|
|
||||||
|
#include "new"
|
||||||
|
#include "Esp.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include <arduino.h>
|
||||||
|
#include <pins_arduino.h>
|
||||||
|
|
||||||
|
#include "..\generic\Common.h"
|
||||||
|
#include "..\generic\pins_arduino.h"
|
||||||
|
|
||||||
|
#undef F
|
||||||
|
#define F(string_literal) ((const PROGMEM char *)(string_literal))
|
||||||
|
#undef PSTR
|
||||||
|
#define PSTR(string_literal) ((const PROGMEM char *)(string_literal))
|
||||||
|
//current vc++ does not understand this syntax so use older arduino example for intellisense
|
||||||
|
//todo:move to the new clang/gcc project types.
|
||||||
|
#define interrupts() sei()
|
||||||
|
#define noInterrupts() cli()
|
||||||
|
|
||||||
|
#include "esp8266-fastled-webserver.ino"
|
||||||
|
#endif
|
||||||
|
#endif
|
1025
.vs/config/applicationhost.config
Normal file
BIN
.vs/esp8266-fastled-webserver/v15/.suo
Normal file
BIN
.vs/slnx.sqlite
Normal file
47
CppProperties.json
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
{
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Visual Micro",
|
||||||
|
"intelliSenseMode": "msvc-x64",
|
||||||
|
"includePath": [
|
||||||
|
"${projectRoot}..\\esp8266-fastled-webserver",
|
||||||
|
"D:\\Music\\Documents\\Arduino\\libraries\\FastLED",
|
||||||
|
"${projectRoot}..\\..\\..\\..\\AppData\\Local\\arduino15\\packages\\esp8266\\hardware\\esp8266\\2.4.1\\libraries\\ESP8266WiFi\\src",
|
||||||
|
"${projectRoot}..\\..\\..\\..\\AppData\\Local\\arduino15\\packages\\esp8266\\hardware\\esp8266\\2.4.1\\libraries\\ESP8266WebServer\\src",
|
||||||
|
"${projectRoot}..\\..\\..\\..\\AppData\\Local\\arduino15\\packages\\esp8266\\hardware\\esp8266\\2.4.1\\libraries\\ESP8266HTTPUpdateServer\\src",
|
||||||
|
"${projectRoot}..\\..\\..\\..\\AppData\\Local\\arduino15\\packages\\esp8266\\hardware\\esp8266\\2.4.1\\libraries\\EEPROM",
|
||||||
|
"S:\\Software\\Arduino\\libraries",
|
||||||
|
"${projectRoot}..\\..\\..\\..\\AppData\\Local\\arduino15\\packages\\esp8266\\hardware\\esp8266\\2.4.1\\libraries",
|
||||||
|
"D:\\Music\\Documents\\Arduino\\libraries",
|
||||||
|
"${projectRoot}..\\..\\..\\..\\AppData\\Local\\arduino15\\packages\\esp8266\\hardware\\esp8266\\2.4.1\\cores\\esp8266",
|
||||||
|
"${projectRoot}..\\..\\..\\..\\AppData\\Local\\arduino15\\packages\\esp8266\\hardware\\esp8266\\2.4.1\\cores\\esp8266\\libb64",
|
||||||
|
"${projectRoot}..\\..\\..\\..\\AppData\\Local\\arduino15\\packages\\esp8266\\hardware\\esp8266\\2.4.1\\cores\\esp8266\\spiffs",
|
||||||
|
"${projectRoot}..\\..\\..\\..\\AppData\\Local\\arduino15\\packages\\esp8266\\hardware\\esp8266\\2.4.1\\cores\\esp8266\\umm_malloc",
|
||||||
|
"${projectRoot}..\\..\\..\\..\\AppData\\Local\\arduino15\\packages\\esp8266\\hardware\\esp8266\\2.4.1\\variants\\d1_mini",
|
||||||
|
"${projectRoot}..\\..\\..\\..\\AppData\\Local\\arduino15\\packages\\esp8266\\hardware\\esp8266\\2.4.1\\tools\\sdk\\include",
|
||||||
|
"${projectRoot}..\\..\\..\\..\\AppData\\Local\\arduino15\\packages\\esp8266\\hardware\\esp8266\\2.4.1\\tools\\sdk\\lwip2\\include",
|
||||||
|
"${projectRoot}..\\..\\..\\..\\AppData\\Local\\arduino15\\packages\\esp8266\\hardware\\esp8266\\2.4.1\\tools\\sdk\\libc\\xtensa-lx106-elf\\include",
|
||||||
|
"${projectRoot}..\\..\\..\\..\\AppData\\Local\\arduino15\\packages\\esp8266\\tools\\xtensa-lx106-elf-gcc\\1.20.0-26-gb404fb9-2\\xtensa-lx106-elf\\include\\c++\\4.8.2",
|
||||||
|
"${projectRoot}..\\..\\..\\..\\AppData\\Local\\arduino15\\packages\\esp8266\\tools\\xtensa-lx106-elf-gcc\\1.20.0-26-gb404fb9-2\\xtensa-lx106-elf\\include\\c++\\4.8.2\\xtensa-lx106-elf",
|
||||||
|
"${projectRoot}..\\..\\..\\..\\AppData\\Local\\arduino15\\packages\\esp8266\\tools\\xtensa-lx106-elf-gcc\\1.20.0-26-gb404fb9-2\\xtensa-lx106-elf\\include",
|
||||||
|
"${projectRoot}..\\..\\..\\..\\AppData\\Local\\arduino15\\packages\\esp8266\\tools\\xtensa-lx106-elf-gcc\\1.20.0-26-gb404fb9-2\\lib\\gcc\\xtensa-lx106-elf\\4.8.2\\include",
|
||||||
|
"${projectRoot}..\\..\\..\\..\\AppData\\Local\\arduino15\\packages\\esp8266\\hardware\\esp8266\\2.4.1\\tools\\sdk\\include"
|
||||||
|
],
|
||||||
|
"defines": [
|
||||||
|
"__ESP8266_ESp8266__",
|
||||||
|
"__ESP8266_ESP8266__",
|
||||||
|
"__ets__",
|
||||||
|
"ICACHE_FLASH",
|
||||||
|
"F_CPU=80000000L",
|
||||||
|
"LWIP_OPEN_SRC",
|
||||||
|
"TCP_MSS=536",
|
||||||
|
"ARDUINO=10807",
|
||||||
|
"ARDUINO_ESP8266_WEMOS_D1MINI",
|
||||||
|
"ARDUINO_ARCH_ESP8266",
|
||||||
|
"ESP8266",
|
||||||
|
"__cplusplus=201103L",
|
||||||
|
"_VMICRO_INTELLISENSE"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
11
Fields.h
@ -81,6 +81,14 @@ String getAutoplayDuration() {
|
|||||||
return String(autoplayDuration);
|
return String(autoplayDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getAllLeafs() {
|
||||||
|
return String(allLeafs);
|
||||||
|
}
|
||||||
|
|
||||||
|
String getSelectedLeaf() {
|
||||||
|
return String(selectedLeaf);
|
||||||
|
}
|
||||||
|
|
||||||
String getSolidColor() {
|
String getSolidColor() {
|
||||||
return String(solidColor.r) + "," + String(solidColor.g) + "," + String(solidColor.b);
|
return String(solidColor.r) + "," + String(solidColor.g) + "," + String(solidColor.b);
|
||||||
}
|
}
|
||||||
@ -114,6 +122,9 @@ FieldList fields = {
|
|||||||
{ "autoplay", "Autoplay", SectionFieldType },
|
{ "autoplay", "Autoplay", SectionFieldType },
|
||||||
{ "autoplay", "Autoplay", BooleanFieldType, 0, 1, getAutoplay },
|
{ "autoplay", "Autoplay", BooleanFieldType, 0, 1, getAutoplay },
|
||||||
{ "autoplayDuration", "Autoplay Duration", NumberFieldType, 0, 255, getAutoplayDuration },
|
{ "autoplayDuration", "Autoplay Duration", NumberFieldType, 0, 255, getAutoplayDuration },
|
||||||
|
{ "allLeafs", "Color Leafs", SectionFieldType },
|
||||||
|
{ "allLeafs", "Color All Leafs", BooleanFieldType, 0, 1, getAllLeafs },
|
||||||
|
{ "selectedLeaf", "Select Leaf to Color", NumberFieldType, 1, LEAFCOUNT, getSelectedLeaf },
|
||||||
{ "solidColor", "Solid Color", SectionFieldType },
|
{ "solidColor", "Solid Color", SectionFieldType },
|
||||||
{ "solidColor", "Color", ColorFieldType, 0, 255, getSolidColor },
|
{ "solidColor", "Color", ColorFieldType, 0, 255, getSolidColor },
|
||||||
{ "fire", "Fire & Water", SectionFieldType },
|
{ "fire", "Fire & Water", SectionFieldType },
|
||||||
|
@ -14,7 +14,8 @@ DEFINE_GRADIENT_PALETTE( ib_jul01_gp ) {
|
|||||||
0, 194, 1, 1,
|
0, 194, 1, 1,
|
||||||
94, 1, 29, 18,
|
94, 1, 29, 18,
|
||||||
132, 57, 131, 28,
|
132, 57, 131, 28,
|
||||||
255, 113, 1, 1};
|
255, 113, 1, 1
|
||||||
|
};
|
||||||
|
|
||||||
// Gradient palette "es_vintage_57_gp", originally from
|
// Gradient palette "es_vintage_57_gp", originally from
|
||||||
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/vintage/tn/es_vintage_57.png.index.html
|
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/vintage/tn/es_vintage_57.png.index.html
|
||||||
@ -26,7 +27,8 @@ DEFINE_GRADIENT_PALETTE( es_vintage_57_gp ) {
|
|||||||
53, 18, 1, 0,
|
53, 18, 1, 0,
|
||||||
104, 69, 29, 1,
|
104, 69, 29, 1,
|
||||||
153, 167, 135, 10,
|
153, 167, 135, 10,
|
||||||
255, 46, 56, 4};
|
255, 46, 56, 4
|
||||||
|
};
|
||||||
|
|
||||||
// Gradient palette "es_vintage_01_gp", originally from
|
// Gradient palette "es_vintage_01_gp", originally from
|
||||||
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/vintage/tn/es_vintage_01.png.index.html
|
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/vintage/tn/es_vintage_01.png.index.html
|
||||||
@ -41,7 +43,8 @@ DEFINE_GRADIENT_PALETTE( es_vintage_01_gp ) {
|
|||||||
127, 67, 9, 4,
|
127, 67, 9, 4,
|
||||||
153, 16, 0, 1,
|
153, 16, 0, 1,
|
||||||
229, 4, 1, 1,
|
229, 4, 1, 1,
|
||||||
255, 4, 1, 1};
|
255, 4, 1, 1
|
||||||
|
};
|
||||||
|
|
||||||
// Gradient palette "es_rivendell_15_gp", originally from
|
// Gradient palette "es_rivendell_15_gp", originally from
|
||||||
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/rivendell/tn/es_rivendell_15.png.index.html
|
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/rivendell/tn/es_rivendell_15.png.index.html
|
||||||
@ -53,7 +56,8 @@ DEFINE_GRADIENT_PALETTE( es_rivendell_15_gp ) {
|
|||||||
101, 16, 36, 14,
|
101, 16, 36, 14,
|
||||||
165, 56, 68, 30,
|
165, 56, 68, 30,
|
||||||
242, 150, 156, 99,
|
242, 150, 156, 99,
|
||||||
255, 150,156, 99};
|
255, 150, 156, 99
|
||||||
|
};
|
||||||
|
|
||||||
// Gradient palette "rgi_15_gp", originally from
|
// Gradient palette "rgi_15_gp", originally from
|
||||||
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/ds/rgi/tn/rgi_15.png.index.html
|
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/ds/rgi/tn/rgi_15.png.index.html
|
||||||
@ -69,7 +73,8 @@ DEFINE_GRADIENT_PALETTE( rgi_15_gp ) {
|
|||||||
159, 39, 6, 33,
|
159, 39, 6, 33,
|
||||||
191, 112, 13, 32,
|
191, 112, 13, 32,
|
||||||
223, 56, 9, 35,
|
223, 56, 9, 35,
|
||||||
255, 22, 6, 38};
|
255, 22, 6, 38
|
||||||
|
};
|
||||||
|
|
||||||
// Gradient palette "retro2_16_gp", originally from
|
// Gradient palette "retro2_16_gp", originally from
|
||||||
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/ma/retro2/tn/retro2_16.png.index.html
|
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/ma/retro2/tn/retro2_16.png.index.html
|
||||||
@ -78,7 +83,8 @@ DEFINE_GRADIENT_PALETTE( rgi_15_gp ) {
|
|||||||
|
|
||||||
DEFINE_GRADIENT_PALETTE(retro2_16_gp) {
|
DEFINE_GRADIENT_PALETTE(retro2_16_gp) {
|
||||||
0, 188, 135, 1,
|
0, 188, 135, 1,
|
||||||
255, 46, 7, 1};
|
255, 46, 7, 1
|
||||||
|
};
|
||||||
|
|
||||||
// Gradient palette "Analogous_1_gp", originally from
|
// Gradient palette "Analogous_1_gp", originally from
|
||||||
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/red/tn/Analogous_1.png.index.html
|
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/red/tn/Analogous_1.png.index.html
|
||||||
@ -90,7 +96,8 @@ DEFINE_GRADIENT_PALETTE( Analogous_1_gp ) {
|
|||||||
63, 23, 0, 255,
|
63, 23, 0, 255,
|
||||||
127, 67, 0, 255,
|
127, 67, 0, 255,
|
||||||
191, 142, 0, 45,
|
191, 142, 0, 45,
|
||||||
255, 255, 0, 0};
|
255, 255, 0, 0
|
||||||
|
};
|
||||||
|
|
||||||
// Gradient palette "es_pinksplash_08_gp", originally from
|
// Gradient palette "es_pinksplash_08_gp", originally from
|
||||||
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/pink_splash/tn/es_pinksplash_08.png.index.html
|
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/pink_splash/tn/es_pinksplash_08.png.index.html
|
||||||
@ -102,7 +109,8 @@ DEFINE_GRADIENT_PALETTE( es_pinksplash_08_gp ) {
|
|||||||
127, 197, 1, 22,
|
127, 197, 1, 22,
|
||||||
175, 210, 157, 172,
|
175, 210, 157, 172,
|
||||||
221, 157, 3, 112,
|
221, 157, 3, 112,
|
||||||
255, 157, 3,112};
|
255, 157, 3, 112
|
||||||
|
};
|
||||||
|
|
||||||
// Gradient palette "es_pinksplash_07_gp", originally from
|
// Gradient palette "es_pinksplash_07_gp", originally from
|
||||||
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/pink_splash/tn/es_pinksplash_07.png.index.html
|
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/pink_splash/tn/es_pinksplash_07.png.index.html
|
||||||
@ -116,7 +124,8 @@ DEFINE_GRADIENT_PALETTE( es_pinksplash_07_gp ) {
|
|||||||
127, 249, 81, 252,
|
127, 249, 81, 252,
|
||||||
153, 255, 11, 235,
|
153, 255, 11, 235,
|
||||||
193, 244, 5, 68,
|
193, 244, 5, 68,
|
||||||
255, 232, 1, 5};
|
255, 232, 1, 5
|
||||||
|
};
|
||||||
|
|
||||||
// Gradient palette "Coral_reef_gp", originally from
|
// Gradient palette "Coral_reef_gp", originally from
|
||||||
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/other/tn/Coral_reef.png.index.html
|
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/other/tn/Coral_reef.png.index.html
|
||||||
@ -129,7 +138,8 @@ DEFINE_GRADIENT_PALETTE( Coral_reef_gp ) {
|
|||||||
96, 1, 111, 120,
|
96, 1, 111, 120,
|
||||||
96, 43, 127, 162,
|
96, 43, 127, 162,
|
||||||
139, 10, 73, 111,
|
139, 10, 73, 111,
|
||||||
255, 1, 34, 71};
|
255, 1, 34, 71
|
||||||
|
};
|
||||||
|
|
||||||
// Gradient palette "es_ocean_breeze_068_gp", originally from
|
// Gradient palette "es_ocean_breeze_068_gp", originally from
|
||||||
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/ocean_breeze/tn/es_ocean_breeze_068.png.index.html
|
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/ocean_breeze/tn/es_ocean_breeze_068.png.index.html
|
||||||
@ -142,7 +152,8 @@ DEFINE_GRADIENT_PALETTE( es_ocean_breeze_068_gp ) {
|
|||||||
101, 1, 68, 84,
|
101, 1, 68, 84,
|
||||||
104, 35, 142, 168,
|
104, 35, 142, 168,
|
||||||
178, 0, 63, 117,
|
178, 0, 63, 117,
|
||||||
255, 1, 10, 10};
|
255, 1, 10, 10
|
||||||
|
};
|
||||||
|
|
||||||
// Gradient palette "es_ocean_breeze_036_gp", originally from
|
// Gradient palette "es_ocean_breeze_036_gp", originally from
|
||||||
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/ocean_breeze/tn/es_ocean_breeze_036.png.index.html
|
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/ocean_breeze/tn/es_ocean_breeze_036.png.index.html
|
||||||
@ -153,7 +164,8 @@ DEFINE_GRADIENT_PALETTE( es_ocean_breeze_036_gp ) {
|
|||||||
0, 1, 6, 7,
|
0, 1, 6, 7,
|
||||||
89, 1, 99, 111,
|
89, 1, 99, 111,
|
||||||
153, 144, 209, 255,
|
153, 144, 209, 255,
|
||||||
255, 0, 73, 82};
|
255, 0, 73, 82
|
||||||
|
};
|
||||||
|
|
||||||
// Gradient palette "departure_gp", originally from
|
// Gradient palette "departure_gp", originally from
|
||||||
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/mjf/tn/departure.png.index.html
|
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/mjf/tn/departure.png.index.html
|
||||||
@ -172,7 +184,8 @@ DEFINE_GRADIENT_PALETTE( departure_gp ) {
|
|||||||
170, 0, 255, 0,
|
170, 0, 255, 0,
|
||||||
191, 0, 136, 0,
|
191, 0, 136, 0,
|
||||||
212, 0, 55, 0,
|
212, 0, 55, 0,
|
||||||
255, 0, 55, 0};
|
255, 0, 55, 0
|
||||||
|
};
|
||||||
|
|
||||||
// Gradient palette "es_landscape_64_gp", originally from
|
// Gradient palette "es_landscape_64_gp", originally from
|
||||||
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/landscape/tn/es_landscape_64.png.index.html
|
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/landscape/tn/es_landscape_64.png.index.html
|
||||||
@ -188,7 +201,8 @@ DEFINE_GRADIENT_PALETTE( es_landscape_64_gp ) {
|
|||||||
130, 188, 209, 247,
|
130, 188, 209, 247,
|
||||||
153, 144, 182, 205,
|
153, 144, 182, 205,
|
||||||
204, 59, 117, 250,
|
204, 59, 117, 250,
|
||||||
255, 1, 37,192};
|
255, 1, 37, 192
|
||||||
|
};
|
||||||
|
|
||||||
// Gradient palette "es_landscape_33_gp", originally from
|
// Gradient palette "es_landscape_33_gp", originally from
|
||||||
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/landscape/tn/es_landscape_33.png.index.html
|
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/landscape/tn/es_landscape_33.png.index.html
|
||||||
@ -201,7 +215,8 @@ DEFINE_GRADIENT_PALETTE( es_landscape_33_gp ) {
|
|||||||
38, 161, 55, 1,
|
38, 161, 55, 1,
|
||||||
63, 229, 144, 1,
|
63, 229, 144, 1,
|
||||||
66, 39, 142, 74,
|
66, 39, 142, 74,
|
||||||
255, 1, 4, 1};
|
255, 1, 4, 1
|
||||||
|
};
|
||||||
|
|
||||||
// Gradient palette "rainbowsherbet_gp", originally from
|
// Gradient palette "rainbowsherbet_gp", originally from
|
||||||
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/ma/icecream/tn/rainbowsherbet.png.index.html
|
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/ma/icecream/tn/rainbowsherbet.png.index.html
|
||||||
@ -215,7 +230,8 @@ DEFINE_GRADIENT_PALETTE( rainbowsherbet_gp ) {
|
|||||||
127, 255, 82, 103,
|
127, 255, 82, 103,
|
||||||
170, 255, 255, 242,
|
170, 255, 255, 242,
|
||||||
209, 42, 255, 22,
|
209, 42, 255, 22,
|
||||||
255, 87,255, 65};
|
255, 87, 255, 65
|
||||||
|
};
|
||||||
|
|
||||||
// Gradient palette "gr65_hult_gp", originally from
|
// Gradient palette "gr65_hult_gp", originally from
|
||||||
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/hult/tn/gr65_hult.png.index.html
|
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/hult/tn/gr65_hult.png.index.html
|
||||||
@ -228,7 +244,8 @@ DEFINE_GRADIENT_PALETTE( gr65_hult_gp ) {
|
|||||||
89, 220, 29, 226,
|
89, 220, 29, 226,
|
||||||
160, 7, 82, 178,
|
160, 7, 82, 178,
|
||||||
216, 1, 124, 109,
|
216, 1, 124, 109,
|
||||||
255, 1,124,109};
|
255, 1, 124, 109
|
||||||
|
};
|
||||||
|
|
||||||
// Gradient palette "gr64_hult_gp", originally from
|
// Gradient palette "gr64_hult_gp", originally from
|
||||||
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/hult/tn/gr64_hult.png.index.html
|
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/hult/tn/gr64_hult.png.index.html
|
||||||
@ -243,7 +260,8 @@ DEFINE_GRADIENT_PALETTE( gr64_hult_gp ) {
|
|||||||
150, 52, 65, 1,
|
150, 52, 65, 1,
|
||||||
201, 1, 86, 72,
|
201, 1, 86, 72,
|
||||||
239, 0, 55, 45,
|
239, 0, 55, 45,
|
||||||
255, 0, 55, 45};
|
255, 0, 55, 45
|
||||||
|
};
|
||||||
|
|
||||||
// Gradient palette "GMT_drywet_gp", originally from
|
// Gradient palette "GMT_drywet_gp", originally from
|
||||||
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/gmt/tn/GMT_drywet.png.index.html
|
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/gmt/tn/GMT_drywet.png.index.html
|
||||||
@ -257,7 +275,8 @@ DEFINE_GRADIENT_PALETTE( GMT_drywet_gp ) {
|
|||||||
127, 3, 219, 207,
|
127, 3, 219, 207,
|
||||||
170, 1, 48, 214,
|
170, 1, 48, 214,
|
||||||
212, 1, 1, 111,
|
212, 1, 1, 111,
|
||||||
255, 1, 7, 33};
|
255, 1, 7, 33
|
||||||
|
};
|
||||||
|
|
||||||
// Gradient palette "ib15_gp", originally from
|
// Gradient palette "ib15_gp", originally from
|
||||||
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/ing/general/tn/ib15.png.index.html
|
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/ing/general/tn/ib15.png.index.html
|
||||||
@ -270,7 +289,8 @@ DEFINE_GRADIENT_PALETTE( ib15_gp ) {
|
|||||||
89, 208, 85, 33,
|
89, 208, 85, 33,
|
||||||
107, 255, 29, 11,
|
107, 255, 29, 11,
|
||||||
141, 137, 31, 39,
|
141, 137, 31, 39,
|
||||||
255, 59, 33, 89};
|
255, 59, 33, 89
|
||||||
|
};
|
||||||
|
|
||||||
// Gradient palette "Fuschia_7_gp", originally from
|
// Gradient palette "Fuschia_7_gp", originally from
|
||||||
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/ds/fuschia/tn/Fuschia-7.png.index.html
|
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/ds/fuschia/tn/Fuschia-7.png.index.html
|
||||||
@ -282,7 +302,8 @@ DEFINE_GRADIENT_PALETTE( Fuschia_7_gp ) {
|
|||||||
63, 100, 4, 103,
|
63, 100, 4, 103,
|
||||||
127, 188, 5, 66,
|
127, 188, 5, 66,
|
||||||
191, 161, 11, 115,
|
191, 161, 11, 115,
|
||||||
255, 135, 20,182};
|
255, 135, 20, 182
|
||||||
|
};
|
||||||
|
|
||||||
// Gradient palette "es_emerald_dragon_08_gp", originally from
|
// Gradient palette "es_emerald_dragon_08_gp", originally from
|
||||||
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/emerald_dragon/tn/es_emerald_dragon_08.png.index.html
|
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/emerald_dragon/tn/es_emerald_dragon_08.png.index.html
|
||||||
@ -293,7 +314,8 @@ DEFINE_GRADIENT_PALETTE( es_emerald_dragon_08_gp ) {
|
|||||||
0, 97, 255, 1,
|
0, 97, 255, 1,
|
||||||
101, 47, 133, 1,
|
101, 47, 133, 1,
|
||||||
178, 13, 43, 1,
|
178, 13, 43, 1,
|
||||||
255, 2, 10, 1};
|
255, 2, 10, 1
|
||||||
|
};
|
||||||
|
|
||||||
// Gradient palette "lava_gp", originally from
|
// Gradient palette "lava_gp", originally from
|
||||||
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/neota/elem/tn/lava.png.index.html
|
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/neota/elem/tn/lava.png.index.html
|
||||||
@ -313,7 +335,8 @@ DEFINE_GRADIENT_PALETTE( lava_gp ) {
|
|||||||
218, 255, 203, 4,
|
218, 255, 203, 4,
|
||||||
234, 255, 255, 4,
|
234, 255, 255, 4,
|
||||||
244, 255, 255, 71,
|
244, 255, 255, 71,
|
||||||
255, 255,255,255};
|
255, 255, 255, 255
|
||||||
|
};
|
||||||
|
|
||||||
// Gradient palette "fire_gp", originally from
|
// Gradient palette "fire_gp", originally from
|
||||||
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/neota/elem/tn/fire.png.index.html
|
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/neota/elem/tn/fire.png.index.html
|
||||||
@ -327,7 +350,8 @@ DEFINE_GRADIENT_PALETTE( fire_gp ) {
|
|||||||
197, 220, 105, 5,
|
197, 220, 105, 5,
|
||||||
240, 252, 255, 31,
|
240, 252, 255, 31,
|
||||||
250, 252, 255, 111,
|
250, 252, 255, 111,
|
||||||
255, 255,255,255};
|
255, 255, 255, 255
|
||||||
|
};
|
||||||
|
|
||||||
// Gradient palette "Colorfull_gp", originally from
|
// Gradient palette "Colorfull_gp", originally from
|
||||||
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/atmospheric/tn/Colorfull.png.index.html
|
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/atmospheric/tn/Colorfull.png.index.html
|
||||||
@ -345,7 +369,8 @@ DEFINE_GRADIENT_PALETTE( Colorfull_gp ) {
|
|||||||
116, 192, 117, 98,
|
116, 192, 117, 98,
|
||||||
124, 255, 255, 137,
|
124, 255, 255, 137,
|
||||||
168, 100, 180, 155,
|
168, 100, 180, 155,
|
||||||
255, 22,121,174};
|
255, 22, 121, 174
|
||||||
|
};
|
||||||
|
|
||||||
// Gradient palette "Magenta_Evening_gp", originally from
|
// Gradient palette "Magenta_Evening_gp", originally from
|
||||||
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/atmospheric/tn/Magenta_Evening.png.index.html
|
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/atmospheric/tn/Magenta_Evening.png.index.html
|
||||||
@ -359,7 +384,8 @@ DEFINE_GRADIENT_PALETTE( Magenta_Evening_gp ) {
|
|||||||
70, 232, 1, 66,
|
70, 232, 1, 66,
|
||||||
76, 252, 1, 69,
|
76, 252, 1, 69,
|
||||||
108, 123, 2, 51,
|
108, 123, 2, 51,
|
||||||
255, 46, 9, 35};
|
255, 46, 9, 35
|
||||||
|
};
|
||||||
|
|
||||||
// Gradient palette "Pink_Purple_gp", originally from
|
// Gradient palette "Pink_Purple_gp", originally from
|
||||||
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/atmospheric/tn/Pink_Purple.png.index.html
|
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/atmospheric/tn/Pink_Purple.png.index.html
|
||||||
@ -377,7 +403,8 @@ DEFINE_GRADIENT_PALETTE( Pink_Purple_gp ) {
|
|||||||
122, 159, 149, 221,
|
122, 159, 149, 221,
|
||||||
149, 113, 78, 188,
|
149, 113, 78, 188,
|
||||||
183, 128, 57, 155,
|
183, 128, 57, 155,
|
||||||
255, 146, 40,123};
|
255, 146, 40, 123
|
||||||
|
};
|
||||||
|
|
||||||
// Gradient palette "Sunset_Real_gp", originally from
|
// Gradient palette "Sunset_Real_gp", originally from
|
||||||
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/atmospheric/tn/Sunset_Real.png.index.html
|
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/atmospheric/tn/Sunset_Real.png.index.html
|
||||||
@ -391,7 +418,8 @@ DEFINE_GRADIENT_PALETTE( Sunset_Real_gp ) {
|
|||||||
85, 167, 22, 18,
|
85, 167, 22, 18,
|
||||||
135, 100, 0, 103,
|
135, 100, 0, 103,
|
||||||
198, 16, 0, 130,
|
198, 16, 0, 130,
|
||||||
255, 0, 0,160};
|
255, 0, 0, 160
|
||||||
|
};
|
||||||
|
|
||||||
// Gradient palette "es_autumn_19_gp", originally from
|
// Gradient palette "es_autumn_19_gp", originally from
|
||||||
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/autumn/tn/es_autumn_19.png.index.html
|
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/es/autumn/tn/es_autumn_19.png.index.html
|
||||||
@ -411,7 +439,8 @@ DEFINE_GRADIENT_PALETTE( es_autumn_19_gp ) {
|
|||||||
163, 113, 13, 1,
|
163, 113, 13, 1,
|
||||||
204, 55, 3, 1,
|
204, 55, 3, 1,
|
||||||
249, 17, 1, 1,
|
249, 17, 1, 1,
|
||||||
255, 17, 1, 1};
|
255, 17, 1, 1
|
||||||
|
};
|
||||||
|
|
||||||
// Gradient palette "BlacK_Blue_Magenta_White_gp", originally from
|
// Gradient palette "BlacK_Blue_Magenta_White_gp", originally from
|
||||||
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/basic/tn/BlacK_Blue_Magenta_White.png.index.html
|
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/basic/tn/BlacK_Blue_Magenta_White.png.index.html
|
||||||
@ -425,7 +454,8 @@ DEFINE_GRADIENT_PALETTE( BlacK_Blue_Magenta_White_gp ) {
|
|||||||
127, 42, 0, 255,
|
127, 42, 0, 255,
|
||||||
170, 255, 0, 255,
|
170, 255, 0, 255,
|
||||||
212, 255, 55, 255,
|
212, 255, 55, 255,
|
||||||
255, 255,255,255};
|
255, 255, 255, 255
|
||||||
|
};
|
||||||
|
|
||||||
// Gradient palette "BlacK_Magenta_Red_gp", originally from
|
// Gradient palette "BlacK_Magenta_Red_gp", originally from
|
||||||
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/basic/tn/BlacK_Magenta_Red.png.index.html
|
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/basic/tn/BlacK_Magenta_Red.png.index.html
|
||||||
@ -437,7 +467,8 @@ DEFINE_GRADIENT_PALETTE( BlacK_Magenta_Red_gp ) {
|
|||||||
63, 42, 0, 45,
|
63, 42, 0, 45,
|
||||||
127, 255, 0, 255,
|
127, 255, 0, 255,
|
||||||
191, 255, 0, 45,
|
191, 255, 0, 45,
|
||||||
255, 255, 0, 0};
|
255, 255, 0, 0
|
||||||
|
};
|
||||||
|
|
||||||
// Gradient palette "BlacK_Red_Magenta_Yellow_gp", originally from
|
// Gradient palette "BlacK_Red_Magenta_Yellow_gp", originally from
|
||||||
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/basic/tn/BlacK_Red_Magenta_Yellow.png.index.html
|
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/basic/tn/BlacK_Red_Magenta_Yellow.png.index.html
|
||||||
@ -451,7 +482,8 @@ DEFINE_GRADIENT_PALETTE( BlacK_Red_Magenta_Yellow_gp ) {
|
|||||||
127, 255, 0, 45,
|
127, 255, 0, 45,
|
||||||
170, 255, 0, 255,
|
170, 255, 0, 255,
|
||||||
212, 255, 55, 45,
|
212, 255, 55, 45,
|
||||||
255, 255,255, 0};
|
255, 255, 255, 0
|
||||||
|
};
|
||||||
|
|
||||||
// Gradient palette "Blue_Cyan_Yellow_gp", originally from
|
// Gradient palette "Blue_Cyan_Yellow_gp", originally from
|
||||||
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/basic/tn/Blue_Cyan_Yellow.png.index.html
|
// http://soliton.vm.bytemark.co.uk/pub/cpt-city/nd/basic/tn/Blue_Cyan_Yellow.png.index.html
|
||||||
@ -463,7 +495,8 @@ DEFINE_GRADIENT_PALETTE( Blue_Cyan_Yellow_gp ) {
|
|||||||
63, 0, 55, 255,
|
63, 0, 55, 255,
|
||||||
127, 0, 255, 255,
|
127, 0, 255, 255,
|
||||||
191, 42, 255, 45,
|
191, 42, 255, 45,
|
||||||
255, 255,255, 0};
|
255, 255, 255, 0
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// Single array of defined cpt-city color palettes.
|
// Single array of defined cpt-city color palettes.
|
||||||
|
5319
NodeRED_Flow.txt
Normal file
421
README.md
@ -1,54 +1,391 @@
|
|||||||
FastLED + ESP8266 Web Server
|
Nanoleaf Web Server
|
||||||
=========
|
=========
|
||||||
|
|
||||||
Control an addressable LED strip with an ESP8266 via a web browser or infrared remote control.
|
This is a fork of [jasoncoon's esp8266 fastled webserver](https://github.com/jasoncoon/esp8266-fastled-webserver) that was adapted to control the colors of my [DIY-Nanoleaf Replica](https://www.thingiverse.com/thing:3354082).
|
||||||
|
|
||||||
|
[](https://www.thingiverse.com/thing:3354082)
|
||||||
|
|
||||||
Hardware
|
Hardware
|
||||||
--------
|
--------
|
||||||
|
|
||||||
##### ESP8266 development board
|
##### ESP8266
|
||||||
|
|
||||||
[](https://www.aliexpress.com/item/WEMOS-D1-mini-Pro-16M-bytes-external-antenna-connector-ESP8266-WIFI-Internet-of-Things-development-board/32724692514.html)
|

|
||||||
|
|
||||||
[Wemos D1 Mini Pro & Headers](https://www.aliexpress.com/item/WEMOS-D1-mini-Pro-16M-bytes-external-antenna-connector-ESP8266-WIFI-Internet-of-Things-development-board/32724692514.html)
|
[Wemos D1 mini](http://s.click.aliexpress.com/e/cBDdafPw) is recommended, but any other ESP8266 variant should work too, but it might require an additional step-down converter.
|
||||||
|
|
||||||
or
|
|
||||||
|
|
||||||
[](https://www.adafruit.com/products/2471)
|
|
||||||
|
|
||||||
[Adafruit HUZZAH ESP8266 Breakout](https://www.adafruit.com/products/2471)
|
**Addressable Led Strip**
|
||||||
|
|
||||||
##### Addressable LED strip
|

|
||||||
|
|
||||||
[](https://www.adafruit.com/product/1586)
|
I have used 12 led pixels per leaf → 1m of 60 leds/m = 5 leafs
|
||||||
|
|
||||||
[Adafruit NeoPixel Ring]
|
I would recommend buying a strip with 60 leds/m or more.
|
||||||
|
|
||||||
Other hardware:
|
[WS2812b led strip](http://s.click.aliexpress.com/e/SkQFQqc), make sure you choose IP30 any other IP rating wouldn't make any sense and might not even fit.
|
||||||
|
|
||||||
* [3.3V to 5V Logic Level Shifter](http://www.digikey.com/product-detail/en/texas-instruments/SN74HCT245N/296-1612-5-ND/277258) (required if LEDs "glitch")
|
|
||||||
|
|
||||||
Recommended by [Adafruit NeoPixel "Best Practices"](https://learn.adafruit.com/adafruit-neopixel-uberguide/best-practices) to help protect LEDs from current onrush:
|
|
||||||
* [1000µF Capacitor](http://www.digikey.com/product-detail/en/panasonic-electronic-components/ECA-1EM102/P5156-ND/245015)
|
|
||||||
* [300 to 500 Ohm resistor](https://www.digikey.com/product-detail/en/stackpole-electronics-inc/CF14JT470R/CF14JT470RCT-ND/1830342)
|
|
||||||
|
|
||||||
Optional shield to make everything more tidy:
|
Other (optional) hardware:
|
||||||
|
|
||||||
[](https://www.tindie.com/products/jasoncoon/wemos-d1-mini-esp8266-led-and-level-shifter-shield/)
|
* [3.3V to 5V Logic Level Shifter](http://s.click.aliexpress.com/e/buDr0PT2) (required if LEDs "glitch")
|
||||||
|
|
||||||
[Wemos D1 Mini ESP8266 LED & Level Shifter Shield](https://www.tindie.com/products/jasoncoon/wemos-d1-mini-esp8266-led-and-level-shifter-shield)
|
|
||||||
|
|
||||||
Features
|
Features
|
||||||
--------
|
--------
|
||||||
* Turn the NeoPixel Ring on and off
|
* Control the colors of individual leafs
|
||||||
* Adjust the brightness
|
* Adjust the brightness
|
||||||
* Change the display pattern
|
* Change the display pattern
|
||||||
* Adjust the color
|
* Adjust the color
|
||||||
|
* Adapted patterns to look great on the [DIY-Nanoleaf Replica](https://www.thingiverse.com/thing:3354082)
|
||||||
|
* OTA-Update support
|
||||||
|
* **Node-RED** integration :white_check_mark:
|
||||||
|
* Simple Amazon **Alexa** integration :white_check_mark:
|
||||||
|
* Custom pattern designer :white_check_mark:
|
||||||
|
* **Node-RED** webinterface to store special patterns persistant :white_check_mark:
|
||||||
|
|
||||||
Web App
|
|
||||||
|
|
||||||
|
### Upcoming Features
|
||||||
|
|
||||||
|
- **Node-RED** integration :white_check_mark:
|
||||||
|
- Simple Amazon **Alexa** integration :white_check_mark:
|
||||||
|
- Nanoleaf voice control :white_check_mark:
|
||||||
|
- Custom pattern designer :white_check_mark:
|
||||||
|
- **Node-RED** webinterface to store special patterns persistant :white_check_mark:
|
||||||
|
- Controlling multiple nanoleafs at once
|
||||||
|
- Advanced Amazon **Alexa** integration with custom skill (AWS account required, free)
|
||||||
|
> these features will be optional and require additional hardware (any linux/windows device that is in the same network)
|
||||||
|
|
||||||
|
Webinterface
|
||||||
--------
|
--------
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
The web app is stored in SPIFFS (on-board flash memory).
|
||||||
|
|
||||||
|
Installing
|
||||||
|
-----------
|
||||||
|
The app is installed via the Arduino IDE which can be [downloaded here](https://www.arduino.cc/en/main/software). The ESP8266 boards will need to be added to the Arduino IDE which is achieved as follows. Click File > Preferences and copy and paste the URL "http://arduino.esp8266.com/stable/package_esp8266com_index.json" into the Additional Boards Manager URLs field. Click OK. Click Tools > Boards: ... > Boards Manager. Find and click on ESP8266 (using the Search function may expedite this). Click on Install. After installation, click on Close and then select your ESP8266 board from the Tools > Board: ... menu.
|
||||||
|
|
||||||
|
The app depends on the following libraries. They must either be downloaded from GitHub and placed in the Arduino 'libraries' folder, or installed as [described here](https://www.arduino.cc/en/Guide/Libraries) by using the Arduino library manager.
|
||||||
|
|
||||||
|
* [FastLED](https://github.com/FastLED/FastLED)
|
||||||
|
* [Arduino WebSockets](https://github.com/Links2004/arduinoWebSockets)
|
||||||
|
|
||||||
|
Download the app code from GitHub using the green Clone or Download button from [GitHub](https://github.com/NimmLor/esp8266-nanoleaf-webserver) and click Download ZIP. Decompress the ZIP file in your Arduino sketch folder. Rename the folder from *esp8266-nanoleaf-webserver-master* to *esp8266-nanoleaf-webserver*
|
||||||
|
|
||||||
|
The web app needs to be uploaded to the ESP8266's SPIFFS. You can do this within the Arduino IDE after installing the [Arduino ESP8266FS tool](http://esp8266.github.io/Arduino/versions/2.3.0/doc/filesystem.html#uploading-files-to-file-system). An alternative would be to install the [Visual Micro](https://www.visualmicro.com/) plugin for Visual Studio.
|
||||||
|
|
||||||
|
With ESP8266FS installed upload the web app using `ESP8266 Sketch Data Upload` command in the Arduino Tools menu.
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
The most important thing to do is to set the amount of 'leafs' and the amount of led pixels that one 'leaf' contains.
|
||||||
|
|
||||||
|
For instance I use 12 leafs (triangles) with a total of 12 pixels in one leaf (=4 leds in each corner of the triangle).
|
||||||
|
|
||||||
|
```c++
|
||||||
|
#define LEAFCOUNT 12
|
||||||
|
#define PIXELS_PER_LEAF 12
|
||||||
|
```
|
||||||
|
|
||||||
|
Next enter the pin where the *Data* line is connected to, in my case it's pin D4 (you can either write D4 or 2).
|
||||||
|
|
||||||
|
`#define DATA_PIN D4`
|
||||||
|
|
||||||
|
Another **important** step is to create the **Secrets.h** file. Create a new tab (**ctrl**+**shift**+**n**) and name it *Secrets.h*, this file contains your WIFI credentials and it's structure must look like this:
|
||||||
|
|
||||||
|
``````c++
|
||||||
|
// AP mode password
|
||||||
|
const char WiFiAPPSK[] = "WIFI_NAME_IF_IN_AP_MODE";
|
||||||
|
|
||||||
|
// Wi-Fi network to connect to (if not in AP mode)
|
||||||
|
char* ssid = "YOUR_WIFI_NAME";
|
||||||
|
char* password = "YOUR_WIFI_PASSWORD";
|
||||||
|
``````
|
||||||
|
|
||||||
|
If colors appear to be swapped you should change the color order. For me, red and green was swapped so i had to change the color order from *RGB* to *GRB*.
|
||||||
|
|
||||||
|
You should also set the milli-amps of your power supply to prevent power overloading. I am using a 3A 5V psu so i defined 3000mA.
|
||||||
|
|
||||||
|
`#define MILLI_AMPS 3000`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Circuit
|
||||||
|
|
||||||
|
### Without Logic-Level Converter
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### With Logic-Level-Converter (required if leds 'glitch')
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Node-RED & Alexa integration Setup
|
||||||
|
## Features
|
||||||
|
|
||||||
|
### **Amazon Alexa Integration** (optional)
|
||||||
|
|
||||||
|
It works with any language that is supported by Alexa and can be easily expanded to support more activities or patterns. How you want to call them (Nanoleaf, Nanoleafs, Nano, Triangles) must be set in the setup of the devices.
|
||||||
|
|
||||||
|
#### **Commands**:
|
||||||
|
|
||||||
|
- Turn on/off
|
||||||
|
- Control Brightness
|
||||||
|
- Control Pattern Speed
|
||||||
|
- Set Color
|
||||||
|
- Set into Rainbow mode
|
||||||
|
- Enable Autoplay and set Duration
|
||||||
|
- Activate custom activities
|
||||||
|
|
||||||
|
> *Alexa, turn Nanoleafs **on/off***
|
||||||
|
> *Alexa, set Nanoleafs 70%*
|
||||||
|
> Alexa, dim Nanoleafs
|
||||||
|
> *Alexa, Nanoleaf speed 20%*
|
||||||
|
> *Alexa, set Nanoleafs pink*
|
||||||
|
> *Alexa, turn Nanoleaf rainbow on*
|
||||||
|
> *Alexa, turn Nanoleaf Autoplay on*
|
||||||
|
> *Alexa, set Nanoleaf Autoplay 40*
|
||||||
|
>
|
||||||
|
> Alexa, Nanoleaf Default
|
||||||
|
> Alexa, Nanoleaf Mode 1
|
||||||
|
> Alexa, Nanoleaf Mode 2
|
||||||
|
> Alexa, Nanoleaf Mode 3
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Node-RED GUI
|
||||||
|
|
||||||
|
The Node-RED GUI is an addition to the regular UI that is running on the Wemos D1 mini. It allows to create and save custom patterns and also control all regular parameters same as the ESP8266 webserver. It can be accessed by any device.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Nanoleaf Designer
|
||||||
|
|
||||||
|
In the Node-RED GUI you can easily create your nanoleaf setup by using the *Nanoleaf Designer*. It's easy to use and allows almost any design that is possible. But it might have still some minor bugs.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Nanoleaf Custom Pattern Designer
|
||||||
|
|
||||||
|
With the *Nanoleaf Custom Pattern Designer* you can create custom patterns with effects. Currently the individual leafs can be set to *Static* mode and *Breathe* mode that allows to set a phase shift and lets the leafs breathe. Flow-mode follows in the next update.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## What you will need
|
||||||
|
|
||||||
|
- Any device that runs Node-RED, examples would be:
|
||||||
|
- (recommended) [Raspberry Pi](https://www.amazon.de/gp/product/B01CD5VC92?ie=UTF8&tag=surrbradl08-21&camp=1638&linkCode=xm2&creativeASIN=B01CD5VC92)
|
||||||
|
- Any Linux machine
|
||||||
|
- (instructions are provided for linux) Any Windows machine
|
||||||
|
- Any Amazon Alexa device for Alexa integration, works on Android and IOS too (**OPTIONAL**)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Setup
|
||||||
|
|
||||||
|
#### 1. Install Node-RED
|
||||||
|
|
||||||
|
```bash
|
||||||
|
bash <(curl -sL https://raw.githubusercontent.com/node-red/raspbian-deb-package/master/resources/update-nodejs-and-nodered)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### 2. Install npm - this might be already installed
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt-get install nodejs npm -y
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### 3. Install dashboard, alexa-home-skill, color-convert, config
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd $HOME/.node-red
|
||||||
|
npm install node-red-dashboard
|
||||||
|
```
|
||||||
|
|
||||||
|
- if you get an error try: `npm install --unsafe-perm node-red-dashboard`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
npm install node-red-contrib-alexa-home-skill
|
||||||
|
npm install node-red-contrib-color-convert
|
||||||
|
npm install node-red-contrib-config
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### 4. Setup a static IP-Address for your Raspberry Pi (optional)
|
||||||
|
|
||||||
|
- (recommended) Setup a static ip on your router
|
||||||
|
- [or on your Raspberry Pi](http://www.circuitbasics.com/how-to-set-up-a-static-ip-on-the-raspberry-pi/)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### 6. Run Node-RED
|
||||||
|
|
||||||
|
To start Node-RED type into the shell:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo node-red-start
|
||||||
|
```
|
||||||
|
|
||||||
|
Connect to the GUI by typing the following line into your browser:
|
||||||
|
|
||||||
|
- http://IP-ADDRESS:1880
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### 3. Import the flow
|
||||||
|
|
||||||
|
- Click on the 3 dashes in the top right corner → import → clipboard
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Configure the IP-Address of the Wemos D1 mini
|
||||||
|
|
||||||
|
Edit the Nanoleaf-Config node to set the IP-Address.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Amazon Alexa setup
|
||||||
|
|
||||||
|
The Alexa integration uses the *Node-RED Alexa Home Skill Bridge* to redirect the commands from alexa to Node-RED.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### 1. Create a new Bridge account
|
||||||
|
|
||||||
|
Head to https://alexa-node-red.bm.hardill.me.uk/newuser and create a new account.
|
||||||
|
|
||||||
|
Afterwards login into your account.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### 2. Create the Devices
|
||||||
|
|
||||||
|
You have to create devices that are called by Alexa.
|
||||||
|
|
||||||
|
#### 2.1 Main Nanoleaf Device
|
||||||
|
|
||||||
|
First create the devices that control a few devices that are used to turn on/off the nanoleafs and controls the brightness. I've called them "Nanoleafs", "Nanoleaf", "Nano" and "Triangles", but a single one would be enough too.
|
||||||
|
|
||||||
|
Click the **Add Device** button and choose. Repeat this step for all your names.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### 2.2 Autoplay control Device (optional)
|
||||||
|
|
||||||
|
To control the autoplay functionality, create a device with **On, Off, %, +%, -%, LIGHT**.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### 2.3 Speed control Device (optional)
|
||||||
|
|
||||||
|
To control the speed of the animations, create a device with **%, +%, -%**.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### 2.4 Activities (optional)
|
||||||
|
|
||||||
|
Now create activities by clicking *Add Device* and selecting **On, Off, ACTIVITY**.
|
||||||
|
|
||||||
|
I've created one to set the *Rainbow* pattern, one for my default settings and Nanoleaf Mode 1-3 for some custom settings.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### 3. Activating the Alexa skill
|
||||||
|
|
||||||
|
Open the app on your phone or head to https://alexa.amazon.de and click on **Skills**.
|
||||||
|
|
||||||
|
Search for **Node-RED** and activate the skill. Afterwards you are prompted to login into your account that you have created the devices beforehand.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### 4. Add a new Alexa-Home-Skill configuration
|
||||||
|
|
||||||
|
Click on any Alexa node in the flow, and click *Add new alexa-home-configuration*. Afterwards hit the refresh button next to the devices list.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### 5. Select the devices
|
||||||
|
|
||||||
|
Click the alexa skill nodes in the flow and select the corresponding devices. **Delete all unused alexa nodes**.
|
||||||
|
|
||||||
|
For me, it looked like this:
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
### 6. Discover the Smart-Home Devices
|
||||||
|
|
||||||
|
Speak to Alexa and say to her: **Alexa, discover devices**. (Just say it in english, it works on every device)
|
||||||
|
|
||||||
|
If everything worked correctly she should tell you after around 30 seconds that she has found new devices.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Technical information
|
||||||
|
-----------------
|
||||||
|
|
||||||
Patterns are requested by the app from the ESP8266, so as new patterns are added, they're automatically listed in the app.
|
Patterns are requested by the app from the ESP8266, so as new patterns are added, they're automatically listed in the app.
|
||||||
|
|
||||||
@ -58,44 +395,6 @@ The web app is a single page app that uses [jQuery](https://jquery.com) and [Boo
|
|||||||
|
|
||||||
The only drawback to SPIFFS that I've found so far is uploading the files can be extremely slow, requiring several minutes, sometimes regardless of how large the files are. It can be so slow that I've been just developing the web app and debugging locally on my desktop (with a hard-coded IP for the ESP8266), before uploading to SPIFFS and testing on the ESP8266.
|
The only drawback to SPIFFS that I've found so far is uploading the files can be extremely slow, requiring several minutes, sometimes regardless of how large the files are. It can be so slow that I've been just developing the web app and debugging locally on my desktop (with a hard-coded IP for the ESP8266), before uploading to SPIFFS and testing on the ESP8266.
|
||||||
|
|
||||||
Installing
|
|
||||||
-----------
|
|
||||||
The app is installed via the Arduino IDE which can be [downloaded here](https://www.arduino.cc/en/main/software). The ESP8266 boards will need to be added to the Arduino IDE which is achieved as follows. Click File > Preferences and copy and paste the URL "http://arduino.esp8266.com/stable/package_esp8266com_index.json" into the Additional Boards Manager URLs field. Click OK. Click Tools > Boards: ... > Boards Manager. Find and click on ESP8266 (using the Search function may expedite this). Click on Install. After installation, click on Close and then select your ESP8266 board from the Tools > Board: ... menu.
|
|
||||||
|
|
||||||
The app depends on the following libraries. They must either be downloaded from GitHub and placed in the Arduino 'libraries' folder, or installed as [described here](https://www.arduino.cc/en/Guide/Libraries) by using the Arduino library manager.
|
|
||||||
|
|
||||||
* [FastLED](https://github.com/FastLED/FastLED)
|
|
||||||
* [IRremoteESP8266](https://github.com/sebastienwarin/IRremoteESP8266)
|
|
||||||
* [Arduino WebSockets](https://github.com/Links2004/arduinoWebSockets)
|
|
||||||
|
|
||||||
Download the app code from GitHub using the green Clone or Download button from [the GitHub project main page](https://github.com/jasoncoon/esp8266-fastled-webserver) and click Download ZIP. Decompress the ZIP file in your Arduino sketch folder.
|
|
||||||
|
|
||||||
The web app needs to be uploaded to the ESP8266's SPIFFS. You can do this within the Arduino IDE after installing the [Arduino ESP8266FS tool](https://github.com/esp8266/Arduino/blob/master/doc/filesystem.md#uploading-files-to-file-system).
|
|
||||||
|
|
||||||
With ESP8266FS installed upload the web app using `ESP8266 Sketch Data Upload` command in the Arduino Tools menu.
|
|
||||||
|
|
||||||
Then enter your wi-fi network SSID and password in the .ino file, and upload the sketch using the Upload button.
|
|
||||||
|
|
||||||
Compression
|
|
||||||
-----------
|
|
||||||
|
|
||||||
The web app files can be gzip compressed before uploading to SPIFFS by running the following command:
|
|
||||||
|
|
||||||
`gzip -r data/`
|
|
||||||
|
|
||||||
The ESP8266WebServer will automatically serve any .gz file. The file index.htm.gz will get served as index.htm, with the content-encoding header set to gzip, so the browser knows to decompress it. The ESP8266WebServer doesn't seem to like the Glyphicon fonts gzipped, though, so I decompress them with this command:
|
|
||||||
|
|
||||||
`gunzip -r data/fonts/`
|
|
||||||
|
|
||||||
REST Web services
|
|
||||||
-----------------
|
|
||||||
|
|
||||||
The firmware implements basic [RESTful web services](https://en.wikipedia.org/wiki/Representational_state_transfer) using the ESP8266WebServer library. Current values are requested with HTTP GETs, and values are set with POSTs using query string parameters. It can run in connected or standalone access point modes.
|
The firmware implements basic [RESTful web services](https://en.wikipedia.org/wiki/Representational_state_transfer) using the ESP8266WebServer library. Current values are requested with HTTP GETs, and values are set with POSTs using query string parameters. It can run in connected or standalone access point modes.
|
||||||
|
|
||||||
Infrared Remote Control
|
|
||||||
-----------------------
|
|
||||||
|
|
||||||
Control via infrared remote control is also supported, via the [ESP8266 port of the IRremote library](https://github.com/sebastienwarin/IRremoteESP8266).
|
|
||||||
|
|
||||||
[Adafruit NeoPixel Ring]:https://www.adafruit.com/product/1586
|
|
||||||
[Adafruit HUZZAH ESP8266 Breakout]:https://www.adafruit.com/products/2471
|
|
||||||
|
5
Secrets.h
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
const char WiFiAPPSK[] = "your-password";
|
||||||
|
|
||||||
|
// Wi-Fi network to connect to (if not in AP mode)
|
||||||
|
char* ssid = "WLAN23";
|
||||||
|
char* password = "57erChevy";
|
105
TwinkleFOX.h
@ -103,7 +103,8 @@ uint8_t attackDecayWave8( uint8_t i)
|
|||||||
{
|
{
|
||||||
if (i < 86) {
|
if (i < 86) {
|
||||||
return i * 3;
|
return i * 3;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
i -= 86;
|
i -= 86;
|
||||||
return 255 - (i + (i / 2));
|
return 255 - (i + (i / 2));
|
||||||
}
|
}
|
||||||
@ -151,7 +152,8 @@ CRGB computeOneTwinkle( uint32_t ms, uint8_t salt)
|
|||||||
if (COOL_LIKE_INCANDESCENT == 1) {
|
if (COOL_LIKE_INCANDESCENT == 1) {
|
||||||
coolLikeIncandescent(c, fastcycle8);
|
coolLikeIncandescent(c, fastcycle8);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
c = CRGB::Black;
|
c = CRGB::Black;
|
||||||
}
|
}
|
||||||
return c;
|
return c;
|
||||||
@ -183,18 +185,102 @@ void drawTwinkles()
|
|||||||
uint8_t bglight = bg.getAverageLight();
|
uint8_t bglight = bg.getAverageLight();
|
||||||
if (bglight > 64) {
|
if (bglight > 64) {
|
||||||
bg.nscale8_video(16); // very bright, so scale to 1/16th
|
bg.nscale8_video(16); // very bright, so scale to 1/16th
|
||||||
} else if( bglight > 16) {
|
}
|
||||||
|
else if (bglight > 16) {
|
||||||
bg.nscale8_video(64); // not that bright, so scale to 1/4th
|
bg.nscale8_video(64); // not that bright, so scale to 1/4th
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
bg.nscale8_video(86); // dim, scale to 1/3rd.
|
bg.nscale8_video(86); // dim, scale to 1/3rd.
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
bg = gBackgroundColor; // just use the explicitly defined background color
|
bg = gBackgroundColor; // just use the explicitly defined background color
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t backgroundBrightness = bg.getAverageLight();
|
uint8_t backgroundBrightness = bg.getAverageLight();
|
||||||
|
|
||||||
for(uint8_t i = 0; i < NUM_LEDS; i++) {
|
for (uint16_t i = 0; i < LEAFCOUNT; i++) {
|
||||||
|
CRGB& pixel = leds[i*PIXELS_PER_LEAF];
|
||||||
|
|
||||||
|
PRNG16 = (uint16_t)(PRNG16 * 2053) + 1384; // next 'random' number
|
||||||
|
uint16_t myclockoffset16 = PRNG16; // use that number as clock offset
|
||||||
|
PRNG16 = (uint16_t)(PRNG16 * 2053) + 1384; // next 'random' number
|
||||||
|
// use that number as clock speed adjustment factor (in 8ths, from 8/8ths to 23/8ths)
|
||||||
|
uint8_t myspeedmultiplierQ5_3 = ((((PRNG16 & 0xFF) >> 4) + (PRNG16 & 0x0F)) & 0x0F) + 0x08;
|
||||||
|
uint32_t myclock30 = (uint32_t)((clock32 * myspeedmultiplierQ5_3) >> 3) + myclockoffset16;
|
||||||
|
uint8_t myunique8 = PRNG16 >> 8; // get 'salt' value for this pixel
|
||||||
|
|
||||||
|
// We now have the adjusted 'clock' for this pixel, now we call
|
||||||
|
// the function that computes what color the pixel should be based
|
||||||
|
// on the "brightness = f( time )" idea.
|
||||||
|
CRGB c = computeOneTwinkle(myclock30, myunique8);
|
||||||
|
|
||||||
|
uint8_t cbright = c.getAverageLight();
|
||||||
|
int16_t deltabright = cbright - backgroundBrightness;
|
||||||
|
if (deltabright >= 32 || (!bg)) {
|
||||||
|
// If the new pixel is significantly brighter than the background color,
|
||||||
|
// use the new color.
|
||||||
|
fill_solid(leds + i * PIXELS_PER_LEAF, PIXELS_PER_LEAF, c);
|
||||||
|
//Serial.printf("rgb: %d, %d, %d\n", c.r,c.g,c.b);
|
||||||
|
}
|
||||||
|
else if (deltabright > 0) {
|
||||||
|
// If the new pixel is just slightly brighter than the background color,
|
||||||
|
// mix a blend of the new color and the background color
|
||||||
|
fill_solid(leds + i * PIXELS_PER_LEAF, PIXELS_PER_LEAF, blend(bg, c, deltabright * 8));
|
||||||
|
//Serial.println("rgb:"+ blend(bg, c, deltabright * 8));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
// if the new pixel is not at all brighter than the background color,
|
||||||
|
// just use the background color.
|
||||||
|
fill_solid(leds + i * PIXELS_PER_LEAF, PIXELS_PER_LEAF, bg);
|
||||||
|
//Serial.println("rgb:" + bg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/////// #############################BACKUP####################################
|
||||||
|
/*
|
||||||
|
// This function loops over each pixel, calculates the
|
||||||
|
// adjusted 'clock' that this pixel should use, and calls
|
||||||
|
// "CalculateOneTwinkle" on each pixel. It then displays
|
||||||
|
// either the twinkle color of the background color,
|
||||||
|
// whichever is brighter.
|
||||||
|
void drawTwinkles()
|
||||||
|
{
|
||||||
|
// "PRNG16" is the pseudorandom number generator
|
||||||
|
// It MUST be reset to the same starting value each time
|
||||||
|
// this function is called, so that the sequence of 'random'
|
||||||
|
// numbers that it generates is (paradoxically) stable.
|
||||||
|
uint16_t PRNG16 = 11337;
|
||||||
|
|
||||||
|
uint32_t clock32 = millis();
|
||||||
|
|
||||||
|
// Set up the background color, "bg".
|
||||||
|
// if AUTO_SELECT_BACKGROUND_COLOR == 1, and the first two colors of
|
||||||
|
// the current palette are identical, then a deeply faded version of
|
||||||
|
// that color is used for the background color
|
||||||
|
CRGB bg;
|
||||||
|
if ((AUTO_SELECT_BACKGROUND_COLOR == 1) &&
|
||||||
|
(twinkleFoxPalette[0] == twinkleFoxPalette[1])) {
|
||||||
|
bg = twinkleFoxPalette[0];
|
||||||
|
uint8_t bglight = bg.getAverageLight();
|
||||||
|
if (bglight > 64) {
|
||||||
|
bg.nscale8_video(16); // very bright, so scale to 1/16th
|
||||||
|
}
|
||||||
|
else if (bglight > 16) {
|
||||||
|
bg.nscale8_video(64); // not that bright, so scale to 1/4th
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bg.nscale8_video(86); // dim, scale to 1/3rd.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bg = gBackgroundColor; // just use the explicitly defined background color
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t backgroundBrightness = bg.getAverageLight();
|
||||||
|
|
||||||
|
for (uint16_t i = 0; i < NUM_LEDS; i++) {
|
||||||
CRGB& pixel = leds[i];
|
CRGB& pixel = leds[i];
|
||||||
|
|
||||||
PRNG16 = (uint16_t)(PRNG16 * 2053) + 1384; // next 'random' number
|
PRNG16 = (uint16_t)(PRNG16 * 2053) + 1384; // next 'random' number
|
||||||
@ -216,17 +302,20 @@ void drawTwinkles()
|
|||||||
// If the new pixel is significantly brighter than the background color,
|
// If the new pixel is significantly brighter than the background color,
|
||||||
// use the new color.
|
// use the new color.
|
||||||
pixel = c;
|
pixel = c;
|
||||||
} else if( deltabright > 0 ) {
|
}
|
||||||
|
else if (deltabright > 0) {
|
||||||
// If the new pixel is just slightly brighter than the background color,
|
// If the new pixel is just slightly brighter than the background color,
|
||||||
// mix a blend of the new color and the background color
|
// mix a blend of the new color and the background color
|
||||||
pixel = blend(bg, c, deltabright * 8);
|
pixel = blend(bg, c, deltabright * 8);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
// if the new pixel is not at all brighter than the background color,
|
// if the new pixel is not at all brighter than the background color,
|
||||||
// just use the background color.
|
// just use the background color.
|
||||||
pixel = bg;
|
pixel = bg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// A mostly red palette with green accents and white trim.
|
// A mostly red palette with green accents and white trim.
|
||||||
// "CRGB::Gray" is used as white to keep the brightness more uniform.
|
// "CRGB::Gray" is used as white to keep the brightness more uniform.
|
||||||
|
25
Twinkles.h
@ -53,17 +53,18 @@ void setPixelDirection( uint16_t i, bool dir)
|
|||||||
|
|
||||||
void brightenOrDarkenEachPixel(fract8 fadeUpAmount, fract8 fadeDownAmount)
|
void brightenOrDarkenEachPixel(fract8 fadeUpAmount, fract8 fadeDownAmount)
|
||||||
{
|
{
|
||||||
for ( uint16_t i = 0; i < NUM_LEDS; i++) {
|
for (uint16_t i = 0; i < LEAFCOUNT; i++) {
|
||||||
if ( getPixelDirection(i) == GETTING_DARKER) {
|
if (getPixelDirection(i*PIXELS_PER_LEAF) == GETTING_DARKER) {
|
||||||
// This pixel is getting darker
|
// This pixel is getting darker
|
||||||
leds[i] = makeDarker( leds[i], fadeDownAmount);
|
for (int i2 = 0; i2 < PIXELS_PER_LEAF; i2++)leds[i*PIXELS_PER_LEAF + i2] = makeDarker(leds[i*PIXELS_PER_LEAF + i2], fadeDownAmount);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
// This pixel is getting brighter
|
// This pixel is getting brighter
|
||||||
leds[i] = makeBrighter( leds[i], fadeUpAmount);
|
for (int i2 = 0; i2 < PIXELS_PER_LEAF; i2++)leds[i*PIXELS_PER_LEAF + i2] = makeBrighter(leds[i*PIXELS_PER_LEAF + i2], fadeUpAmount);
|
||||||
// now check to see if we've maxxed out the brightness
|
// now check to see if we've maxxed out the brightness
|
||||||
if ( leds[i].r == 255 || leds[i].g == 255 || leds[i].b == 255) {
|
if (leds[i*PIXELS_PER_LEAF].r == 255 || leds[i*PIXELS_PER_LEAF].g == 255 || leds[i*PIXELS_PER_LEAF].b == 255) {
|
||||||
// if so, turn around and start getting darker
|
// if so, turn around and start getting darker
|
||||||
setPixelDirection(i, GETTING_DARKER);
|
for (int i2 = 0; i2 < PIXELS_PER_LEAF; i2++)setPixelDirection(i*PIXELS_PER_LEAF + i2, GETTING_DARKER);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -79,10 +80,14 @@ void colortwinkles()
|
|||||||
|
|
||||||
// Now consider adding a new random twinkle
|
// Now consider adding a new random twinkle
|
||||||
if (random8() < DENSITY) {
|
if (random8() < DENSITY) {
|
||||||
int pos = random16(NUM_LEDS);
|
int pos = random16(LEAFCOUNT);
|
||||||
if (!leds[pos]) {
|
if (!leds[pos]) {
|
||||||
leds[pos] = ColorFromPalette( gCurrentPalette, random8(), STARTING_BRIGHTNESS, NOBLEND);
|
uint8_t rdo = random8();
|
||||||
setPixelDirection(pos, GETTING_BRIGHTER);
|
for (int i = 0; i < PIXELS_PER_LEAF; i++)
|
||||||
|
{
|
||||||
|
leds[pos*PIXELS_PER_LEAF + i] = ColorFromPalette(gCurrentPalette, rdo, STARTING_BRIGHTNESS, NOBLEND);
|
||||||
|
setPixelDirection(pos*PIXELS_PER_LEAF + i, GETTING_BRIGHTER);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
186
WiFi.h
@ -1,186 +0,0 @@
|
|||||||
//#include <DNSServer.h>
|
|
||||||
|
|
||||||
//DNSServer dnsServer;
|
|
||||||
|
|
||||||
//const byte DNS_PORT = 53;
|
|
||||||
|
|
||||||
// bool apMode = false;
|
|
||||||
|
|
||||||
// AP mode password
|
|
||||||
const char WiFiAPPSK[] = "";
|
|
||||||
|
|
||||||
// Wi-Fi network to connect to (if not in AP mode)
|
|
||||||
char* ssid = "";
|
|
||||||
char* password = "";
|
|
||||||
|
|
||||||
#define HOSTNAME "ESP8266-" ///< Hostname. The initializeWiFi function adds the Chip ID at the end.
|
|
||||||
|
|
||||||
#define DEBUG_WIFI 1
|
|
||||||
|
|
||||||
unsigned long futureTimeout = 0;
|
|
||||||
uint16_t connectionTimeout = 20000;
|
|
||||||
|
|
||||||
template <typename Generic>
|
|
||||||
void debugPrintln(Generic text) {
|
|
||||||
if (DEBUG_WIFI) {
|
|
||||||
Serial.print("*WiFi: ");
|
|
||||||
Serial.println(text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void startAp() {
|
|
||||||
// WiFi.disconnect();
|
|
||||||
|
|
||||||
// apMode = true;
|
|
||||||
|
|
||||||
// WiFi.mode(WIFI_AP_STA);
|
|
||||||
// debugPrintln("SET AP STA");
|
|
||||||
|
|
||||||
String AP_NameString = "ESP8266-";
|
|
||||||
AP_NameString += String(ESP.getChipId(), HEX);
|
|
||||||
|
|
||||||
char AP_NameChar[AP_NameString.length() + 1];
|
|
||||||
memset(AP_NameChar, 0, AP_NameString.length() + 1);
|
|
||||||
|
|
||||||
for (int i = 0; i < AP_NameString.length(); i++)
|
|
||||||
AP_NameChar[i] = AP_NameString.charAt(i);
|
|
||||||
|
|
||||||
debugPrintln("Starting soft AP");
|
|
||||||
|
|
||||||
if (WiFiAPPSK != NULL) {
|
|
||||||
debugPrintln(WiFi.softAP(AP_NameChar, WiFiAPPSK) ? "ready" : "failed");
|
|
||||||
} else {
|
|
||||||
debugPrintln(WiFi.softAP(AP_NameChar) ? "ready" : "failed");
|
|
||||||
}
|
|
||||||
|
|
||||||
debugPrintln("Connect to Wi-Fi access point: ");
|
|
||||||
debugPrintln(AP_NameChar);
|
|
||||||
|
|
||||||
delay(500); // Without delay I've seen the IP address blank
|
|
||||||
debugPrintln("AP IP address: ");
|
|
||||||
debugPrintln(WiFi.softAPIP());
|
|
||||||
|
|
||||||
// dnsServer.setErrorReplyCode(DNSReplyCode::NoError);
|
|
||||||
// dnsServer.start(DNS_PORT, "*", WiFi.softAPIP());
|
|
||||||
}
|
|
||||||
|
|
||||||
String getWiFiJson() {
|
|
||||||
String hostname = String(HOSTNAME);
|
|
||||||
hostname += String(ESP.getChipId(), HEX);
|
|
||||||
|
|
||||||
String json = "{";
|
|
||||||
|
|
||||||
json += "\"status\":\"" + String(WiFi.status()) + "\"";
|
|
||||||
json += ",\"localIP\":\"" + WiFi.localIP().toString() + "\"";
|
|
||||||
json += ",\"softAPIP\":\"" + WiFi.softAPIP().toString() + "\"";
|
|
||||||
json += ",\"hostname\":\"" + hostname + "\"";
|
|
||||||
json += ",\"ssid\":\"" + WiFi.SSID() + "\"";
|
|
||||||
json += ",\"rssi\":\"" + String(WiFi.RSSI()) + "\"";
|
|
||||||
|
|
||||||
// json += ",\"networks\":[";
|
|
||||||
// byte ssidCount = WiFi.scanNetworks();
|
|
||||||
// for (byte i = 0; i < ssidCount; i++) {
|
|
||||||
// if (i > 0)
|
|
||||||
// json += ",";
|
|
||||||
//
|
|
||||||
// json += "{\"name\":\"" + WiFi.SSID(i) + "\",\"rssi\":\"" + String(WiFi.RSSI(i)) + "\"}";
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// json += "]";
|
|
||||||
|
|
||||||
json += "}";
|
|
||||||
|
|
||||||
return json;
|
|
||||||
}
|
|
||||||
|
|
||||||
void initializeWiFi() {
|
|
||||||
WiFi.mode(WIFI_AP_STA);
|
|
||||||
|
|
||||||
// Set Hostname.
|
|
||||||
String hostname = String(HOSTNAME);
|
|
||||||
hostname += String(ESP.getChipId(), HEX);
|
|
||||||
WiFi.hostname(hostname);
|
|
||||||
|
|
||||||
// Print hostname.
|
|
||||||
Serial.println("Hostname: " + hostname);
|
|
||||||
|
|
||||||
char hostnameChar[hostname.length() + 1];
|
|
||||||
memset(hostnameChar, 0, hostname.length() + 1);
|
|
||||||
|
|
||||||
for (uint8_t i = 0; i < hostname.length(); i++)
|
|
||||||
hostnameChar[i] = hostname.charAt(i);
|
|
||||||
|
|
||||||
// MDNS.begin(hostnameChar);
|
|
||||||
|
|
||||||
// Add service to MDNS-SD
|
|
||||||
// MDNS.addService("http", "tcp", 80);
|
|
||||||
|
|
||||||
// attempt to connect; should it fail, fall back to AP mode
|
|
||||||
// WiFi.mode(WIFI_STA);
|
|
||||||
|
|
||||||
String stored_ssid = WiFi.SSID();
|
|
||||||
if (stored_ssid != NULL && stored_ssid != "") {
|
|
||||||
debugPrintln("Connecting to stored SSID:");
|
|
||||||
debugPrintln(stored_ssid);
|
|
||||||
WiFi.begin();
|
|
||||||
} else {
|
|
||||||
debugPrintln("No stored SSID");
|
|
||||||
}
|
|
||||||
|
|
||||||
startAp();
|
|
||||||
|
|
||||||
webServer.on("/wifi", HTTP_POST, []() {
|
|
||||||
String ssid = webServer.arg("ssid");
|
|
||||||
String password = webServer.arg("password");
|
|
||||||
// String mode = webServer.arg("mode");
|
|
||||||
|
|
||||||
char ssidChars[50];
|
|
||||||
ssid.toCharArray(ssidChars, 50);
|
|
||||||
|
|
||||||
char passwordChars[50];
|
|
||||||
password.toCharArray(passwordChars, 50);
|
|
||||||
|
|
||||||
debugPrintln("Connecting to new SSID:");
|
|
||||||
debugPrintln(ssid);
|
|
||||||
|
|
||||||
// dnsServer.stop();
|
|
||||||
// WiFi.softAPdisconnect(true);
|
|
||||||
|
|
||||||
// apMode = false;
|
|
||||||
// WiFi.mode(WIFI_STA);
|
|
||||||
WiFi.begin(ssidChars, passwordChars);
|
|
||||||
// futureTimeout = millis() + connectionTimeout;
|
|
||||||
|
|
||||||
webServer.sendHeader("Location", "/wifi.htm");
|
|
||||||
webServer.send(303);
|
|
||||||
});
|
|
||||||
|
|
||||||
webServer.on("/wifi", HTTP_GET, []() {
|
|
||||||
String json = getWiFiJson();
|
|
||||||
webServer.send(200, "application/json", json);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void checkWiFi() {
|
|
||||||
// if (WiFi.status() == WL_CONNECTED) {
|
|
||||||
// debugPrintln("connected");
|
|
||||||
// futureTimeout = millis() + connectionTimeout;
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// if (apMode) {
|
|
||||||
// debugPrintln("Already running in AP mode.");
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // time to give up on the stored network and switch to ap mode?
|
|
||||||
// if (futureTimeout != 0 && millis() < futureTimeout) {
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// debugPrintln("Switching to AP mode, timeout elapsed: ");
|
|
||||||
// debugPrintln(connectionTimeout);
|
|
||||||
//
|
|
||||||
// startApMode();
|
|
||||||
}
|
|
||||||
|
|
@ -107,8 +107,38 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div id="booleanTemplate" class="form-group">
|
||||||
|
<label class="col-sm-2 control-label"></label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<div class="btn-group" role="group">
|
||||||
|
<button type="button" class="btn btn-default" id="btnOn">On</button>
|
||||||
|
<button type="button" class="btn btn-default" id="btnOff">Off</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="selectTemplate" class="form-group">
|
||||||
|
<label class="col-sm-2 control-label"></label>
|
||||||
|
<div class="col-sm-8">
|
||||||
|
<select class="form-control"><select>
|
||||||
|
</div>
|
||||||
|
<div class="col-sm-2">
|
||||||
|
<div class="btn-group" role="group" aria-label="...">
|
||||||
|
<button type="button" class="btn btn-default btn-previous"
|
||||||
|
aria-label="Previous" title="Previous">
|
||||||
|
<span class="glyphicon glyphicon-chevron-left"></span>
|
||||||
|
</button>
|
||||||
|
<button type="button" class="btn btn-default btn-next"
|
||||||
|
aria-label="Next" title="Next">
|
||||||
|
<span class="glyphicon glyphicon-chevron-right"></span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div id="colorPaletteTemplate" class="form-group">
|
<div id="colorPaletteTemplate" class="form-group">
|
||||||
<label class="col-sm-2 control-label color-label"></label>
|
<label class="col-sm-2 control-label color-label"></label>
|
||||||
|
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<div class="btn-group btn-group-justified" role="group">
|
<div class="btn-group btn-group-justified" role="group">
|
||||||
<div class="btn-group" role="group">
|
<div class="btn-group" role="group">
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
<!-- request js from the ESP8266 web server -->
|
<!-- request js from the ESP8266 web server -->
|
||||||
<script src="js/jquery-3.1.1.min.js"></script>
|
<script src="js/jquery-3.1.1.min.js"></script>
|
||||||
<script src="js/bootstrap.min.js"></script>
|
<script src="js/bootstrap.min.js"></script>
|
||||||
|
<script src="js/r-websocket.min.js"></script>
|
||||||
|
|
||||||
<script src="js/simple.js"></script>
|
<script src="js/simple.js"></script>
|
||||||
|
|
||||||
|
@ -1,21 +1,59 @@
|
|||||||
/*
|
/*
|
||||||
* ESP8266 + FastLED + IR Remote: https://github.com/jasoncoon/esp8266-fastled-webserver
|
ESP8266 FastLED WebServer: https://github.com/jasoncoon/esp8266-fastled-webserver
|
||||||
* Copyright (C) 2015-2016 Jason Coon
|
Copyright (C) 2015-2018 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/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
//-----------------------------------------CONFIG-----------------------------------------//
|
||||||
|
#define LEAFCOUNT 12
|
||||||
|
#define PIXELS_PER_LEAF 12
|
||||||
|
|
||||||
|
#define DATA_PIN D4 // The pin where the data line is connected to
|
||||||
|
#define LED_TYPE WS2812B
|
||||||
|
#define COLOR_ORDER GRB // Color order, if e.g. your Colors are swapped then change the order, (RGB, RBG, GBR, GRB, BRG, BGR)
|
||||||
|
|
||||||
|
#define MILLI_AMPS 3000 // 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.
|
||||||
|
const bool apMode = false; // Set to true if the esp8266 should open an Access-Point
|
||||||
|
|
||||||
|
|
||||||
|
// Animation Config:
|
||||||
|
// ten seconds per color palette makes a good demo
|
||||||
|
// 20-120 is better for deployment
|
||||||
|
uint8_t secondsPerPalette = 60;
|
||||||
|
|
||||||
|
// COOLING: How much does the air cool as it rises?
|
||||||
|
// Less cooling = taller flames. More cooling = shorter flames.
|
||||||
|
// Default 50, suggested range 20-100
|
||||||
|
uint8_t cooling = 49;
|
||||||
|
|
||||||
|
// SPARKING: What chance (out of 255) is there that a new spark will be lit?
|
||||||
|
// Higher chance = more roaring fire. Lower chance = more flickery fire.
|
||||||
|
// Default 120, suggested range 50-200.
|
||||||
|
uint8_t sparking = 160;
|
||||||
|
|
||||||
|
uint8_t speed = 20;
|
||||||
|
//---------------------------------------CONFIG END---------------------------------------//
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//#define FASTLED_ALLOW_INTERRUPTS 1
|
||||||
|
//#define INTERRUPT_THRESHOLD 1
|
||||||
|
#define FASTLED_INTERRUPT_RETRY_COUNT 0
|
||||||
|
|
||||||
#include <FastLED.h>
|
#include <FastLED.h>
|
||||||
FASTLED_USING_NAMESPACE
|
FASTLED_USING_NAMESPACE
|
||||||
|
|
||||||
@ -27,7 +65,7 @@ extern "C" {
|
|||||||
//#include <ESP8266mDNS.h>
|
//#include <ESP8266mDNS.h>
|
||||||
#include <ESP8266WebServer.h>
|
#include <ESP8266WebServer.h>
|
||||||
#include <ESP8266HTTPUpdateServer.h>
|
#include <ESP8266HTTPUpdateServer.h>
|
||||||
#include <WebSocketsServer.h>
|
//#include <WebSocketsServer.h>
|
||||||
#include <FS.h>
|
#include <FS.h>
|
||||||
#include <EEPROM.h>
|
#include <EEPROM.h>
|
||||||
//#include <IRremoteESP8266.h>
|
//#include <IRremoteESP8266.h>
|
||||||
@ -43,20 +81,25 @@ extern "C" {
|
|||||||
//#include "Commands.h"
|
//#include "Commands.h"
|
||||||
|
|
||||||
ESP8266WebServer webServer(80);
|
ESP8266WebServer webServer(80);
|
||||||
WebSocketsServer webSocketsServer = WebSocketsServer(81);
|
//WebSocketsServer webSocketsServer = WebSocketsServer(81);
|
||||||
ESP8266HTTPUpdateServer httpUpdateServer;
|
ESP8266HTTPUpdateServer httpUpdateServer;
|
||||||
|
|
||||||
#include "WiFi.h"
|
|
||||||
|
|
||||||
#include "FSBrowser.h"
|
#include "FSBrowser.h"
|
||||||
|
|
||||||
#define DATA_PIN D8
|
|
||||||
#define LED_TYPE WS2811
|
|
||||||
#define COLOR_ORDER GRB
|
|
||||||
#define NUM_LEDS 24
|
|
||||||
|
|
||||||
#define MILLI_AMPS 2000 // IMPORTANT: set the max milli-Amps of your power supply (4A = 4000mA)
|
#define NUM_LEDS (PIXELS_PER_LEAF * LEAFCOUNT)
|
||||||
#define FRAMES_PER_SECOND 120 // here you can control the speed. With the Access Point / Web Server the animations run a bit slower.
|
|
||||||
|
|
||||||
|
#include "Secrets.h" // this file is intentionally not included in the sketch, so nobody accidentally commits their secret information.
|
||||||
|
// create a Secrets.h file with the following:
|
||||||
|
|
||||||
|
// AP mode password
|
||||||
|
// const char WiFiAPPSK[] = "your-password";
|
||||||
|
|
||||||
|
// Wi-Fi network to connect to (if not in AP mode)
|
||||||
|
// char* ssid = "your-ssid";
|
||||||
|
// char* password = "your-password";
|
||||||
|
|
||||||
|
|
||||||
CRGB leds[NUM_LEDS];
|
CRGB leds[NUM_LEDS];
|
||||||
|
|
||||||
@ -64,21 +107,7 @@ const uint8_t brightnessCount = 5;
|
|||||||
uint8_t brightnessMap[brightnessCount] = { 16, 32, 64, 128, 255 };
|
uint8_t brightnessMap[brightnessCount] = { 16, 32, 64, 128, 255 };
|
||||||
uint8_t brightnessIndex = 0;
|
uint8_t brightnessIndex = 0;
|
||||||
|
|
||||||
// ten seconds per color palette makes a good demo
|
char vals[4 + LEAFCOUNT * 5][4] = {""};
|
||||||
// 20-120 is better for deployment
|
|
||||||
uint8_t secondsPerPalette = 10;
|
|
||||||
|
|
||||||
// COOLING: How much does the air cool as it rises?
|
|
||||||
// Less cooling = taller flames. More cooling = shorter flames.
|
|
||||||
// Default 50, suggested range 20-100
|
|
||||||
uint8_t cooling = 49;
|
|
||||||
|
|
||||||
// SPARKING: What chance (out of 255) is there that a new spark will be lit?
|
|
||||||
// Higher chance = more roaring fire. Lower chance = more flickery fire.
|
|
||||||
// Default 120, suggested range 50-200.
|
|
||||||
uint8_t sparking = 60;
|
|
||||||
|
|
||||||
uint8_t speed = 30;
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@ -97,6 +126,9 @@ CRGBPalette16 IceColors_p = CRGBPalette16(CRGB::Black, CRGB::Blue, CRGB::Aqua, C
|
|||||||
uint8_t currentPatternIndex = 0; // Index number of which pattern is current
|
uint8_t currentPatternIndex = 0; // Index number of which pattern is current
|
||||||
uint8_t autoplay = 0;
|
uint8_t autoplay = 0;
|
||||||
|
|
||||||
|
uint8_t allLeafs = 1; // Sets if all leafs should get the same color
|
||||||
|
uint8_t selectedLeaf = 1; // Sets position of leaf to color
|
||||||
|
|
||||||
uint8_t autoplayDuration = 10;
|
uint8_t autoplayDuration = 10;
|
||||||
unsigned long autoPlayTimeout = 0;
|
unsigned long autoPlayTimeout = 0;
|
||||||
|
|
||||||
@ -104,6 +136,10 @@ uint8_t currentPaletteIndex = 0;
|
|||||||
|
|
||||||
uint8_t gHue = 0; // rotating "base color" used by many of the patterns
|
uint8_t gHue = 0; // rotating "base color" used by many of the patterns
|
||||||
|
|
||||||
|
uint8_t breathe = 0; // value for starting custom pattern
|
||||||
|
uint8_t breathe_dir = 1; // 1== rising
|
||||||
|
char cpattern[500] = "";
|
||||||
|
|
||||||
CRGB solidColor = CRGB::Blue;
|
CRGB solidColor = CRGB::Blue;
|
||||||
|
|
||||||
// scale the brightness of all pixels down
|
// scale the brightness of all pixels down
|
||||||
@ -163,7 +199,9 @@ PatternAndNameList patterns = {
|
|||||||
{ fire, "Fire" },
|
{ fire, "Fire" },
|
||||||
{ water, "Water" },
|
{ water, "Water" },
|
||||||
|
|
||||||
{ showSolidColor, "Solid Color" }
|
{ showSolidColor, "Solid Color" },
|
||||||
|
|
||||||
|
{ SetCustomPattern, "Custom Pattern"}
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint8_t patternCount = ARRAY_SIZE(patterns);
|
const uint8_t patternCount = ARRAY_SIZE(patterns);
|
||||||
@ -201,12 +239,13 @@ 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);
|
||||||
|
|
||||||
FastLED.addLeds<LED_TYPE, DATA_PIN, COLOR_ORDER>(leds, NUM_LEDS); // for WS2812 (Neopixel)
|
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(false);
|
||||||
FastLED.setCorrection(TypicalLEDStrip);
|
FastLED.setCorrection(TypicalLEDStrip);
|
||||||
FastLED.setBrightness(brightness);
|
FastLED.setBrightness(brightness);
|
||||||
@ -234,6 +273,8 @@ void setup() {
|
|||||||
|
|
||||||
SPIFFS.begin();
|
SPIFFS.begin();
|
||||||
{
|
{
|
||||||
|
Serial.println("SPIFFS contents:");
|
||||||
|
|
||||||
Dir dir = SPIFFS.openDir("/");
|
Dir dir = SPIFFS.openDir("/");
|
||||||
while (dir.next()) {
|
while (dir.next()) {
|
||||||
String fileName = dir.fileName();
|
String fileName = dir.fileName();
|
||||||
@ -243,9 +284,41 @@ void setup() {
|
|||||||
Serial.printf("\n");
|
Serial.printf("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
initializeWiFi();
|
//disabled due to https://github.com/jasoncoon/esp8266-fastled-webserver/issues/62
|
||||||
|
//initializeWiFi();
|
||||||
|
|
||||||
checkWiFi();
|
if (apMode)
|
||||||
|
{
|
||||||
|
WiFi.mode(WIFI_AP);
|
||||||
|
|
||||||
|
// Do a little work to get a unique-ish name. Append the
|
||||||
|
// last two bytes of the MAC (HEX'd) to "Thing-":
|
||||||
|
uint8_t mac[WL_MAC_ADDR_LENGTH];
|
||||||
|
WiFi.softAPmacAddress(mac);
|
||||||
|
String macID = String(mac[WL_MAC_ADDR_LENGTH - 2], HEX) +
|
||||||
|
String(mac[WL_MAC_ADDR_LENGTH - 1], HEX);
|
||||||
|
macID.toUpperCase();
|
||||||
|
String AP_NameString = "ESP8266 Thing " + macID;
|
||||||
|
|
||||||
|
char AP_NameChar[AP_NameString.length() + 1];
|
||||||
|
memset(AP_NameChar, 0, AP_NameString.length() + 1);
|
||||||
|
|
||||||
|
for (int i = 0; i < AP_NameString.length(); i++)
|
||||||
|
AP_NameChar[i] = AP_NameString.charAt(i);
|
||||||
|
|
||||||
|
WiFi.softAP(AP_NameChar, WiFiAPPSK);
|
||||||
|
|
||||||
|
Serial.printf("Connect to Wi-Fi access point: %s\n", AP_NameChar);
|
||||||
|
Serial.println("and open http://192.168.4.1 in your browser");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
WiFi.mode(WIFI_STA);
|
||||||
|
Serial.printf("Connecting to %s\n", ssid);
|
||||||
|
if (String(WiFi.SSID()) != String(ssid)) {
|
||||||
|
WiFi.begin(ssid, password);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
httpUpdateServer.setup(&webServer);
|
httpUpdateServer.setup(&webServer);
|
||||||
|
|
||||||
@ -318,12 +391,16 @@ void setup() {
|
|||||||
String b = webServer.arg("b");
|
String b = webServer.arg("b");
|
||||||
setSolidColor(r.toInt(), g.toInt(), b.toInt());
|
setSolidColor(r.toInt(), g.toInt(), b.toInt());
|
||||||
sendString(String(solidColor.r) + "," + String(solidColor.g) + "," + String(solidColor.b));
|
sendString(String(solidColor.r) + "," + String(solidColor.g) + "," + String(solidColor.b));
|
||||||
|
Serial.println(String(solidColor.r) + "," + String(solidColor.g) + "," + String(solidColor.b));
|
||||||
});
|
});
|
||||||
|
|
||||||
webServer.on("/pattern", HTTP_POST, []() {
|
webServer.on("/pattern", HTTP_POST, []() {
|
||||||
String value = webServer.arg("value");
|
String value = webServer.arg("value");
|
||||||
|
if (value.toInt() <= 29)
|
||||||
|
{
|
||||||
setPattern(value.toInt());
|
setPattern(value.toInt());
|
||||||
sendInt(currentPatternIndex);
|
sendInt(currentPatternIndex);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
webServer.on("/patternName", HTTP_POST, []() {
|
webServer.on("/patternName", HTTP_POST, []() {
|
||||||
@ -362,6 +439,29 @@ void setup() {
|
|||||||
sendInt(autoplayDuration);
|
sendInt(autoplayDuration);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
webServer.on("/allLeafs", HTTP_POST, []() {
|
||||||
|
String value = webServer.arg("value");
|
||||||
|
setAllLeafs(value.toInt());
|
||||||
|
sendInt(allLeafs);
|
||||||
|
});
|
||||||
|
|
||||||
|
webServer.on("/selectedLeaf", HTTP_POST, []() {
|
||||||
|
String value = webServer.arg("value");
|
||||||
|
setSelectedLeaf(value.toInt());
|
||||||
|
sendInt(selectedLeaf);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
webServer.on("/custom", HTTP_POST, []() {
|
||||||
|
String value = webServer.arg("value");
|
||||||
|
Serial.println(value);
|
||||||
|
value.toCharArray(cpattern, 500);
|
||||||
|
Serial.println(value);
|
||||||
|
sendString(value);
|
||||||
|
setPattern(30);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
//list directory
|
//list directory
|
||||||
webServer.on("/list", HTTP_GET, handleFileList);
|
webServer.on("/list", HTTP_GET, handleFileList);
|
||||||
//load editor
|
//load editor
|
||||||
@ -383,9 +483,9 @@ void setup() {
|
|||||||
webServer.begin();
|
webServer.begin();
|
||||||
Serial.println("HTTP web server started");
|
Serial.println("HTTP web server started");
|
||||||
|
|
||||||
webSocketsServer.begin();
|
// webSocketsServer.begin();
|
||||||
webSocketsServer.onEvent(webSocketEvent);
|
// webSocketsServer.onEvent(webSocketEvent);
|
||||||
Serial.println("Web socket server started");
|
// Serial.println("Web socket server started");
|
||||||
|
|
||||||
autoPlayTimeout = millis() + (autoplayDuration * 1000);
|
autoPlayTimeout = millis() + (autoplayDuration * 1000);
|
||||||
}
|
}
|
||||||
@ -403,25 +503,21 @@ void sendString(String value)
|
|||||||
void broadcastInt(String name, uint8_t value)
|
void broadcastInt(String name, uint8_t value)
|
||||||
{
|
{
|
||||||
String json = "{\"name\":\"" + name + "\",\"value\":" + String(value) + "}";
|
String json = "{\"name\":\"" + name + "\",\"value\":" + String(value) + "}";
|
||||||
webSocketsServer.broadcastTXT(json);
|
// webSocketsServer.broadcastTXT(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
void broadcastString(String name, String value)
|
void broadcastString(String name, String value)
|
||||||
{
|
{
|
||||||
String json = "{\"name\":\"" + name + "\",\"value\":\"" + String(value) + "\"}";
|
String json = "{\"name\":\"" + name + "\",\"value\":\"" + String(value) + "\"}";
|
||||||
webSocketsServer.broadcastTXT(json);
|
// webSocketsServer.broadcastTXT(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
// 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));
|
||||||
|
|
||||||
EVERY_N_SECONDS(10) {
|
|
||||||
checkWiFi();
|
|
||||||
}
|
|
||||||
|
|
||||||
// dnsServer.processNextRequest();
|
// dnsServer.processNextRequest();
|
||||||
webSocketsServer.loop();
|
// webSocketsServer.loop();
|
||||||
webServer.handleClient();
|
webServer.handleClient();
|
||||||
|
|
||||||
// handleIrInput();
|
// handleIrInput();
|
||||||
@ -433,6 +529,20 @@ void loop() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool hasConnected = false;
|
||||||
|
EVERY_N_SECONDS(1) {
|
||||||
|
if (WiFi.status() != WL_CONNECTED) {
|
||||||
|
// Serial.printf("Connecting to %s\n", ssid);
|
||||||
|
hasConnected = false;
|
||||||
|
}
|
||||||
|
else if (!hasConnected) {
|
||||||
|
hasConnected = true;
|
||||||
|
Serial.print("Connected! Open http://");
|
||||||
|
Serial.print(WiFi.localIP());
|
||||||
|
Serial.println(" in your browser");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// EVERY_N_SECONDS(10) {
|
// EVERY_N_SECONDS(10) {
|
||||||
// Serial.print( F("Heap: ") ); Serial.println(system_get_free_heap_size());
|
// Serial.print( F("Heap: ") ); Serial.println(system_get_free_heap_size());
|
||||||
// }
|
// }
|
||||||
@ -443,12 +553,20 @@ void loop() {
|
|||||||
gTargetPalette = gGradientPalettes[gCurrentPaletteNumber];
|
gTargetPalette = gGradientPalettes[gCurrentPaletteNumber];
|
||||||
}
|
}
|
||||||
|
|
||||||
EVERY_N_MILLISECONDS(40) {
|
EVERY_N_MILLISECONDS(80) {
|
||||||
// slowly blend the current palette to the next
|
// slowly blend the current palette to the next
|
||||||
nblendPaletteTowardPalette(gCurrentPalette, gTargetPalette, 8);
|
nblendPaletteTowardPalette(gCurrentPalette, gTargetPalette, 8);
|
||||||
gHue++; // slowly cycle the "base color" through the rainbow
|
gHue++; // slowly cycle the "base color" through the rainbow
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EVERY_N_MILLIS_I(thistimer, 128-(speed/2)) {
|
||||||
|
if (breathe_dir == 1)breathe++; else breathe--;
|
||||||
|
if (breathe >= 255)breathe_dir = 0;
|
||||||
|
else if (breathe <= 0) breathe_dir = 1;
|
||||||
|
//Serial.println(breathe);
|
||||||
|
}
|
||||||
|
thistimer.setPeriod(64-(speed/4));
|
||||||
|
|
||||||
if (autoplay && (millis() > autoPlayTimeout)) {
|
if (autoplay && (millis() > autoPlayTimeout)) {
|
||||||
adjustPattern(true);
|
adjustPattern(true);
|
||||||
autoPlayTimeout = millis() + (autoplayDuration * 1000);
|
autoPlayTimeout = millis() + (autoplayDuration * 1000);
|
||||||
@ -460,252 +578,47 @@ void loop() {
|
|||||||
FastLED.show();
|
FastLED.show();
|
||||||
|
|
||||||
// insert a delay to keep the framerate modest
|
// 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) {
|
//void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t length) {
|
||||||
|
//
|
||||||
switch (type) {
|
// switch (type) {
|
||||||
case WStype_DISCONNECTED:
|
// case WStype_DISCONNECTED:
|
||||||
Serial.printf("[%u] Disconnected!\n", num);
|
// Serial.printf("[%u] Disconnected!\n", num);
|
||||||
break;
|
// break;
|
||||||
|
//
|
||||||
case WStype_CONNECTED:
|
// case WStype_CONNECTED:
|
||||||
{
|
|
||||||
IPAddress ip = webSocketsServer.remoteIP(num);
|
|
||||||
Serial.printf("[%u] Connected from %d.%d.%d.%d url: %s\n", num, ip[0], ip[1], ip[2], ip[3], payload);
|
|
||||||
|
|
||||||
// send message to client
|
|
||||||
// webSocketsServer.sendTXT(num, "Connected");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WStype_TEXT:
|
|
||||||
Serial.printf("[%u] get Text: %s\n", num, payload);
|
|
||||||
|
|
||||||
// send message to client
|
|
||||||
// webSocketsServer.sendTXT(num, "message here");
|
|
||||||
|
|
||||||
// send data to all connected clients
|
|
||||||
// webSocketsServer.broadcastTXT("message here");
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WStype_BIN:
|
|
||||||
Serial.printf("[%u] get binary length: %u\n", num, length);
|
|
||||||
hexdump(payload, length);
|
|
||||||
|
|
||||||
// send message to client
|
|
||||||
// webSocketsServer.sendBIN(num, payload, lenght);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//void handleIrInput()
|
|
||||||
// {
|
// {
|
||||||
// InputCommand command = readCommand();
|
// IPAddress ip = webSocketsServer.remoteIP(num);
|
||||||
|
// Serial.printf("[%u] Connected from %d.%d.%d.%d url: %s\n", num, ip[0], ip[1], ip[2], ip[3], payload);
|
||||||
//
|
//
|
||||||
// if (command != InputCommand::None) {
|
// // send message to client
|
||||||
// Serial.print("command: ");
|
// // webSocketsServer.sendTXT(num, "Connected");
|
||||||
// Serial.println((int) command);
|
|
||||||
// }
|
// }
|
||||||
|
// break;
|
||||||
//
|
//
|
||||||
// switch (command) {
|
// case WStype_TEXT:
|
||||||
// case InputCommand::Up: {
|
// Serial.printf("[%u] get Text: %s\n", num, payload);
|
||||||
// adjustPattern(true);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case InputCommand::Down: {
|
|
||||||
// adjustPattern(false);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case InputCommand::Power: {
|
|
||||||
// setPower(power == 0 ? 1 : 0);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case InputCommand::BrightnessUp: {
|
|
||||||
// adjustBrightness(true);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case InputCommand::BrightnessDown: {
|
|
||||||
// adjustBrightness(false);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case InputCommand::PlayMode: { // toggle pause/play
|
|
||||||
// setAutoplay(!autoplay);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
//
|
//
|
||||||
// // pattern buttons
|
// // send message to client
|
||||||
|
// // webSocketsServer.sendTXT(num, "message here");
|
||||||
//
|
//
|
||||||
// case InputCommand::Pattern1: {
|
// // send data to all connected clients
|
||||||
// setPattern(0);
|
// // webSocketsServer.broadcastTXT("message here");
|
||||||
// break;
|
// break;
|
||||||
// }
|
|
||||||
// case InputCommand::Pattern2: {
|
|
||||||
// setPattern(1);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case InputCommand::Pattern3: {
|
|
||||||
// setPattern(2);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case InputCommand::Pattern4: {
|
|
||||||
// setPattern(3);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case InputCommand::Pattern5: {
|
|
||||||
// setPattern(4);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case InputCommand::Pattern6: {
|
|
||||||
// setPattern(5);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case InputCommand::Pattern7: {
|
|
||||||
// setPattern(6);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case InputCommand::Pattern8: {
|
|
||||||
// setPattern(7);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case InputCommand::Pattern9: {
|
|
||||||
// setPattern(8);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case InputCommand::Pattern10: {
|
|
||||||
// setPattern(9);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case InputCommand::Pattern11: {
|
|
||||||
// setPattern(10);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case InputCommand::Pattern12: {
|
|
||||||
// setPattern(11);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
//
|
//
|
||||||
// // custom color adjustment buttons
|
// case WStype_BIN:
|
||||||
|
// Serial.printf("[%u] get binary length: %u\n", num, length);
|
||||||
|
// hexdump(payload, length);
|
||||||
//
|
//
|
||||||
// case InputCommand::RedUp: {
|
// // send message to client
|
||||||
// solidColor.red += 8;
|
// // webSocketsServer.sendBIN(num, payload, lenght);
|
||||||
// setSolidColor(solidColor);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case InputCommand::RedDown: {
|
|
||||||
// solidColor.red -= 8;
|
|
||||||
// setSolidColor(solidColor);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case InputCommand::GreenUp: {
|
|
||||||
// solidColor.green += 8;
|
|
||||||
// setSolidColor(solidColor);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case InputCommand::GreenDown: {
|
|
||||||
// solidColor.green -= 8;
|
|
||||||
// setSolidColor(solidColor);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case InputCommand::BlueUp: {
|
|
||||||
// solidColor.blue += 8;
|
|
||||||
// setSolidColor(solidColor);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case InputCommand::BlueDown: {
|
|
||||||
// solidColor.blue -= 8;
|
|
||||||
// setSolidColor(solidColor);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// // color buttons
|
|
||||||
//
|
|
||||||
// case InputCommand::Red: {
|
|
||||||
// setSolidColor(CRGB::Red);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case InputCommand::RedOrange: {
|
|
||||||
// setSolidColor(CRGB::OrangeRed);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case InputCommand::Orange: {
|
|
||||||
// setSolidColor(CRGB::Orange);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case InputCommand::YellowOrange: {
|
|
||||||
// setSolidColor(CRGB::Goldenrod);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case InputCommand::Yellow: {
|
|
||||||
// setSolidColor(CRGB::Yellow);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// case InputCommand::Green: {
|
|
||||||
// setSolidColor(CRGB::Green);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case InputCommand::Lime: {
|
|
||||||
// setSolidColor(CRGB::Lime);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case InputCommand::Aqua: {
|
|
||||||
// setSolidColor(CRGB::Aqua);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case InputCommand::Teal: {
|
|
||||||
// setSolidColor(CRGB::Teal);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case InputCommand::Navy: {
|
|
||||||
// setSolidColor(CRGB::Navy);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// case InputCommand::Blue: {
|
|
||||||
// setSolidColor(CRGB::Blue);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case InputCommand::RoyalBlue: {
|
|
||||||
// setSolidColor(CRGB::RoyalBlue);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case InputCommand::Purple: {
|
|
||||||
// setSolidColor(CRGB::Purple);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case InputCommand::Indigo: {
|
|
||||||
// setSolidColor(CRGB::Indigo);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case InputCommand::Magenta: {
|
|
||||||
// setSolidColor(CRGB::Magenta);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// case InputCommand::White: {
|
|
||||||
// setSolidColor(CRGB::White);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case InputCommand::Pink: {
|
|
||||||
// setSolidColor(CRGB::Pink);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case InputCommand::LightPink: {
|
|
||||||
// setSolidColor(CRGB::LightPink);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case InputCommand::BabyBlue: {
|
|
||||||
// setSolidColor(CRGB::CornflowerBlue);
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// case InputCommand::LightBlue: {
|
|
||||||
// setSolidColor(CRGB::LightBlue);
|
|
||||||
// break;
|
// break;
|
||||||
// }
|
// }
|
||||||
//}
|
//}
|
||||||
//}
|
|
||||||
|
|
||||||
|
|
||||||
void loadSettings()
|
void loadSettings()
|
||||||
{
|
{
|
||||||
@ -773,6 +686,26 @@ void setAutoplayDuration(uint8_t value)
|
|||||||
broadcastInt("autoplayDuration", autoplayDuration);
|
broadcastInt("autoplayDuration", autoplayDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setAllLeafs(uint8_t value)
|
||||||
|
{
|
||||||
|
allLeafs = value == 0 ? 0 : 1;
|
||||||
|
|
||||||
|
EEPROM.write(8, allLeafs);
|
||||||
|
EEPROM.commit();
|
||||||
|
|
||||||
|
broadcastInt("allLeafs", allLeafs);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setSelectedLeaf(uint8_t value)
|
||||||
|
{
|
||||||
|
selectedLeaf = value;
|
||||||
|
|
||||||
|
EEPROM.write(9, selectedLeaf);
|
||||||
|
EEPROM.commit();
|
||||||
|
|
||||||
|
broadcastInt("selectedLeaf", selectedLeaf);
|
||||||
|
}
|
||||||
|
|
||||||
void setSolidColor(CRGB color)
|
void setSolidColor(CRGB color)
|
||||||
{
|
{
|
||||||
setSolidColor(color.r, color.g, color.b);
|
setSolidColor(color.r, color.g, color.b);
|
||||||
@ -787,9 +720,10 @@ void setSolidColor(uint8_t r, uint8_t g, uint8_t b)
|
|||||||
EEPROM.write(4, b);
|
EEPROM.write(4, b);
|
||||||
EEPROM.commit();
|
EEPROM.commit();
|
||||||
|
|
||||||
setPattern(patternCount - 1);
|
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
// increase or decrease the current pattern number, and wrap around at the ends
|
// increase or decrease the current pattern number, and wrap around at the ends
|
||||||
@ -913,7 +847,8 @@ void strandTest()
|
|||||||
|
|
||||||
void showSolidColor()
|
void showSolidColor()
|
||||||
{
|
{
|
||||||
fill_solid(leds, NUM_LEDS, solidColor);
|
if (allLeafs == 0 && selectedLeaf > 0 && selectedLeaf <= LEAFCOUNT)fill_solid(leds + PIXELS_PER_LEAF * (selectedLeaf - 1), PIXELS_PER_LEAF, solidColor);
|
||||||
|
else fill_solid(leds, NUM_LEDS, solidColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Patterns from FastLED example DemoReel100: https://github.com/FastLED/FastLED/blob/master/examples/DemoReel100/DemoReel100.ino
|
// Patterns from FastLED example DemoReel100: https://github.com/FastLED/FastLED/blob/master/examples/DemoReel100/DemoReel100.ino
|
||||||
@ -921,7 +856,13 @@ void showSolidColor()
|
|||||||
void rainbow()
|
void rainbow()
|
||||||
{
|
{
|
||||||
// FastLED's built-in rainbow generator
|
// FastLED's built-in rainbow generator
|
||||||
fill_rainbow( leds, NUM_LEDS, gHue, 255 / NUM_LEDS);
|
for (int i = 0; i < LEAFCOUNT; i++)
|
||||||
|
{
|
||||||
|
uint8_t myHue = (gHue + i * (255 / LEAFCOUNT));
|
||||||
|
gHue = gHue > 255 ? gHue - 255 : gHue;
|
||||||
|
//Serial.printf("I:%d \tH:%d\n", i*PIXELS_PER_LEAF, myHue);
|
||||||
|
fill_solid(leds + i * PIXELS_PER_LEAF, PIXELS_PER_LEAF, CHSV(myHue, 255, 255));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void rainbowWithGlitter()
|
void rainbowWithGlitter()
|
||||||
@ -939,10 +880,16 @@ void rainbowSolid()
|
|||||||
void confetti()
|
void confetti()
|
||||||
{
|
{
|
||||||
// random colored speckles that blink in and fade smoothly
|
// random colored speckles that blink in and fade smoothly
|
||||||
fadeToBlackBy( leds, NUM_LEDS, 10);
|
fadeToBlackBy(leds, NUM_LEDS, 3);
|
||||||
int pos = random16(NUM_LEDS);
|
int pos = random16(LEAFCOUNT * 3);
|
||||||
// leds[pos] += CHSV( gHue + random8(64), 200, 255);
|
// leds[pos] += CHSV( gHue + random8(64), 200, 255);
|
||||||
leds[pos] += ColorFromPalette(palettes[currentPaletteIndex], gHue + random8(64));
|
int val = gHue + random8(64);
|
||||||
|
for (int i = 0; i < (PIXELS_PER_LEAF / 3); i++)
|
||||||
|
{
|
||||||
|
|
||||||
|
leds[i + pos * (PIXELS_PER_LEAF / 3)] += ColorFromPalette(palettes[currentPaletteIndex], val);
|
||||||
|
//Serial.printf("POS:%d\n", i + pos);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void sinelon()
|
void sinelon()
|
||||||
@ -954,12 +901,25 @@ void sinelon()
|
|||||||
CRGB color = ColorFromPalette(palettes[currentPaletteIndex], gHue, 255);
|
CRGB color = ColorFromPalette(palettes[currentPaletteIndex], gHue, 255);
|
||||||
if (pos < prevpos) {
|
if (pos < prevpos) {
|
||||||
fill_solid(leds + pos, (prevpos - pos) + 1, color);
|
fill_solid(leds + pos, (prevpos - pos) + 1, color);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
fill_solid(leds + prevpos, (pos - prevpos) + 1, color);
|
fill_solid(leds + prevpos, (pos - prevpos) + 1, color);
|
||||||
}
|
}
|
||||||
prevpos = pos;
|
prevpos = pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void bpm()
|
||||||
|
{
|
||||||
|
// colored stripes pulsing at a defined Beats-Per-Minute (BPM)
|
||||||
|
uint8_t beat = beatsin8(speed, 64, 255);
|
||||||
|
CRGBPalette16 palette = palettes[currentPaletteIndex];
|
||||||
|
for (int i = 0; i < LEAFCOUNT; i++) {
|
||||||
|
for (int i2 = 0; i2 < PIXELS_PER_LEAF; i2++)leds[i * PIXELS_PER_LEAF + i2] = ColorFromPalette(palette, gHue + (i * 2), beat - gHue + (i * 10));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// BACKUP
|
||||||
|
/*
|
||||||
void bpm()
|
void bpm()
|
||||||
{
|
{
|
||||||
// colored stripes pulsing at a defined Beats-Per-Minute (BPM)
|
// colored stripes pulsing at a defined Beats-Per-Minute (BPM)
|
||||||
@ -969,6 +929,7 @@ void bpm()
|
|||||||
leds[i] = ColorFromPalette(palette, gHue + (i * 2), beat - gHue + (i * 10));
|
leds[i] = ColorFromPalette(palette, gHue + (i * 2), beat - gHue + (i * 10));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
void juggle()
|
void juggle()
|
||||||
{
|
{
|
||||||
@ -1014,6 +975,55 @@ void water()
|
|||||||
heatMap(IceColors_p, false);
|
heatMap(IceColors_p, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Pride2015 by Mark Kriegsman: https://gist.github.com/kriegsman/964de772d64c502760e5
|
||||||
|
// This function draws rainbows with an ever-changing,
|
||||||
|
// widely-varying set of parameters.
|
||||||
|
void pride()
|
||||||
|
{
|
||||||
|
static uint16_t sPseudotime = 0;
|
||||||
|
static uint16_t sLastMillis = 0;
|
||||||
|
static uint16_t sHue16 = 0;
|
||||||
|
|
||||||
|
uint8_t sat8 = beatsin88(87, 220, 250);
|
||||||
|
uint8_t brightdepth = beatsin88(341, 96, 224);
|
||||||
|
uint16_t brightnessthetainc16 = beatsin88(203, (25 * 256), (40 * 256));
|
||||||
|
uint8_t msmultiplier = beatsin88(147, 23, 60);
|
||||||
|
|
||||||
|
uint16_t hue16 = sHue16;//gHue * 256;
|
||||||
|
uint16_t hueinc16 = beatsin88(113, 1, 3000);
|
||||||
|
|
||||||
|
uint16_t ms = millis();
|
||||||
|
uint16_t deltams = ms - sLastMillis;
|
||||||
|
sLastMillis = ms;
|
||||||
|
sPseudotime += deltams * msmultiplier;
|
||||||
|
sHue16 += deltams * beatsin88(400, 5, 9);
|
||||||
|
uint16_t brightnesstheta16 = sPseudotime;
|
||||||
|
|
||||||
|
for (uint16_t i = 0; i < (LEAFCOUNT * 3); i++) {
|
||||||
|
hue16 += hueinc16;
|
||||||
|
uint8_t hue8 = hue16 / 256;
|
||||||
|
|
||||||
|
brightnesstheta16 += brightnessthetainc16;
|
||||||
|
uint16_t b16 = sin16(brightnesstheta16) + 32768;
|
||||||
|
|
||||||
|
uint16_t bri16 = (uint32_t)((uint32_t)b16 * (uint32_t)b16) / 65536;
|
||||||
|
uint8_t bri8 = (uint32_t)(((uint32_t)bri16) * brightdepth) / 65536;
|
||||||
|
bri8 += (255 - brightdepth);
|
||||||
|
|
||||||
|
CRGB newcolor = CHSV(hue8, sat8, bri8);
|
||||||
|
|
||||||
|
uint16_t pixelnumber = i;
|
||||||
|
pixelnumber = ((LEAFCOUNT * 3) - 1) - pixelnumber;
|
||||||
|
|
||||||
|
for (int i2 = 0; i2 < (PIXELS_PER_LEAF / 3); i2++)
|
||||||
|
{
|
||||||
|
nblend(leds[pixelnumber * (PIXELS_PER_LEAF / 3) + i2], newcolor, 64);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//#############BACKUP########################
|
||||||
|
/*
|
||||||
// Pride2015 by Mark Kriegsman: https://gist.github.com/kriegsman/964de772d64c502760e5
|
// Pride2015 by Mark Kriegsman: https://gist.github.com/kriegsman/964de772d64c502760e5
|
||||||
// This function draws rainbows with an ever-changing,
|
// This function draws rainbows with an ever-changing,
|
||||||
// widely-varying set of parameters.
|
// widely-varying set of parameters.
|
||||||
@ -1058,9 +1068,11 @@ void pride()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
void radialPaletteShift()
|
void radialPaletteShift()
|
||||||
{
|
{
|
||||||
for (uint8_t i = 0; i < NUM_LEDS; i++) {
|
for (uint16_t i = 0; i < NUM_LEDS; i++) {
|
||||||
// leds[i] = ColorFromPalette( gCurrentPalette, gHue + sin8(i*16), brightness);
|
// leds[i] = ColorFromPalette( gCurrentPalette, gHue + sin8(i*16), brightness);
|
||||||
leds[i] = ColorFromPalette(gCurrentPalette, i + gHue, 255, LINEARBLEND);
|
leds[i] = ColorFromPalette(gCurrentPalette, i + gHue, 255, LINEARBLEND);
|
||||||
}
|
}
|
||||||
@ -1075,7 +1087,7 @@ void heatMap(CRGBPalette16 palette, bool up)
|
|||||||
random16_add_entropy(random(256));
|
random16_add_entropy(random(256));
|
||||||
|
|
||||||
// Array of temperature readings at each simulation cell
|
// Array of temperature readings at each simulation cell
|
||||||
static byte heat[256];
|
static byte heat[NUM_LEDS];
|
||||||
|
|
||||||
byte colorindex;
|
byte colorindex;
|
||||||
|
|
||||||
@ -1140,7 +1152,7 @@ uint8_t beatsaw8( accum88 beats_per_minute, uint8_t lowest = 0, uint8_t highest
|
|||||||
|
|
||||||
void colorWaves()
|
void colorWaves()
|
||||||
{
|
{
|
||||||
colorwaves( leds, NUM_LEDS, gCurrentPalette);
|
colorwaves(leds, LEAFCOUNT * 3, gCurrentPalette);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ColorWavesWithPalettes by Mark Kriegsman: https://gist.github.com/kriegsman/8281905786e8b2632aeb
|
// ColorWavesWithPalettes by Mark Kriegsman: https://gist.github.com/kriegsman/8281905786e8b2632aeb
|
||||||
@ -1173,7 +1185,8 @@ void colorwaves( CRGB* ledarray, uint16_t numleds, CRGBPalette16& palette)
|
|||||||
uint16_t h16_128 = hue16 >> 7;
|
uint16_t h16_128 = hue16 >> 7;
|
||||||
if (h16_128 & 0x100) {
|
if (h16_128 & 0x100) {
|
||||||
hue8 = 255 - (h16_128 >> 1);
|
hue8 = 255 - (h16_128 >> 1);
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
hue8 = h16_128 >> 1;
|
hue8 = h16_128 >> 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1191,9 +1204,14 @@ void colorwaves( CRGB* ledarray, uint16_t numleds, CRGBPalette16& palette)
|
|||||||
CRGB newcolor = ColorFromPalette(palette, index, bri8);
|
CRGB newcolor = ColorFromPalette(palette, index, bri8);
|
||||||
|
|
||||||
uint16_t pixelnumber = i;
|
uint16_t pixelnumber = i;
|
||||||
pixelnumber = (numleds - 1) - pixelnumber;
|
//pixelnumber = (numleds - 1) - pixelnumber;
|
||||||
|
//nblend(ledarray[pixelnumber], newcolor, 128);
|
||||||
|
|
||||||
nblend( ledarray[pixelnumber], newcolor, 128);
|
pixelnumber = ((LEAFCOUNT * 3) - 1) - pixelnumber;
|
||||||
|
for (int i2 = 0; i2 < (PIXELS_PER_LEAF / 3); i2++)
|
||||||
|
{
|
||||||
|
nblend(leds[pixelnumber * (PIXELS_PER_LEAF / 3) + i2], newcolor, 128);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1205,3 +1223,96 @@ void palettetest( CRGB* ledarray, uint16_t numleds, const CRGBPalette16& gCurren
|
|||||||
startindex--;
|
startindex--;
|
||||||
fill_palette(ledarray, numleds, startindex, (256 / NUM_LEDS) + 1, gCurrentPalette, 255, LINEARBLEND);
|
fill_palette(ledarray, numleds, startindex, (256 / NUM_LEDS) + 1, gCurrentPalette, 255, LINEARBLEND);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
Function: ExtractValues
|
||||||
|
Used to extract a given amount of values from the message with a start index
|
||||||
|
Parameters:
|
||||||
|
- startindex: position in the string where to start
|
||||||
|
- valuecount: amount of values to capture
|
||||||
|
*/
|
||||||
|
void ExtractValues(char receivedChars[], int startindex, int valuecount)
|
||||||
|
{
|
||||||
|
int pos = startindex;
|
||||||
|
for (int c = 0; c < valuecount; c++)
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
while (receivedChars[pos] != ';' && receivedChars[pos] != '\0') {
|
||||||
|
vals[c][i] = receivedChars[pos];
|
||||||
|
pos++;
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
vals[c][i] = '\0';
|
||||||
|
pos++;
|
||||||
|
}
|
||||||
|
#ifdef DEBUG_SERIAL
|
||||||
|
for (int p = 0; p < valuecount; p++)
|
||||||
|
{
|
||||||
|
Serial.print("Extracting: "); Serial.println(vals[p]);
|
||||||
|
}
|
||||||
|
#endif // DEBUG_SERIAL
|
||||||
|
}
|
||||||
|
void cycle(CRGB endclr, CRGB midclr, uint8_t start) {
|
||||||
|
fill_gradient_RGB(leds, start, endclr, PIXELS_PER_LEAF/ 2, midclr);
|
||||||
|
fill_gradient_RGB(leds, PIXELS_PER_LEAF/ 2 + 1, midclr, PIXELS_PER_LEAF, endclr);
|
||||||
|
}
|
||||||
|
// Set Custom Pattern for the node red part
|
||||||
|
void SetCustomPattern()
|
||||||
|
{
|
||||||
|
uint8_t cnt = 0;
|
||||||
|
uint8_t isflow = 0;
|
||||||
|
|
||||||
|
ExtractValues(cpattern, 0, 2);
|
||||||
|
cnt = atoi(vals[0]);
|
||||||
|
isflow = atoi(vals[1]);
|
||||||
|
ExtractValues(cpattern, 0, 2 + 5 * cnt);
|
||||||
|
if (isflow == 0)
|
||||||
|
{
|
||||||
|
for (uint8_t i = 0; i < cnt; i++)
|
||||||
|
{
|
||||||
|
int8_t cmode = atoi(vals[2 + i * 5]);
|
||||||
|
uint8_t phase = atoi(vals[2 + i * 5 + 1]);
|
||||||
|
int mul = breathe;
|
||||||
|
if (breathe_dir == 1)
|
||||||
|
{
|
||||||
|
if ((mul + phase) > 255)mul = 255 + (255 - mul - phase);
|
||||||
|
else mul += phase;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ((mul - phase) < 0)mul = -mul + phase;
|
||||||
|
else mul -= phase;
|
||||||
|
}
|
||||||
|
if (cmode == 0)mul = 255;
|
||||||
|
double fac = (mul * 100) / 255.00;
|
||||||
|
//if(cmode==1)Serial.printf("%d ", mul);
|
||||||
|
for (uint8_t x = 0; x < PIXELS_PER_LEAF; x++)
|
||||||
|
{
|
||||||
|
//Serial.printf("Setting %d to %d, %d, %d\n", cnt*PIXELS_PER_LEAF+x,atoi(vals[2+i*5+2]), atoi(vals[2+i*5+3]), atoi(vals[2+i*5+4]));
|
||||||
|
leds[i * PIXELS_PER_LEAF + x] = CRGB((atoi(vals[2 + i * 5 + 2]) * fac) / 100.00, (atoi(vals[2 + i * 5 + 3]) * fac) / 100.00, (atoi(vals[2 + i * 5 + 4]) * fac) / 100.00);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = 0; i < cnt; i++)
|
||||||
|
{
|
||||||
|
if (i != (cnt - 1))
|
||||||
|
{
|
||||||
|
//uint8_t speed = beatsin8(6,0,255);
|
||||||
|
CRGB endclr = blend(CRGB(atoi(vals[2 + i * 5 + 2]), atoi(vals[2 + i * 5 + 3]), atoi(vals[2 + i * 5 + 4])), CRGB(atoi(vals[2 + (i + 1) * 5 + 2]), atoi(vals[2 + (i + 1) * 5 + 3]), atoi(vals[2 + (i + 1) * 5 + 4])), breathe);
|
||||||
|
CRGB midclr = blend(CRGB(atoi(vals[2 + (i + 1) * 5 + 2]), atoi(vals[2 + (i + 1) * 5 + 3]), atoi(vals[2 + (i + 1) * 5 + 4])), CRGB(atoi(vals[2 + i * 5 + 2]), atoi(vals[2 + i * 5 + 3]), atoi(vals[2 + i * 5 + 4])), breathe);
|
||||||
|
cycle(endclr, midclr, i*PIXELS_PER_LEAF);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//uint8_t speed = beatsin8(6,0,255);
|
||||||
|
CRGB endclr = blend(CRGB(atoi(vals[2 + 2]), atoi(vals[2 + 3]), atoi(vals[2 + 4])), CRGB(atoi(vals[2 + (i + 1) * 5 + 2]), atoi(vals[2 + (i + 1) * 5 + 3]), atoi(vals[2 + (i + 1) * 5 + 4])), breathe);
|
||||||
|
CRGB midclr = blend(CRGB(atoi(vals[2 + (i + 1) * 5 + 2]), atoi(vals[2 + (i + 1) * 5 + 3]), atoi(vals[2 + (i + 1) * 5 + 4])), CRGB(atoi(vals[2 + 2]), atoi(vals[2 + 3]), atoi(vals[2 + 4])), breathe);
|
||||||
|
cycle(endclr, midclr, i*PIXELS_PER_LEAF);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Serial.println("");
|
||||||
|
}
|
BIN
gallery/DSC_8613.JPG
Normal file
After Width: | Height: | Size: 5.1 MiB |
BIN
gallery/DSC_8614.JPG
Normal file
After Width: | Height: | Size: 5.3 MiB |
BIN
gallery/DSC_8615.JPG
Normal file
After Width: | Height: | Size: 5.8 MiB |
BIN
gallery/DSC_8618.JPG
Normal file
After Width: | Height: | Size: 5.7 MiB |
BIN
gallery/DSC_8621.JPG
Normal file
After Width: | Height: | Size: 6.5 MiB |
BIN
gallery/DSC_8622.JPG
Normal file
After Width: | Height: | Size: 6.2 MiB |
BIN
gallery/DSC_8623.JPG
Normal file
After Width: | Height: | Size: 6.0 MiB |
BIN
gallery/DSC_8624.JPG
Normal file
After Width: | Height: | Size: 6.1 MiB |
BIN
gallery/NodeRED_UI/alexa_skill.png
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
gallery/NodeRED_UI/autoplay_and_parameters.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
gallery/NodeRED_UI/conf_1.png
Normal file
After Width: | Height: | Size: 9.6 KiB |
BIN
gallery/NodeRED_UI/config_1.png
Normal file
After Width: | Height: | Size: 7.2 KiB |
BIN
gallery/NodeRED_UI/config_2.png
Normal file
After Width: | Height: | Size: 17 KiB |
BIN
gallery/NodeRED_UI/device_1.png
Normal file
After Width: | Height: | Size: 46 KiB |
BIN
gallery/NodeRED_UI/device_2.png
Normal file
After Width: | Height: | Size: 106 KiB |
BIN
gallery/NodeRED_UI/device_3.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
gallery/NodeRED_UI/device_4.png
Normal file
After Width: | Height: | Size: 72 KiB |
BIN
gallery/NodeRED_UI/device_config.png
Normal file
After Width: | Height: | Size: 130 KiB |
BIN
gallery/NodeRED_UI/full.png
Normal file
After Width: | Height: | Size: 147 KiB |
BIN
gallery/NodeRED_UI/import.png
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
gallery/NodeRED_UI/main.png
Normal file
After Width: | Height: | Size: 7.4 KiB |
BIN
gallery/NodeRED_UI/nanoleaf_designer.png
Normal file
After Width: | Height: | Size: 55 KiB |
BIN
gallery/NodeRED_UI/nanoleaf_designer_2.png
Normal file
After Width: | Height: | Size: 56 KiB |
BIN
gallery/NodeRED_UI/pattern_designer.png
Normal file
After Width: | Height: | Size: 74 KiB |
BIN
gallery/NodeRED_UI/pattern_designer_2.png
Normal file
After Width: | Height: | Size: 71 KiB |
BIN
gallery/NodeRED_UI/patternlist.png
Normal file
After Width: | Height: | Size: 9.9 KiB |
BIN
gallery/NodeRED_UI/patterns.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
gallery/circuit.jpg
Normal file
After Width: | Height: | Size: 190 KiB |
BIN
gallery/circuit_logic_level_Steckplatine.jpg
Normal file
After Width: | Height: | Size: 236 KiB |
BIN
gallery/electronics_box.jpg
Normal file
After Width: | Height: | Size: 2.9 MiB |
BIN
gallery/electronics_box_level_shift.jpg
Normal file
After Width: | Height: | Size: 3.1 MiB |
BIN
gallery/interface.jpg
Normal file
After Width: | Height: | Size: 314 KiB |
BIN
gallery/rgb_preview2.gif
Normal file
After Width: | Height: | Size: 13 MiB |
BIN
gallery/thumb.JPG
Normal file
After Width: | Height: | Size: 2.4 MiB |
Before Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 70 KiB |
Before Width: | Height: | Size: 31 KiB |
BIN
web-app.png
Before Width: | Height: | Size: 83 KiB |
BIN
webapp.png
Before Width: | Height: | Size: 65 KiB |