You can now define a maximum distance between colors to blend to during random effects in order to prevent extremely colorful displays.
This commit is contained in:
parent
4b3797f4fc
commit
63bb2b43cf
@ -21,10 +21,15 @@
|
||||
#define SPEEDUP 1
|
||||
|
||||
#define MAX_MILLIAMPS 1000
|
||||
// Maximum color difference for the random effects.
|
||||
// This changes the hue value +/- this value. Use a maximum value of 127, otherwise strange things might happen.
|
||||
#define COLOR_DIFFERENCE 25
|
||||
|
||||
#define WIFI_SSID "..."
|
||||
#define WIFI_PASS "..."
|
||||
|
||||
#define OTA_HOSTNAME "..."
|
||||
|
||||
#define MQTT_CLIENT_ID "espleaf"
|
||||
#define MQTT_USER "..."
|
||||
#define MQTT_PASS "..."
|
||||
|
16
src/main.cpp
16
src/main.cpp
@ -220,11 +220,9 @@ void loop() {
|
||||
}
|
||||
|
||||
if (random8(128)==0) {
|
||||
if (active_mode == AM_FIRST_CORNER) {
|
||||
corners[0]->blend_to(CHSV(random8(), 255, 255));
|
||||
} else {
|
||||
corners[random16(corners.size())]->blend_to(CHSV(random8(), 255, 255));
|
||||
}
|
||||
uint16_t corner = (active_mode == AM_FIRST_CORNER) ? 0 : random16(corners.size());
|
||||
CHSV color = rgb2hsv_approximate(corners[corner]->color);
|
||||
corners[corner]->blend_to(CHSV(color.h - COLOR_DIFFERENCE + random8(2*COLOR_DIFFERENCE), 255, 255));
|
||||
}
|
||||
} else if (active_mode == AM_NODES || active_mode == AM_FIRST_NODE) {
|
||||
for(Node* node : nodes) {
|
||||
@ -233,11 +231,9 @@ void loop() {
|
||||
}
|
||||
|
||||
if (random8(128)==0) {
|
||||
if (active_mode == AM_FIRST_NODE) {
|
||||
nodes[0]->blend_to(CHSV(random8(), 255, 255));
|
||||
} else {
|
||||
nodes[random8(nodes.size())]->blend_to(CHSV(random8(), 255, 255));
|
||||
}
|
||||
uint16_t corner = (active_mode == AM_FIRST_NODE) ? 0 : random8(nodes.size());
|
||||
CHSV color = rgb2hsv_approximate(corners[corner]->color);
|
||||
nodes[corner]->blend_to(CHSV(color.h - COLOR_DIFFERENCE + random8(2*COLOR_DIFFERENCE), 255, 255));
|
||||
}
|
||||
} else if (active_mode == AM_FLASH) {
|
||||
for (Node* node : nodes) {
|
||||
|
Loading…
Reference in New Issue
Block a user