mirror of https://github.com/arendst/Tasmota.git
Merge pull request #3787 from ascillato/patch-1
Add Support for Xiaomi-Phillips Bulbs
This commit is contained in:
commit
f5db9c20c0
|
@ -230,6 +230,7 @@ enum SupportedModules {
|
||||||
BLITZWOLF_BWSHP2,
|
BLITZWOLF_BWSHP2,
|
||||||
SHELLY1,
|
SHELLY1,
|
||||||
SHELLY2,
|
SHELLY2,
|
||||||
|
PHILIPS,
|
||||||
MAXMODULE };
|
MAXMODULE };
|
||||||
|
|
||||||
/********************************************************************************************/
|
/********************************************************************************************/
|
||||||
|
@ -399,7 +400,8 @@ const uint8_t kModuleNiceList[MAXMODULE] PROGMEM = {
|
||||||
KMC_70011,
|
KMC_70011,
|
||||||
AILIGHT,
|
AILIGHT,
|
||||||
WEMOS,
|
WEMOS,
|
||||||
WITTY
|
WITTY,
|
||||||
|
PHILIPS
|
||||||
};
|
};
|
||||||
|
|
||||||
// Default module settings
|
// Default module settings
|
||||||
|
@ -1044,6 +1046,14 @@ const mytmplt kModules[MAXMODULE] PROGMEM = {
|
||||||
GPIO_SWT2_NP, // GPIO14
|
GPIO_SWT2_NP, // GPIO14
|
||||||
0, // GPIO15 MCP39F501 Reset
|
0, // GPIO15 MCP39F501 Reset
|
||||||
0, 0
|
0, 0
|
||||||
|
},
|
||||||
|
{ "Xiaomi Philips", // Xiaomi Philips bulb (ESP8266)
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0,
|
||||||
|
GPIO_PWM2, // GPIO12 cold/warm light
|
||||||
|
0, 0,
|
||||||
|
GPIO_PWM1, // GPIO15 light intensity
|
||||||
|
0, 0
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -427,6 +427,11 @@ void LightSetColorTemp(uint16_t ct)
|
||||||
}
|
}
|
||||||
uint16_t icold = (100 * (347 - my_ct)) / 136;
|
uint16_t icold = (100 * (347 - my_ct)) / 136;
|
||||||
uint16_t iwarm = (100 * my_ct) / 136;
|
uint16_t iwarm = (100 * my_ct) / 136;
|
||||||
|
if (PHILIPS == Settings.module) {
|
||||||
|
// Xiaomi Philips bulbs follow a different scheme:
|
||||||
|
// channel 0=intensity, channel2=temperature
|
||||||
|
Settings.light_color[1] = (uint8_t)icold;
|
||||||
|
} else
|
||||||
if (LST_RGBWC == light_subtype) {
|
if (LST_RGBWC == light_subtype) {
|
||||||
Settings.light_color[0] = 0;
|
Settings.light_color[0] = 0;
|
||||||
Settings.light_color[1] = 0;
|
Settings.light_color[1] = 0;
|
||||||
|
@ -458,6 +463,15 @@ void LightSetDimmer(uint8_t myDimmer)
|
||||||
{
|
{
|
||||||
float temp;
|
float temp;
|
||||||
|
|
||||||
|
if (PHILIPS == Settings.module) {
|
||||||
|
// Xiaomi Philips bulbs use two PWM channels with a different scheme:
|
||||||
|
float dimmer = 100 / (float)myDimmer;
|
||||||
|
temp = (float)Settings.light_color[0] / dimmer; // channel 1 is intensity
|
||||||
|
light_current_color[0] = (uint8_t)temp;
|
||||||
|
temp = (float)Settings.light_color[1]; // channel 2 is temperature
|
||||||
|
light_current_color[1] = (uint8_t)temp;
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (LT_PWM1 == light_type) {
|
if (LT_PWM1 == light_type) {
|
||||||
Settings.light_color[0] = 255; // One PWM channel only supports Dimmer but needs max color
|
Settings.light_color[0] = 255; // One PWM channel only supports Dimmer but needs max color
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue