V3.0.0.BETA1

* Version Bump to 3.0.0.BETA1
 * further code changes
 * bugfixes
This commit is contained in:
bpohvoodoo
2019-09-29 13:27:37 +02:00
parent 2adc6707df
commit 341c469b49
29 changed files with 339 additions and 2468 deletions
+41 -41
View File
@@ -671,8 +671,6 @@ void setup() {
#if defined(ENABLE_REMOTE)
irrecv.enableIRIn(); // Start the receiver
#endif
snprintf(last_state, sizeof(last_state), "STA|%2d|%3d|%3d|%3d|%3d|%3d|%3d|%3d|%3d|%3d|%3d|%3d|%3d|%3d|%3d|%3d", mode, ws2812fx_mode, ws2812fx_speed, brightness, main_color.red, main_color.green, main_color.blue, main_color.white, back_color.red, back_color.green, back_color.blue, back_color.white, xtra_color.red, xtra_color.green, xtra_color.blue,xtra_color.white);
last_state[sizeof(last_state)]= 0x00;
ws2812fx_speed_actual = ws2812fx_speed;
brightness_trans = brightness;
memcpy(hex_colors, hex_colors_trans, sizeof(hex_colors_trans));
@@ -777,48 +775,43 @@ void loop() {
if (mode == SET) {
mode = HOLD;
// Mode
if (ws2812fx_mode != strip->getMode(selected_segment)) { // SET_MODE
#if defined(ENABLE_MQTT)
snprintf(mqtt_buf, sizeof(mqtt_buf), "OK /%i", ws2812fx_mode);
#endif
#if defined(ENABLE_MQTT)
snprintf(mqtt_buf, sizeof(mqtt_buf), "OK /%i", ws2812fx_mode);
#endif
strip->strip_off();
autoCount = 0;
autoDelay = 0;
strip->setMode(selected_segment, ws2812fx_mode);
}
//Color
/*if (memcmp(hex_colors_trans, strip->getColors(selected_segment), sizeof(hex_colors_trans)) != 0) {
}*/
// Brightness
if (strip->getBrightness() != brightness) {
#if defined(ENABLE_MQTT)
snprintf(mqtt_buf, sizeof(mqtt_buf), "OK %%%i", brightness);
#endif
brightness_trans = brightness;
}
// Speed
if (ws2812fx_speed_actual != ws2812fx_speed) {
#if defined(ENABLE_MQTT)
snprintf(mqtt_buf, sizeof(mqtt_buf), "OK ?%i", ws2812fx_speed);
#endif
}
prevmode = SET;
strip->trigger();
}
/*if (mode == SET) {
mode = HOLD;
if (trans_cnt==0) { trans_cnt=1; }
if (!transEffect) { trans_cnt=255; }
convertColorsFade();
prevmode = SET;
}*/
if (mode == SET_SPEED) {
#if defined(ENABLE_MQTT)
snprintf(mqtt_buf, sizeof(mqtt_buf), "OK ?%i", ws2812fx_speed);
#endif
mode = prevmode;
prevmode = SET_SPEED;
}
if (prevmode != mode) {
convertColors();
if (memcmp(hex_colors_trans, strip->getColors(selected_segment), sizeof(hex_colors_trans)) != 0) {
DBG_OUTPUT_PORT.println("Colors not equal!");
if (trans_cnt==0) { trans_cnt=1; }
if (!transEffect) { trans_cnt=255; }
convertColorsFade();
trans_cnt = 1;
}
strip->setSpeed(selected_segment, convertSpeed(ws2812fx_speed_actual));
//strip->setBrightness(brightness_actual);
@@ -873,7 +866,7 @@ void loop() {
}
#endif
if ((mode == HOLD) || ((mode == OFF) && ((strip->getBrightness() == 0) || !transEffect))) {
if ((mode == HOLD) || ((mode == OFF) && (strip->getBrightness() > 0) && transEffect)) {
if (ws2812fx_mode == FX_MODE_CUSTOM_0) {
handleAutoPlay();
}
@@ -882,26 +875,33 @@ void loop() {
}
// Async color transition
if ((trans_cnt > 0) && (trans_cnt < 255)) {
uint32_t hex_colors_actual[3] = {};
if ((transEffect) && (colorFadeDelay <= millis())) {
hex_colors_actual[0] = trans(hex_colors_trans[0], hex_colors[0], trans_cnt);
hex_colors_actual[1] = trans(hex_colors_trans[1], hex_colors[1], trans_cnt);
hex_colors_actual[2] = trans(hex_colors_trans[2], hex_colors[2], trans_cnt);
strip->setColors(selected_segment, hex_colors_actual);
trans_cnt++;
colorFadeDelay = millis() + TRANS_COLOR_DELAY;
if (memcmp(hex_colors_trans, strip->getColors(selected_segment), sizeof(hex_colors_trans)) != 0) {
if (transEffect) {
if ((trans_cnt > 0) && (trans_cnt < trans_cnt_max)) {
if (colorFadeDelay <= millis()) {
uint32_t hex_colors_actual[3] = {};
hex_colors_actual[0] = trans(hex_colors_trans[0], hex_colors[0], trans_cnt);
hex_colors_actual[1] = trans(hex_colors_trans[1], hex_colors[1], trans_cnt);
hex_colors_actual[2] = trans(hex_colors_trans[2], hex_colors[2], trans_cnt);
strip->setColors(selected_segment, hex_colors_actual);
trans_cnt++;
colorFadeDelay = millis() + TRANS_COLOR_DELAY;
if (mode == HOLD) strip->trigger();
}
} else if (trans_cnt >= trans_cnt_max) {
memcpy(hex_colors, hex_colors_trans, sizeof(hex_colors_trans));
strip->setColors(selected_segment, hex_colors);
if (mode == HOLD) strip->trigger();
trans_cnt = 0;
DBG_OUTPUT_PORT.println("Color transition finished!");
}
} else {
memcpy(hex_colors, hex_colors_trans, sizeof(hex_colors_trans));
strip->setColors(selected_segment, hex_colors);
if (mode == HOLD) strip->trigger();
trans_cnt = 0;
}
}
if (trans_cnt > 254) {
memcpy(hex_colors, hex_colors_trans, sizeof(hex_colors_trans));
strip->setColors(selected_segment, hex_colors);
if (mode == HOLD) strip->trigger();
trans_cnt = 0;
DBG_OUTPUT_PORT.println("Color transition finished!");
}
// Async speed transition
if (ws2812fx_speed_actual != ws2812fx_speed) {
if (transEffect) {
+8 -7
View File
@@ -21,11 +21,11 @@ char HOSTNAME[65] = "McLightingRGBW"; // Friedly hostname is configurable just
#define ENABLE_HOMEASSISTANT // If defined, enable Homeassistant integration, ENABLE_MQTT must be active
#define MQTT_HOME_ASSISTANT_SUPPORT // If defined, use AMQTT and select Tools -> IwIP Variant -> Higher Bandwidth
#define ENABLE_BUTTON 14 // If defined, enable button handling code, see: https://github.com/toblum/McLighting/wiki/Button-control, the value defines the input pin (14 / D5) for switching the LED strip on / off, connect this PIN to ground to trigger button.
#define ENABLE_BUTTON_GY33 12 // If defined, enable button handling code for GY-33 color sensor to scan color. The value defines the input pin (12 / D6) for read color data with RGB sensor, connect this PIN to ground to trigger button.
//#define ENABLE_BUTTON_GY33 12 // If defined, enable button handling code for GY-33 color sensor to scan color. The value defines the input pin (12 / D6) for read color data with RGB sensor, connect this PIN to ground to trigger button.
#if defined(ENABLE_BUTTON_GY33)
#define GAMMA 2.5 // Gamma correction for GY-33 sensor
#endif
//#define ENABLE_REMOTE 13 // If defined, enable Remote Control via TSOP31238. The value defines the input pin (13 / D7) for TSOP31238 Out
#define ENABLE_REMOTE 13 // If defined, enable Remote Control via TSOP31238. The value defines the input pin (13 / D7) for TSOP31238 Out
#define ENABLE_STATE_SAVE 1 // If defined, load saved state on reboot and save state. If set to 0 from EEPROM, if set to 1 from SPIFFS
@@ -35,12 +35,13 @@ char HOSTNAME[65] = "McLightingRGBW"; // Friedly hostname is configurable just
#define TRANS_COLOR_DELAY 5 // Delay for color transition
#define TRANS_DELAY 10 // Delay for brightness and speed transition
bool transEffect = false; // Experimental: Enable transitions of color, brightness and speed. It does not work properly for all effects.
bool transEffect = false; // Experimental: Enable transitions of color, brightness and speed. It does not work properly for all effects.
bool transEffectOverride = false;
uint8_t trans_cnt = 0;
unsigned long colorFadeDelay = 0;
uint8_t trans_cnt = 0;
int trans_cnt_max = 0;
unsigned long colorFadeDelay = 0;
unsigned long brightnessFadeDelay = 0;
unsigned long speedFadeDelay = 0;
unsigned long speedFadeDelay = 0;
#if defined(CUSTOM_WS2812FX_ANIMATIONS)
#define MULTICAST false
@@ -140,7 +141,7 @@ uint32_t autoParams[][6] = { // main_color, back_color, xtra_color, speed, mod
#define DBG_OUTPUT_PORT Serial // Set debug output port
// List of all color modes
enum MODE {OFF, HOLD, SET, SET_SPEED, INIT_STRIP};
enum MODE {OFF, HOLD, SET, INIT_STRIP};
MODE mode = SET; // Standard mode that is active when software starts
MODE prevmode = HOLD; // Do not change
@@ -150,7 +150,6 @@ void handleE131(){
}
}
#include <FastLED.h> //https://github.com/FastLED/FastLED
/*
* paste in the Fire2012 code with a small edit at the end which uses the
+215 -217
View File
@@ -17,38 +17,33 @@ void convertColors() {
hex_colors_trans[2] = (uint32_t)(xtra_color.white << 24) | (xtra_color.red << 16) | (xtra_color.green << 8) | xtra_color.blue;
}
void convertColorsFade() {
if ((transEffect) && (trans_cnt > 1) && (trans_cnt < 254)) {
memcpy(hex_colors, strip->getColors(selected_segment), sizeof(strip->getColors(selected_segment)));
DBG_OUTPUT_PORT.println("Color transistion aborted. Restarting...!");
trans_cnt = 1;
} else {
//memcpy(hex_colors, hex_colors_trans, sizeof(hex_colors_trans));
}
}
uint8_t calculateColorTransitionSteps () {
void calculateColorTransitionSteps() {
//compare all colors and calculate steps
int trans_cnt_max = 0;
trans_cnt_max = 0;
int calculate_max[4] = {};
for (uint8_t i=0; i<3; i++){
DBG_OUTPUT_PORT.printf("i: %i\r\n", i);
for (uint8_t j=0; j<4; j++) {
DBG_OUTPUT_PORT.printf("j: %i\r\n", j);
calculate_max[j] = ((hex_colors[i] >> ((3-j)*8)) & 0xFF) - ((hex_colors_trans[i] >> ((3-j)*8)) & 0xFF);
calculate_max[j] = abs(calculate_max[j]);
trans_cnt_max = max(trans_cnt_max, calculate_max[j]);
DBG_OUTPUT_PORT.printf("calcmax: %i %i\r\n", j, calculate_max[j]);
}
}
DBG_OUTPUT_PORT.printf("max: %i\r\n", trans_cnt_max);
return trans_cnt_max;
}
void convertColorsFade() {
if (transEffect) {
if (trans_cnt > 1) {
memcpy(hex_colors, strip->getColors(selected_segment), sizeof(hex_colors));
DBG_OUTPUT_PORT.println("Color transistion aborted. Restarting...!");
trans_cnt = 1;
}
calculateColorTransitionSteps();
}
}
void getArgs() {
if (mode == SET) {
//color wrgb
if (server.arg("rgb") != "") {
uint32_t rgb = (uint32_t) strtoul(server.arg("rgb").c_str(), NULL, 16);
main_color.white = ((rgb >> 24) & 0xFF);
@@ -121,17 +116,16 @@ void getArgs() {
xtra_color.green = constrain(xtra_color.green, 0, 255);
xtra_color.blue = constrain(xtra_color.blue, 0, 255);
xtra_color.white = constrain(xtra_color.white, 0, 255);
}
if (mode == SET || mode == SET_SPEED) {
// Speed
if ((server.arg("s") != "") && (server.arg("s").toInt() >= 0) && (server.arg("s").toInt() <= 255)) {
ws2812fx_speed = constrain(server.arg("s").toInt(), 0, 255);
ws2812fx_speed = constrain(server.arg("s").toInt(), 0, 255);
}
}
if (mode == SET) {
//Mode
if ((server.arg("m") != "") && (server.arg("m").toInt() >= 0) && (server.arg("m").toInt() <= strip->getModeCount())) {
ws2812fx_mode = constrain(server.arg("m").toInt(), 0, strip->getModeCount() - 1);
}
if ((server.arg("c") != "") && (server.arg("c").toInt() >= 0) && (server.arg("c").toInt() <= 100)) {
// Brightness
if ((server.arg("c") != "") && (server.arg("c").toInt() >= 0) && (server.arg("c").toInt() <= 100)) {
brightness = constrain((int) server.arg("c").toInt() * 2.55, 0, 255);
} else if ((server.arg("p") != "") && (server.arg("p").toInt() >= 0) && (server.arg("p").toInt() <= 255)) {
brightness = constrain(server.arg("p").toInt(), 0, 255);
@@ -204,9 +198,9 @@ void handleSetAllMode(uint8_t * mypayload) {
void handleSetSingleLED(uint8_t * mypayload, uint8_t firstChar = 0) {
// decode led index
char templed[3];
strncpy (templed, (const char *) &mypayload[firstChar], 2 );
templed[2] = 0x00;
char templed[5];
strncpy (templed, (const char *) &mypayload[firstChar], 4 );
templed[4] = 0x00;
uint8_t led = atoi(templed);
DBG_OUTPUT_PORT.printf("led value: [%i]. Entry threshold: <= [%i] (=> %s)\r\n", led, WS2812FXStripSettings.stripSize, mypayload );
@@ -215,10 +209,10 @@ void handleSetSingleLED(uint8_t * mypayload, uint8_t firstChar = 0) {
char greenhex[3];
char bluehex[3];
char whitehex[3];
strncpy (whitehex, (const char *) &mypayload[2 + firstChar], 2 );
strncpy (redhex, (const char *) &mypayload[4 + firstChar], 2 );
strncpy (greenhex, (const char *) &mypayload[6 + firstChar], 2 );
strncpy (bluehex, (const char *) &mypayload[8 + firstChar], 2 );
strncpy (whitehex, (const char *) &mypayload[4 + firstChar], 2 );
strncpy (redhex, (const char *) &mypayload[6 + firstChar], 2 );
strncpy (greenhex, (const char *) &mypayload[8 + firstChar], 2 );
strncpy (bluehex, (const char *) &mypayload[10 + firstChar], 2 );
whitehex[2] = 0x00;
redhex[2] = 0x00;
greenhex[2] = 0x00;
@@ -260,26 +254,26 @@ void handleSetDifferentColors(uint8_t * mypayload) {
void handleRangeDifferentColors(uint8_t * mypayload) {
uint8_t* nextCommand = 0;
nextCommand = (uint8_t*) strtok((char*) mypayload, "R");
// While there is a range to process R0110<00ff00>
// While there is a range to process R00010010<0000ff00>
while (nextCommand) {
// Loop for each LED.
char startled[4];
char endled[4];
char startled[5];
char endled[5];
char colorval[9];
strncpy ( startled, (const char *) &nextCommand[0], 2 );
startled[3] = 0x00;
strncpy ( endled, (const char *) &nextCommand[2], 2 );
endled[3] = 0x00;
strncpy ( colorval, (const char *) &nextCommand[4], 8 );
strncpy ( startled, (const char *) &nextCommand[0], 4 );
startled[4] = 0x00;
strncpy ( endled, (const char *) &nextCommand[4], 4 );
endled[4] = 0x00;
strncpy ( colorval, (const char *) &nextCommand[8], 8 );
colorval[8] = 0x00;
uint8_t rangebegin = atoi(startled);
uint8_t rangeend = atoi(endled);
DBG_OUTPUT_PORT.printf("Setting RANGE from [%i] to [%i] as color [%s]\r\n", rangebegin, rangeend, colorval);
while ( rangebegin <= rangeend ) {
char rangeData[11];
snprintf(rangeData, sizeof(rangeData), "%02d%s", rangebegin, colorval);
char rangeData[18];
snprintf(rangeData, sizeof(rangeData), "%04d%s", rangebegin, colorval);
rangeData[sizeof(rangeData) - 1] = 0x00;
// Set one LED
handleSetSingleLED((uint8_t*) rangeData, 0);
@@ -472,6 +466,9 @@ void handleSetWS2812FXMode(uint8_t * mypayload) {
if (strcmp((char *) &mypayload[1], "off") == 0) {
mode = OFF;
}
if (strcmp((char *) &mypayload[1], "on") == 0) {
mode = HOLD;
}
}
}
@@ -646,7 +643,7 @@ void checkpayload(uint8_t * payload, bool mqtt = false, uint8_t num = 0) {
if (payload[0] == '?') {
uint8_t d = (uint8_t) strtol((const char *) &payload[1], NULL, 10);
ws2812fx_speed = constrain(d, 0, 255);
mode = SET_SPEED;
mode = SET;
Dbg_Prefix(mqtt, num);
DBG_OUTPUT_PORT.printf("Set speed to: [%u]\r\n", ws2812fx_speed);
}
@@ -1059,7 +1056,7 @@ void webSocketEvent(uint8_t num, WStype_t type, uint8_t * payload, size_t lenght
uint8_t json_speed = constrain((uint8_t) root["speed"], 0, 255);
if (json_speed != ws2812fx_speed) {
ws2812fx_speed = json_speed;
mode = SET_SPEED;
mode = SET;
}
}
@@ -1663,7 +1660,7 @@ void handleRemote() {
mode = OFF;
}
}
if ((mode != AUTO) && (mode != OFF)) {
if (mode == HOLD) {
if (results.value == rmt_commands[BRIGHTNESS_UP]) { //Brightness Up
last_remote_cmd = results.value;
if (brightness + chng <= 255) {
@@ -1678,204 +1675,204 @@ void handleRemote() {
mode = SET;
}
}
}
if ((mode !=AUTO) && (mode != OFF)) {
if (results.value == rmt_commands[SPEED_UP]) { //Speed Up
last_remote_cmd = results.value;
if (ws2812fx_speed + chng <= 255) {
ws2812fx_speed = ws2812fx_speed + chng;
mode = SET_SPEED;
}
}
if (results.value == rmt_commands[SPEED_DOWN]) { //Speed down
last_remote_cmd = results.value;
if (ws2812fx_speed - chng >= 0) {
ws2812fx_speed = ws2812fx_speed - chng;
mode = SET_SPEED;
}
}
}
if (mode == HOLD) {
if (results.value == rmt_commands[RED_UP]) { //Red Up
last_remote_cmd = results.value;
if (selected_color == 1) {
if (main_color.red + chng <= 255) {
main_color.red = main_color.red + chng;
if ((ws2812fx_mode < 56) || (ws2812fx_mode > 57)) {
if (results.value == rmt_commands[SPEED_UP]) { //Speed Up
last_remote_cmd = results.value;
if (ws2812fx_speed + chng <= 255) {
ws2812fx_speed = ws2812fx_speed + chng;
mode = SET;
}
}
if (selected_color == 2) {
if (back_color.red + chng <= 255) {
back_color.red = back_color.red + chng;
mode = SET;
}
}
if (selected_color == 3) {
if (xtra_color.red + chng <= 255) {
xtra_color.red = xtra_color.red + chng;
if (results.value == rmt_commands[SPEED_DOWN]) { //Speed down
last_remote_cmd = results.value;
if (ws2812fx_speed - chng >= 0) {
ws2812fx_speed = ws2812fx_speed - chng;
mode = SET;
}
}
}
if (results.value == rmt_commands[RED_DOWN]) { //Red down
last_remote_cmd = results.value;
if (selected_color == 1) {
if (main_color.red - chng >= 0) {
main_color.red = main_color.red - chng;
mode = SET;
if ((ws2812fx_mode < 56) || (ws2812fx_mode > 60)) {
if (results.value == rmt_commands[RED_UP]) { //Red Up
last_remote_cmd = results.value;
if (selected_color == 1) {
if (main_color.red + chng <= 255) {
main_color.red = main_color.red + chng;
mode = SET;
}
}
if (selected_color == 2) {
if (back_color.red + chng <= 255) {
back_color.red = back_color.red + chng;
mode = SET;
}
}
if (selected_color == 3) {
if (xtra_color.red + chng <= 255) {
xtra_color.red = xtra_color.red + chng;
mode = SET;
}
}
}
if (selected_color == 2) {
if (back_color.red - chng >= 0) {
back_color.red = back_color.red - chng;
mode = SET;
if (results.value == rmt_commands[RED_DOWN]) { //Red down
last_remote_cmd = results.value;
if (selected_color == 1) {
if (main_color.red - chng >= 0) {
main_color.red = main_color.red - chng;
mode = SET;
}
}
if (selected_color == 2) {
if (back_color.red - chng >= 0) {
back_color.red = back_color.red - chng;
mode = SET;
}
}
if (selected_color == 3) {
if (xtra_color.red - chng >= 0) {
xtra_color.red = xtra_color.red - chng;
mode = SET;
}
}
}
if (selected_color == 3) {
if (xtra_color.red - chng >= 0) {
xtra_color.red = xtra_color.red - chng;
mode = SET;
if (results.value == rmt_commands[GREEN_UP]) { //Green Up
last_remote_cmd = results.value;
if (selected_color == 1) {
if (main_color.green + chng <= 255) {
main_color.green = main_color.green + chng;
mode = SET;
}
}
if (selected_color == 2) {
if (back_color.green + chng <= 255) {
back_color.green = back_color.green + chng;
mode = SET;
}
}
if (selected_color == 3) {
if (xtra_color.green + chng <= 255) {
xtra_color.green = xtra_color.green + chng;
mode = SET;
}
}
}
}
if (results.value == rmt_commands[GREEN_UP]) { //Green Up
last_remote_cmd = results.value;
if (selected_color == 1) {
if (main_color.green + chng <= 255) {
main_color.green = main_color.green + chng;
mode = SET;
if (results.value == rmt_commands[GREEN_DOWN]) { //Green down
last_remote_cmd = results.value;
if (selected_color == 1) {
if (main_color.green - chng >= 0) {
main_color.green = main_color.green - chng;;
mode = SET;
}
}
if (selected_color == 2) {
if (back_color.green - chng >= 0) {
back_color.green = back_color.green - chng;
mode = SET;
}
}
if (selected_color == 3) {
if (xtra_color.green - chng >= 0) {
xtra_color.green = xtra_color.green - chng;
mode = SET;
}
}
}
if (selected_color == 2) {
if (back_color.green + chng <= 255) {
back_color.green = back_color.green + chng;
mode = SET;
if (results.value == rmt_commands[BLUE_UP]) { //Blue Up
last_remote_cmd = results.value;
if (selected_color == 1) {
if (main_color.blue + chng <= 255) {
main_color.blue = main_color.blue + chng;
mode = SET;
}
}
if (selected_color == 2) {
if (back_color.blue + chng <= 255) {
back_color.blue = back_color.blue + chng;
mode = SET;
}
}
if (selected_color == 3) {
if (xtra_color.blue + chng <= 255) {
xtra_color.blue = xtra_color.blue + chng;
mode = SET;
}
}
}
if (selected_color == 3) {
if (xtra_color.green + chng <= 255) {
xtra_color.green = xtra_color.green + chng;
mode = SET;
if (results.value == rmt_commands[BLUE_DOWN]) { //Blue down
last_remote_cmd = results.value;
if (selected_color == 1) {
if (main_color.blue - chng >= 0) {
main_color.blue = main_color.blue - chng;
mode = SET;
}
}
if (selected_color == 2) {
if (back_color.blue - chng >= 0) {
back_color.blue = back_color.blue - chng;
mode = SET;
}
}
if (selected_color == 3) {
if (xtra_color.blue - chng >= 0) {
xtra_color.blue = xtra_color.blue - chng;
mode = SET;
}
}
}
}
if (results.value == rmt_commands[GREEN_DOWN]) { //green down
last_remote_cmd = results.value;
if (selected_color == 1) {
if (main_color.green - chng >= 0) {
main_color.green = main_color.green - chng;;
mode = SET;
if (results.value == rmt_commands[WHITE_UP]) { //White Up
last_remote_cmd = results.value;
if (selected_color == 1) {
if (main_color.white + chng <= 255) {
main_color.white = main_color.white + chng;
mode = SET;
}
}
if (selected_color == 2) {
if (back_color.white + chng <= 255) {
back_color.white = back_color.white + chng;
mode = SET;
}
}
if (selected_color == 3) {
if (xtra_color.white + chng <= 255) {
xtra_color.white = xtra_color.white + chng;
mode = SET;
}
}
}
if (selected_color == 2) {
if (back_color.green - chng >= 0) {
back_color.green = back_color.green - chng;
mode = SET;
if (results.value == rmt_commands[WHITE_DOWN]) { //White down
last_remote_cmd = results.value;
if (selected_color == 1) {
if (main_color.white - chng >= 0) {
main_color.white = main_color.white - chng;
mode = SET;
}
}
if (selected_color == 2) {
if (back_color.white - chng >= 0) {
back_color.white = back_color.white - chng;
mode = SET;
}
}
if (selected_color == 3) {
if (xtra_color.white - chng >= 0) {
xtra_color.white = xtra_color.white - chng;
mode = SET;
}
}
}
if (selected_color == 3) {
if (xtra_color.green - chng >= 0) {
xtra_color.green = xtra_color.green - chng;
mode = SET;
}
if (results.value == rmt_commands[COL_M]) { // Select Main Color
last_remote_cmd = 0;
selected_color = 1;
}
if (results.value == rmt_commands[COL_B]) { // Select Back Color
last_remote_cmd = 0;
selected_color = 2;
}
if (results.value == rmt_commands[COL_X]) { // Select Extra Color
last_remote_cmd = 0;
selected_color = 3;
}
}
if (results.value == rmt_commands[BLUE_UP]) { //Blue Up
last_remote_cmd = results.value;
if (selected_color == 1) {
if (main_color.blue + chng <= 255) {
main_color.blue = main_color.blue + chng;
mode = SET;
}
}
if (selected_color == 2) {
if (back_color.blue + chng <= 255) {
back_color.blue = back_color.blue + chng;
mode = SET;
}
}
if (selected_color == 3) {
if (xtra_color.blue + chng <= 255) {
xtra_color.blue = xtra_color.blue + chng;
mode = SET;
}
}
}
if (results.value == rmt_commands[BLUE_DOWN]) { //BLUE down
last_remote_cmd = results.value;
if (selected_color == 1) {
if (main_color.blue - chng >= 0) {
main_color.blue = main_color.blue - chng;
mode = SET;
}
}
if (selected_color == 2) {
if (back_color.blue - chng >= 0) {
back_color.blue = back_color.blue - chng;
mode = SET;
}
}
if (selected_color == 3) {
if (xtra_color.blue - chng >= 0) {
xtra_color.blue = xtra_color.blue - chng;
mode = SET;
}
}
}
if (results.value == rmt_commands[WHITE_UP]) { //White Up
last_remote_cmd = results.value;
if (selected_color == 1) {
if (main_color.white + chng <= 255) {
main_color.white = main_color.white + chng;
mode = SET;
}
}
if (selected_color == 2) {
if (back_color.white + chng <= 255) {
back_color.white = back_color.white + chng;
mode = SET;
}
}
if (selected_color == 3) {
if (xtra_color.white + chng <= 255) {
xtra_color.white = xtra_color.white + chng;
mode = SET;
}
}
}
if (results.value == rmt_commands[WHITE_DOWN]) { //White down
last_remote_cmd = results.value;
if (selected_color == 1) {
if (main_color.white - chng >= 0) {
main_color.white = main_color.white - chng;
mode = SET;
}
}
if (selected_color == 2) {
if (back_color.white - chng >= 0) {
back_color.white = back_color.white - chng;
mode = SET;
}
}
if (selected_color == 3) {
if (xtra_color.white - chng >= 0) {
xtra_color.white = xtra_color.white - chng;
mode = SET;
}
}
}
if (results.value == rmt_commands[COL_M]) { // Select Main Color
last_remote_cmd = 0;
selected_color = 1;
}
if (results.value == rmt_commands[COL_B]) { // Select Back Color
last_remote_cmd = 0;
selected_color = 2;
}
if (results.value == rmt_commands[COL_X]) { // Select Extra Color
last_remote_cmd = 0;
selected_color = 3;
}
} // end of if HOLD
if (results.value == rmt_commands[MODE_UP]) { //Mode Up
last_remote_cmd = results.value;
@@ -1937,6 +1934,7 @@ uint32_t scale_wrgb(uint32_t wrgb, uint8_t level) {
}
uint32_t trans(uint32_t newcolor, uint32_t oldcolor, uint8_t level) {
level = (level * (255/trans_cnt_max));
newcolor = scale_wrgb(newcolor, level);
oldcolor = scale_wrgb(oldcolor, 255-level);
return newcolor + oldcolor;
+4 -1
View File
@@ -172,7 +172,7 @@
* adressed issue: https://github.com/toblum/McLighting/issues/403 (Experimental Support of transitions: set transEffect = true in definitions.h)
* corrected use of DMA for Neopixelbus by Makuna (Tests for other strips than SK6812 GRBW were not made)
*
* 27 September 2019
* 27 September 2019
* Version Bump to 3.0.0.ALPHA1
* removed LEGACY_ANIMATIONS
* removed old Custom Animations from beginning of list.
@@ -184,4 +184,7 @@
* moved Custom Animation 'Gradients' to number 61
* REST-API changes (will be documented soon)
*
* 29 September 2019
* Version Bump to 3.0.0.BETA1
* further code changes
*/