1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-12 16:22:22 +01:00

Support HSV-based color support on tuya light (#2400)

* fix: stop tuya light state getting reset

* fix typo

* Support for HSV color in Tuya

* Clamp formatting
This commit is contained in:
irtimaled
2021-09-28 13:19:17 -07:00
committed by GitHub
parent af04f565cf
commit c39ac9edfe
5 changed files with 107 additions and 7 deletions

View File

@@ -149,6 +149,11 @@ std::array<uint8_t, 2> decode_uint16(uint16_t value);
/// Encode a 32-bit unsigned integer given four bytes in MSB -> LSB order
uint32_t encode_uint32(uint8_t msb, uint8_t byte2, uint8_t byte3, uint8_t lsb);
/// Convert RGB floats (0-1) to hue (0-360) & saturation/value percentage (0-1)
void rgb_to_hsv(float red, float green, float blue, int &hue, float &saturation, float &value);
/// Convert hue (0-360) & saturation/value percentage (0-1) to RGB floats (0-1)
void hsv_to_rgb(int hue, float saturation, float value, float &red, float &green, float &blue);
/***
* An interrupt helper class.
*