mirror of
https://github.com/arendst/Tasmota.git
synced 2025-04-24 23:07:17 +00:00
Fix L1 scaleup
This commit is contained in:
parent
04d744d7cc
commit
84d4362de9
@ -2220,31 +2220,34 @@ void LightSetOutputs(const uint16_t *cur_col_10) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
// char msg[24];
|
||||||
|
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("LGT: Channels %s"), ToHex_P((const unsigned char *)cur_col_10, 10, msg, sizeof(msg)));
|
||||||
|
|
||||||
// char msg[24];
|
// Some devices need scaled RGB like Sonoff L1
|
||||||
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("LGT: Channels %s"), ToHex_P((const unsigned char *)cur_col_10, 10, msg, sizeof(msg)));
|
// TODO, should be probably moved to the Sonoff L1 support code
|
||||||
|
uint32_t max = (cur_col_10[0] > cur_col_10[1] && cur_col_10[0] > cur_col_10[2]) ? cur_col_10[0] : (cur_col_10[1] > cur_col_10[2]) ? cur_col_10[1] : cur_col_10[2]; // 0..1023
|
||||||
|
uint8_t scale_col[3];
|
||||||
|
for (uint32_t i = 0; i < 3; i++) {
|
||||||
|
scale_col[i] = (0 == max) ? 255 : changeUIntScale(cur_col_10[i], 0, max, 0, 255);
|
||||||
|
}
|
||||||
|
// AddLog_P(LOG_LEVEL_DEBUG, PSTR("LGT: CurCol %03X %03X %03X, ScaleCol %02X %02X %02X, Max %02X"),
|
||||||
|
// cur_col_10[0], cur_col_10[1], cur_col_10[2], scale_col[0], scale_col[1], scale_col[2], max);
|
||||||
|
|
||||||
uint8_t cur_col[LST_MAX];
|
uint8_t cur_col[LST_MAX];
|
||||||
for (uint32_t i = 0; i < LST_MAX; i++) {
|
for (uint32_t i = 0; i < LST_MAX; i++) {
|
||||||
cur_col[i] = change10to8(cur_col_10[i]);
|
cur_col[i] = change10to8(cur_col_10[i]);
|
||||||
}
|
}
|
||||||
// Some devices need scaled RGB like Sonoff L1
|
|
||||||
// TODO, should be probably moved to the Sonoff L1 support code
|
|
||||||
uint8_t scale_col[3];
|
|
||||||
uint32_t max = (cur_col[0] > cur_col[1] && cur_col[0] > cur_col[2]) ? cur_col[0] : (cur_col[1] > cur_col[2]) ? cur_col[1] : cur_col[2]; // 0..255
|
|
||||||
for (uint32_t i = 0; i < 3; i++) {
|
|
||||||
scale_col[i] = (0 == max) ? 255 : (255 > max) ? changeUIntScale(cur_col[i], 0, max, 0, 255) : cur_col[i];
|
|
||||||
}
|
|
||||||
|
|
||||||
char *tmp_data = XdrvMailbox.data;
|
char *tmp_data = XdrvMailbox.data;
|
||||||
char *tmp_topic = XdrvMailbox.topic;
|
char *tmp_topic = XdrvMailbox.topic;
|
||||||
XdrvMailbox.data = (char*)cur_col;
|
XdrvMailbox.data = (char*)cur_col;
|
||||||
XdrvMailbox.topic = (char*)scale_col;
|
XdrvMailbox.topic = (char*)scale_col;
|
||||||
if (XlgtCall(FUNC_SET_CHANNELS)) { /* Serviced */ }
|
if (XlgtCall(FUNC_SET_CHANNELS)) { /* Serviced */ }
|
||||||
else if (XdrvCall(FUNC_SET_CHANNELS)) { /* Serviced */ }
|
else if (XdrvCall(FUNC_SET_CHANNELS)) { /* Serviced */ }
|
||||||
XdrvMailbox.data = tmp_data;
|
XdrvMailbox.data = tmp_data;
|
||||||
XdrvMailbox.topic = tmp_topic;
|
XdrvMailbox.topic = tmp_topic;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Just apply basic Gamma to each channel
|
// Just apply basic Gamma to each channel
|
||||||
|
Loading…
x
Reference in New Issue
Block a user