Merge branch 'development' of https://github.com/arendst/Sonoff-Tasmota into development

This commit is contained in:
localhost61 2019-02-25 22:00:46 +01:00
commit 3757ce98c2
3 changed files with 19 additions and 17 deletions

View File

@ -789,8 +789,7 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len)
param_low = 1;
param_high = 250;
break;
case P_RGB_REMAP:
case P_RGB_REMAP:
param_low = 0;
param_high = 119;
break;
@ -798,8 +797,8 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len)
if ((payload >= param_low) && (payload <= param_high)) {
Settings.param[pindex] = payload;
switch (pindex) {
case P_RGB_REMAP:
LightUpdateColorMapping();
case P_RGB_REMAP:
LightUpdateColorMapping();
break;
}
}

View File

@ -1764,7 +1764,7 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
0, // GPIO09 (SD_DATA2 Flash QIO or ESP8285)
0, // GPIO10 (SD_DATA3 Flash QIO or ESP8285)
// GPIO11 (SD_CMD Flash)
GPIO_LED1, // GPIO12 Green LED - Link status
GPIO_LED1_INV, // GPIO12 Green LED - Link status
GPIO_LED2, // GPIO13 Red LED - Power status
0, 0, 0, 0
},

View File

@ -86,8 +86,6 @@ struct LCwColor {
#define MAX_FIXED_COLD_WARM 4
const LCwColor kFixedColdWarm[MAX_FIXED_COLD_WARM] PROGMEM = { 0,0, 255,0, 0,255, 128,128 };
uint8_t color_remap[5];
uint8_t ledTable[] = {
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@ -111,6 +109,7 @@ uint8_t light_current_color[5];
uint8_t light_new_color[5];
uint8_t light_last_color[5];
uint8_t light_signal_color[5];
uint8_t light_color_remap[5];
uint8_t light_wheel = 0;
uint8_t light_subtype = 0;
@ -576,25 +575,25 @@ void LightUpdateColorMapping(void)
param = 119;
}
uint8_t tmp[] = {0,1,2,3,4};
color_remap[0] = tmp[param / 24];
light_color_remap[0] = tmp[param / 24];
for (uint8_t i = param / 24; i<4; ++i){
tmp[i] = tmp[i+1];
}
param = param % 24;
color_remap[1] = tmp[(param / 6)];
light_color_remap[1] = tmp[(param / 6)];
for (uint8_t i = param / 6; i<3; ++i){
tmp[i] = tmp[i+1];
}
param = param % 6;
color_remap[2] = tmp[(param / 2)];
light_color_remap[2] = tmp[(param / 2)];
for (uint8_t i = param / 2; i<2; ++i){
tmp[i] = tmp[i+1];
}
param = param % 2;
color_remap[3] = tmp[param];
color_remap[4] = tmp[1-param];
light_color_remap[3] = tmp[param];
light_color_remap[4] = tmp[1-param];
//snprintf_P(log_data, sizeof(log_data), "%d colors: %d %d %d %d %d",Settings.param[P_RGB_REMAP], color_remap[0],color_remap[1],color_remap[2],color_remap[3],color_remap[4]);
//snprintf_P(log_data, sizeof(log_data), "%d colors: %d %d %d %d %d",Settings.param[P_RGB_REMAP], light_color_remap[0],light_color_remap[1],light_color_remap[2],light_color_remap[3],light_color_remap[4]);
//AddLog(LOG_LEVEL_DEBUG);
}
@ -1001,7 +1000,7 @@ void LightAnimate(void)
uint8_t orig_col[5];
memcpy(orig_col, cur_col, sizeof(orig_col));
for (uint8_t i = 0; i < 5; i++) {
cur_col[i] = orig_col[color_remap[i]];
cur_col[i] = orig_col[light_color_remap[i]];
}
for (uint8_t i = 0; i < light_subtype; i++) {
@ -1253,7 +1252,11 @@ bool LightColorEntry(char *buffer, uint8_t buffer_length)
entry_type = 2; // Decimal
}
else if (((2 * light_subtype) == buffer_length) || (buffer_length > 3)) { // Hexadecimal entry
for (uint8_t i = 0; i < buffer_length / 2; i++) {
uint8_t limit = buffer_length / 2;
if (limit > sizeof(light_entry_color)) { // Fix buffer overflow due to too many parameters
limit = sizeof(light_entry_color);
}
for (uint8_t i = 0; i < limit; i++) {
strlcpy(scolor, buffer + (i *2), 3);
light_entry_color[i] = (uint8_t)strtol(scolor, &p, 16);
}