Remove double scheduling from addressable lights (#1963)

This commit is contained in:
Oxan van Leeuwen
2021-08-23 20:00:38 +12:00
committed by GitHub
parent 5ec9bb0fb5
commit 2f33cd2db5
12 changed files with 57 additions and 45 deletions
@@ -12,8 +12,7 @@ void AddressableLight::call_setup() {
#ifdef ESPHOME_LOG_HAS_VERY_VERBOSE
this->set_interval(5000, [this]() {
const char *name = this->state_parent_ == nullptr ? "" : this->state_parent_->get_name().c_str();
ESP_LOGVV(TAG, "Addressable Light '%s' (effect_active=%s next_show=%s)", name, YESNO(this->effect_active_),
YESNO(this->next_show_));
ESP_LOGVV(TAG, "Addressable Light '%s' (effect_active=%s)", name, YESNO(this->effect_active_));
for (int i = 0; i < this->size(); i++) {
auto color = this->get(i);
ESP_LOGVV(TAG, " [%2d] Color: R=%3u G=%3u B=%3u W=%3u", i, color.get_red_raw(), color.get_green_raw(),
@@ -36,7 +35,7 @@ Color esp_color_from_light_color_values(LightColorValues val) {
return Color(r, g, b, w);
}
void AddressableLight::write_state(LightState *state) {
void AddressableLight::update_state(LightState *state) {
auto val = state->current_values;
auto max_brightness = to_uint8_scale(val.get_brightness() * val.get_state());
this->correction_.set_local_brightness(max_brightness);