Fix wrong CT channel for Module 48

This commit is contained in:
Hadinger 2020-02-01 14:23:13 +01:00
parent 42461aaaf3
commit 3b61d77680
1 changed files with 32 additions and 30 deletions

View File

@ -2030,7 +2030,7 @@ void calcGammaMultiChannels(uint16_t cur_col_10[5]) {
void calcGammaBulbs(uint16_t cur_col_10[5]) {
// Apply gamma correction for 8 and 10 bits resolutions, if needed
if (Settings.light_correction) {
// First apply combined correction to the overall white power
if ((LST_COLDWARM == Light.subtype) || (LST_RGBCW == Light.subtype)) {
// channels for white are always the last two channels
@ -2048,7 +2048,7 @@ void calcGammaBulbs(uint16_t cur_col_10[5]) {
} else {
cur_col_10[cw0] = white_bri10_1023; // no gamma, extend to 10 bits
}
} else {
} else if (Settings.light_correction) {
// if sum of both channels is > 255, then channels are probably uncorrelated
if (white_bri10 <= 1031) { // take a margin of 8 above 1023 to account for rounding errors
// we calculate the gamma corrected sum of CW + WW
@ -2062,6 +2062,8 @@ void calcGammaBulbs(uint16_t cur_col_10[5]) {
}
}
}
if (Settings.light_correction) {
// then apply gamma correction to RGB channels
if (LST_RGB <= Light.subtype) {
for (uint32_t i = 0; i < 3; i++) {
@ -2069,8 +2071,8 @@ void calcGammaBulbs(uint16_t cur_col_10[5]) {
}
}
// If RGBW or Single channel, also adjust White channel
if ((LST_COLDWARM != Light.subtype) && (LST_RGBCW != Light.subtype)) {
cur_col_10[3] = ledGamma10_10(cur_col_10[3]);
if ((LST_SINGLE == Light.subtype) || (LST_RGBW == Light.subtype)) {
cur_col_10[Light.subtype - 1] = ledGamma10_10(cur_col_10[Light.subtype - 1]);
}
}
}