Merge pull request #7644 from s-hadinger/gamma_48

Fix wrong CT channel for Module 48
This commit is contained in:
Theo Arends 2020-02-01 19:06:44 +01:00 committed by GitHub
commit e498840ccf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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]) { void calcGammaBulbs(uint16_t cur_col_10[5]) {
// Apply gamma correction for 8 and 10 bits resolutions, if needed // Apply gamma correction for 8 and 10 bits resolutions, if needed
if (Settings.light_correction) {
// First apply combined correction to the overall white power // First apply combined correction to the overall white power
if ((LST_COLDWARM == Light.subtype) || (LST_RGBCW == Light.subtype)) { if ((LST_COLDWARM == Light.subtype) || (LST_RGBCW == Light.subtype)) {
// channels for white are always the last two channels // channels for white are always the last two channels
@ -2048,7 +2048,7 @@ void calcGammaBulbs(uint16_t cur_col_10[5]) {
} else { } else {
cur_col_10[cw0] = white_bri10_1023; // no gamma, extend to 10 bits 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 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 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 // 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 // then apply gamma correction to RGB channels
if (LST_RGB <= Light.subtype) { if (LST_RGB <= Light.subtype) {
for (uint32_t i = 0; i < 3; i++) { 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 RGBW or Single channel, also adjust White channel
if ((LST_COLDWARM != Light.subtype) && (LST_RGBCW != Light.subtype)) { if ((LST_SINGLE == Light.subtype) || (LST_RGBW == Light.subtype)) {
cur_col_10[3] = ledGamma10_10(cur_col_10[3]); cur_col_10[Light.subtype - 1] = ledGamma10_10(cur_col_10[Light.subtype - 1]);
} }
} }
} }