Fix White blend mode #7325

This commit is contained in:
Hadinger 2019-12-26 22:07:29 +01:00
parent 655cbefe3d
commit 6ebe7b219b
1 changed files with 6 additions and 5 deletions

View File

@ -1682,8 +1682,10 @@ void LightAnimate(void)
cur_col_10bits[i] = changeUIntScale(cur_col_10bits[i] - min_rgb_10, 0, 1023, 0, adjust10);
cur_col[i] = changeUIntScale(cur_col[i] - min_rgb, 0, 255, 0, Settings.rgbwwTable[i]);
}
// compute the adjusted white levels for 10 and 8 bits
uint32_t white_10 = changeUIntScale(min_rgb_10, 0, 255, 0, Settings.rgbwwTable[3]); // set white power down corrected with rgbwwTable[3]
uint32_t adjust_w_10 = changeUIntScale(Settings.rgbwwTable[3], 0, 255, 0, 1023);
uint32_t white_10 = changeUIntScale(min_rgb_10, 0, 1023, 0, adjust_w_10); // set white power down corrected with rgbwwTable[3]
uint32_t white = changeUIntScale(min_rgb, 0, 255, 0, Settings.rgbwwTable[3]); // set white power down corrected with rgbwwTable[3]
if (LST_RGBW == Light.subtype) {
// we simply set the white channel
@ -1863,8 +1865,9 @@ void LightSetOutputs(const uint8_t *cur_col, const uint16_t *cur_col_10bits) {
}
}
}
// AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("LGT: R %02X(%d) G %02X(%d) B %02X(%d), CW %02X(%d) WW %02x(%d), D %d"),
// cur_col[0], cur_col_10bits[0], cur_col[1], cur_col_10bits[1], cur_col[2], cur_col_10bits[2], cur_col[3], cur_col_10bits[3], cur_col[4], cur_col_10bits[4], light_state.getDimmer());
char msg[24];
AddLog_P2(LOG_LEVEL_DEBUG, PSTR("LGT: Channels %s"),
ToHex_P((const unsigned char *)cur_col_10bits, 10, msg, sizeof(msg)));
// Some devices need scaled RGB like Sonoff L1
// TODO, should be probably moved to the Sonoff L1 support code
@ -1873,8 +1876,6 @@ void LightSetOutputs(const uint8_t *cur_col, const uint16_t *cur_col_10bits) {
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];
}
// AddLog_P2(LOG_LEVEL_DEBUG_MORE, PSTR("LGT: R%d(%d) G%d(%d) B%d(%d), C%d(%d) W%d(%d), D%d"),
// cur_col[0], scale_col[0], cur_col[1], scale_col[1], cur_col[2], scale_col[2], cur_col[3], scale_col[3], cur_col[4], scale_col[4], light_state.getDimmer());
char *tmp_data = XdrvMailbox.data;
char *tmp_topic = XdrvMailbox.topic;