1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-28 08:02:23 +01:00

Migrate ESPColor to Color (#1551)

* Migrate ESPColor to Color

* color.h constructor fix

* Updated componets to use Color
Added a using for ESPColor

* Lint fixes

* Fixed value error

* Update display components to use colorutil

* Updated to latest PR comments

* Fixed COLOR_WHITE

* Moved esp_scale to color_utils

* Rename color_utils to display_color_utils
This commit is contained in:
SenexCrenshaw
2021-03-02 09:08:57 -05:00
committed by GitHub
parent b17e0c298e
commit ac25b138f5
25 changed files with 272 additions and 369 deletions

View File

@@ -40,11 +40,11 @@ void WLEDLightEffect::stop() {
void WLEDLightEffect::blank_all_leds_(light::AddressableLight &it) {
for (int led = it.size(); led-- > 0;) {
it[led].set(light::ESPColor::BLACK);
it[led].set(COLOR_BLACK);
}
}
void WLEDLightEffect::apply(light::AddressableLight &it, const light::ESPColor &current_color) {
void WLEDLightEffect::apply(light::AddressableLight &it, const Color &current_color) {
// Init UDP lazily
if (!udp_) {
udp_.reset(new WiFiUDP());
@@ -152,7 +152,7 @@ bool WLEDLightEffect::parse_warls_frame_(light::AddressableLight &it, const uint
uint8_t b = payload[3];
if (led < max_leds) {
it[led].set(light::ESPColor(r, g, b));
it[led].set(Color(r, g, b));
}
}
@@ -174,7 +174,7 @@ bool WLEDLightEffect::parse_drgb_frame_(light::AddressableLight &it, const uint8
uint8_t b = payload[2];
if (led < max_leds) {
it[led].set(light::ESPColor(r, g, b));
it[led].set(Color(r, g, b));
}
}
@@ -197,7 +197,7 @@ bool WLEDLightEffect::parse_drgbw_frame_(light::AddressableLight &it, const uint
uint8_t w = payload[3];
if (led < max_leds) {
it[led].set(light::ESPColor(r, g, b, w));
it[led].set(Color(r, g, b, w));
}
}
@@ -228,7 +228,7 @@ bool WLEDLightEffect::parse_dnrgb_frame_(light::AddressableLight &it, const uint
uint8_t b = payload[2];
if (led < max_leds) {
it[led].set(light::ESPColor(r, g, b));
it[led].set(Color(r, g, b));
}
}

View File

@@ -18,7 +18,7 @@ class WLEDLightEffect : public light::AddressableLightEffect {
public:
void start() override;
void stop() override;
void apply(light::AddressableLight &it, const light::ESPColor &current_color) override;
void apply(light::AddressableLight &it, const Color &current_color) override;
void set_port(uint16_t port) { this->port_ = port; }
protected: