mirror of
https://github.com/esphome/esphome.git
synced 2025-09-14 01:02:19 +01:00
Remove double scheduling from addressable lights (#1963)
This commit is contained in:
@@ -20,13 +20,12 @@ void FastLEDLightOutput::dump_config() {
|
||||
ESP_LOGCONFIG(TAG, " Num LEDs: %u", this->num_leds_);
|
||||
ESP_LOGCONFIG(TAG, " Max refresh rate: %u", *this->max_refresh_rate_);
|
||||
}
|
||||
void FastLEDLightOutput::loop() {
|
||||
if (!this->should_show_())
|
||||
return;
|
||||
|
||||
uint32_t now = micros();
|
||||
void FastLEDLightOutput::write_state(light::LightState *state) {
|
||||
// protect from refreshing too often
|
||||
uint32_t now = micros();
|
||||
if (*this->max_refresh_rate_ != 0 && (now - this->last_refresh_) < *this->max_refresh_rate_) {
|
||||
// try again next loop iteration, so that this change won't get lost
|
||||
this->schedule_show();
|
||||
return;
|
||||
}
|
||||
this->last_refresh_ = now;
|
||||
|
@@ -213,7 +213,7 @@ class FastLEDLightOutput : public light::AddressableLight {
|
||||
}
|
||||
void setup() override;
|
||||
void dump_config() override;
|
||||
void loop() override;
|
||||
void write_state(light::LightState *state) override;
|
||||
float get_setup_priority() const override { return setup_priority::HARDWARE; }
|
||||
|
||||
void clear_effect_data() override {
|
||||
|
Reference in New Issue
Block a user