diff --git a/tasmota/my_user_config.h b/tasmota/my_user_config.h index 8d4ac7e51..878c1a8ed 100644 --- a/tasmota/my_user_config.h +++ b/tasmota/my_user_config.h @@ -283,6 +283,7 @@ #define LIGHT_CHANNEL_MODE false // [SetOption68] Enable multi-channels PWM instead of Color PWM #define LIGHT_SLIDER_POWER false // [SetOption77] Do not power off if slider moved to far left #define LIGHT_ALEXA_CT_RANGE false // [SetOption82] Reduced CT range for Alexa +#define LIGHT_PWM_CT_MODE false // [SetOption92] Set PWM Mode from regular PWM to ColorTemp control (Xiaomi Philips ...) a.k.a. module 48 mode // -- Energy -------------------------------------- #define ENERGY_VOLTAGE_ALWAYS false // [SetOption21] Enable show voltage even if powered off diff --git a/tasmota/settings.h b/tasmota/settings.h index 7ea3b5e3e..ae9243c70 100644 --- a/tasmota/settings.h +++ b/tasmota/settings.h @@ -111,7 +111,7 @@ typedef union { // Restricted by MISRA-C Rule 18.4 bu uint32_t zigbee_distinct_topics : 1; // bit 7 (v8.1.0.10) - SetOption89 - Distinct MQTT topics per device for Zigbee (#7835) uint32_t only_json_message : 1; // bit 8 (v8.2.0.3) - SetOption90 - Disable non-json MQTT response uint32_t fade_at_startup : 1; // bit 9 (v8.2.0.3) - SetOption91 - Enable light fading at start/power on - uint32_t spare10 : 1; + uint32_t pwm_ct_mode : 1; // bit 10 () - SetOption92 - Set PWM Mode from regular PWM to ColorTemp control (Xiaomi Philips ...) uint32_t spare11 : 1; uint32_t spare12 : 1; uint32_t spare13 : 1; diff --git a/tasmota/settings.ino b/tasmota/settings.ino index 092289e09..f490f3eeb 100644 --- a/tasmota/settings.ino +++ b/tasmota/settings.ino @@ -947,6 +947,7 @@ void SettingsDefaultSet2(void) Settings.flag3.pwm_multi_channels = LIGHT_CHANNEL_MODE; Settings.flag3.slider_dimmer_stay_on = LIGHT_SLIDER_POWER; Settings.flag4.alexa_ct_range = LIGHT_ALEXA_CT_RANGE; + Settings.flag4.pwm_ct_mode = LIGHT_PWM_CT_MODE; Settings.pwm_frequency = PWM_FREQ; Settings.pwm_range = PWM_RANGE; diff --git a/tasmota/xdrv_04_light.ino b/tasmota/xdrv_04_light.ino index 80bfd01d8..a229d4d93 100644 --- a/tasmota/xdrv_04_light.ino +++ b/tasmota/xdrv_04_light.ino @@ -1996,7 +1996,7 @@ bool isChannelGammaCorrected(uint32_t channel) { if (!Settings.light_correction) { return false; } // Gamma correction not activated if (channel >= Light.subtype) { return false; } // Out of range #ifdef ESP8266 - if (PHILIPS == my_module_type) { + if ((PHILIPS == my_module_type) || (Settings.flag4.pwm_ct_mode)) { if ((LST_COLDWARM == Light.subtype) && (1 == channel)) { return false; } // PMW reserved for CT if ((LST_RGBCW == Light.subtype) && (4 == channel)) { return false; } // PMW reserved for CT } @@ -2007,7 +2007,7 @@ bool isChannelGammaCorrected(uint32_t channel) { // is the channel a regular PWM or ColorTemp control bool isChannelCT(uint32_t channel) { #ifdef ESP8266 - if (PHILIPS == my_module_type) { + if ((PHILIPS == my_module_type) || (Settings.flag4.pwm_ct_mode)) { if ((LST_COLDWARM == Light.subtype) && (1 == channel)) { return true; } // PMW reserved for CT if ((LST_RGBCW == Light.subtype) && (4 == channel)) { return true; } // PMW reserved for CT } @@ -2191,7 +2191,7 @@ void calcGammaBulbs(uint16_t cur_col_10[5]) { uint16_t white_bri10_1023 = (white_bri10 > 1023) ? 1023 : white_bri10; // max 1023 #ifdef ESP8266 - if (PHILIPS == my_module_type) { // channel 1 is the color tone, mapped to cold channel (0..255) + if ((PHILIPS == my_module_type) || (Settings.flag4.pwm_ct_mode)) { // channel 1 is the color tone, mapped to cold channel (0..255) // Xiaomi Philips bulbs follow a different scheme: cur_col_10[cw1] = light_state.getCT10bits(); // channel 0=intensity, channel1=temperature