mirror of
https://github.com/esphome/esphome.git
synced 2025-10-11 06:13:47 +01:00
Migrate COLOR constants to Color class & disallow implicit conversions to Color (#2093)
Co-authored-by: Xo Wang <xo@geekshavefeelings.com>
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
namespace esphome {
|
||||
namespace light {
|
||||
|
||||
using ESPColor = Color;
|
||||
using ESPColor ESPDEPRECATED("esphome::light::ESPColor is deprecated, use esphome::Color instead.") = Color;
|
||||
|
||||
class AddressableLight : public LightOutput, public Component {
|
||||
public:
|
||||
|
@@ -151,7 +151,7 @@ class AddressableScanEffect : public AddressableLightEffect {
|
||||
void set_move_interval(uint32_t move_interval) { this->move_interval_ = move_interval; }
|
||||
void set_scan_width(uint32_t scan_width) { this->scan_width_ = scan_width; }
|
||||
void apply(AddressableLight &it, const Color ¤t_color) override {
|
||||
it.all() = COLOR_BLACK;
|
||||
it.all() = Color::BLACK;
|
||||
|
||||
for (auto i = 0; i < this->scan_width_; i++) {
|
||||
it[this->at_led_ + i] = current_color;
|
||||
@@ -201,7 +201,7 @@ class AddressableTwinkleEffect : public AddressableLightEffect {
|
||||
else
|
||||
view.set_effect_data(new_pos);
|
||||
} else {
|
||||
view = COLOR_BLACK;
|
||||
view = Color::BLACK;
|
||||
}
|
||||
}
|
||||
while (random_float() < this->twinkle_probability_) {
|
||||
@@ -272,7 +272,7 @@ class AddressableFireworksEffect : public AddressableLightEffect {
|
||||
explicit AddressableFireworksEffect(const std::string &name) : AddressableLightEffect(name) {}
|
||||
void start() override {
|
||||
auto &it = *this->get_addressable_();
|
||||
it.all() = COLOR_BLACK;
|
||||
it.all() = Color::BLACK;
|
||||
}
|
||||
void apply(AddressableLight &it, const Color ¤t_color) override {
|
||||
const uint32_t now = millis();
|
||||
|
Reference in New Issue
Block a user