Merge pull request #6092 from s-hadinger/fix_6091

Xiaomi Philips brightness (#6091)
This commit is contained in:
Theo Arends 2019-07-14 14:15:46 +02:00 committed by GitHub
commit d26e037ce9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 5 deletions

View File

@ -12,6 +12,7 @@
* Add Epoch and UptimeSec to JSON messages (#6068) * Add Epoch and UptimeSec to JSON messages (#6068)
* Add support for up to 4 INA219 sensors (#6046) * Add support for up to 4 INA219 sensors (#6046)
* Fix WeMo emulation for 1G echo and 2G echo dot (#6086) * Fix WeMo emulation for 1G echo and 2G echo dot (#6086)
* Fix Xiaomi Philips brightness (#6091)
* *
* 6.6.0 20190707 * 6.6.0 20190707
* Remove support of TLS on core 2.3.0 and extent support on core 2.4.2 and up * Remove support of TLS on core 2.3.0 and extent support on core 2.4.2 and up

View File

@ -1807,14 +1807,18 @@ void LightAnimate(void)
if (PHILIPS == my_module_type) { if (PHILIPS == my_module_type) {
// Xiaomi Philips bulbs follow a different scheme: // Xiaomi Philips bulbs follow a different scheme:
// channel 0=intensity, channel2=temperature uint8_t cold; // channel 1 is the color tone, mapped to cold channel (0..255)
uint16_t pxBri = cur_col[0] + cur_col[1]; light_state.getCW(&cold, nullptr);
if (pxBri > 255) { pxBri = 255; } cur_col[1] = cold;
//cur_col[1] = cur_col[0]; // get 8 bits CT from WC -- not really used cur_col_10bits[1] = changeUIntScale(cur_col[1], 0, 255, 0, 1023);
cur_col_10bits[1] = changeUIntScale(cur_col[0], 0, pxBri, 0, 1023); // get 10 bits CT from WC / (WC+WW) // now set channel 0 to overall brightness
uint8_t pxBri = light_state.getBriCT();
// channel 0=intensity, channel1=temperature
if (Settings.light_correction) { // gamma correction if (Settings.light_correction) { // gamma correction
cur_col[0] = ledGamma(pxBri);
cur_col_10bits[0] = ledGamma(pxBri, 10); // 10 bits gamma correction cur_col_10bits[0] = ledGamma(pxBri, 10); // 10 bits gamma correction
} else { } else {
cur_col[0] = pxBri;
cur_col_10bits[0] = changeUIntScale(pxBri, 0, 255, 0, 1023); // no gamma, extend to 10 bits cur_col_10bits[0] = changeUIntScale(pxBri, 0, 255, 0, 1023); // no gamma, extend to 10 bits
} }
} else { // PHILIPS != my_module_type } else { // PHILIPS != my_module_type