mirror of
https://github.com/arendst/Tasmota.git
synced 2025-04-24 14:57:16 +00:00
Fix L1 scaleup
This commit is contained in:
parent
04d744d7cc
commit
84d4362de9
@ -2220,22 +2220,24 @@ 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)));
|
||||
|
||||
// Some devices need scaled RGB like Sonoff L1
|
||||
// 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];
|
||||
for (uint32_t i = 0; i < LST_MAX; 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_topic = XdrvMailbox.topic;
|
||||
@ -2246,6 +2248,7 @@ void LightSetOutputs(const uint16_t *cur_col_10) {
|
||||
XdrvMailbox.data = tmp_data;
|
||||
XdrvMailbox.topic = tmp_topic;
|
||||
}
|
||||
}
|
||||
|
||||
// Just apply basic Gamma to each channel
|
||||
void calcGammaMultiChannels(uint16_t cur_col_10[5]) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user