mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-30 14:16:32 +00:00
parent
15419b3e51
commit
9f00978a79
@ -789,8 +789,7 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len)
|
|||||||
param_low = 1;
|
param_low = 1;
|
||||||
param_high = 250;
|
param_high = 250;
|
||||||
break;
|
break;
|
||||||
|
case P_RGB_REMAP:
|
||||||
case P_RGB_REMAP:
|
|
||||||
param_low = 0;
|
param_low = 0;
|
||||||
param_high = 119;
|
param_high = 119;
|
||||||
break;
|
break;
|
||||||
@ -798,8 +797,8 @@ void MqttDataHandler(char* topic, uint8_t* data, unsigned int data_len)
|
|||||||
if ((payload >= param_low) && (payload <= param_high)) {
|
if ((payload >= param_low) && (payload <= param_high)) {
|
||||||
Settings.param[pindex] = payload;
|
Settings.param[pindex] = payload;
|
||||||
switch (pindex) {
|
switch (pindex) {
|
||||||
case P_RGB_REMAP:
|
case P_RGB_REMAP:
|
||||||
LightUpdateColorMapping();
|
LightUpdateColorMapping();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,8 +86,6 @@ struct LCwColor {
|
|||||||
#define MAX_FIXED_COLD_WARM 4
|
#define MAX_FIXED_COLD_WARM 4
|
||||||
const LCwColor kFixedColdWarm[MAX_FIXED_COLD_WARM] PROGMEM = { 0,0, 255,0, 0,255, 128,128 };
|
const LCwColor kFixedColdWarm[MAX_FIXED_COLD_WARM] PROGMEM = { 0,0, 255,0, 0,255, 128,128 };
|
||||||
|
|
||||||
uint8_t color_remap[5];
|
|
||||||
|
|
||||||
uint8_t ledTable[] = {
|
uint8_t ledTable[] = {
|
||||||
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
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,
|
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_new_color[5];
|
||||||
uint8_t light_last_color[5];
|
uint8_t light_last_color[5];
|
||||||
uint8_t light_signal_color[5];
|
uint8_t light_signal_color[5];
|
||||||
|
uint8_t light_color_remap[5];
|
||||||
|
|
||||||
uint8_t light_wheel = 0;
|
uint8_t light_wheel = 0;
|
||||||
uint8_t light_subtype = 0;
|
uint8_t light_subtype = 0;
|
||||||
@ -576,25 +575,25 @@ void LightUpdateColorMapping(void)
|
|||||||
param = 119;
|
param = 119;
|
||||||
}
|
}
|
||||||
uint8_t tmp[] = {0,1,2,3,4};
|
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){
|
for (uint8_t i = param / 24; i<4; ++i){
|
||||||
tmp[i] = tmp[i+1];
|
tmp[i] = tmp[i+1];
|
||||||
}
|
}
|
||||||
param = param % 24;
|
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){
|
for (uint8_t i = param / 6; i<3; ++i){
|
||||||
tmp[i] = tmp[i+1];
|
tmp[i] = tmp[i+1];
|
||||||
}
|
}
|
||||||
param = param % 6;
|
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){
|
for (uint8_t i = param / 2; i<2; ++i){
|
||||||
tmp[i] = tmp[i+1];
|
tmp[i] = tmp[i+1];
|
||||||
}
|
}
|
||||||
param = param % 2;
|
param = param % 2;
|
||||||
color_remap[3] = tmp[param];
|
light_color_remap[3] = tmp[param];
|
||||||
color_remap[4] = tmp[1-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);
|
//AddLog(LOG_LEVEL_DEBUG);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1001,7 +1000,7 @@ void LightAnimate(void)
|
|||||||
uint8_t orig_col[5];
|
uint8_t orig_col[5];
|
||||||
memcpy(orig_col, cur_col, sizeof(orig_col));
|
memcpy(orig_col, cur_col, sizeof(orig_col));
|
||||||
for (uint8_t i = 0; i < 5; i++) {
|
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++) {
|
for (uint8_t i = 0; i < light_subtype; i++) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user