mirror of
https://github.com/esphome/esphome.git
synced 2024-11-29 12:55:46 +01:00
[esp32_rmt_led_strip] Check if `max_refresh_rate_
` actually has a value
This commit is contained in:
parent
3ba9caa118
commit
8d22cbeef5
@ -1,5 +1,5 @@
|
||||
#include <cinttypes>
|
||||
#include "led_strip.h"
|
||||
#include <cinttypes>
|
||||
|
||||
#ifdef USE_ESP32
|
||||
|
||||
@ -84,7 +84,7 @@ void ESP32RMTLEDStripLightOutput::set_led_params(uint32_t bit0_high, uint32_t bi
|
||||
void ESP32RMTLEDStripLightOutput::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_) {
|
||||
if (this->max_refresh_rate_.has_value() && (now - this->last_refresh_) < this->max_refresh_rate_.value()) {
|
||||
// try again next loop iteration, so that this change won't get lost
|
||||
this->schedule_show();
|
||||
return;
|
||||
|
@ -1,9 +1,9 @@
|
||||
from dataclasses import dataclass
|
||||
|
||||
import esphome.codegen as cg
|
||||
import esphome.config_validation as cv
|
||||
from esphome import pins
|
||||
import esphome.codegen as cg
|
||||
from esphome.components import esp32_rmt, light
|
||||
import esphome.config_validation as cv
|
||||
from esphome.const import (
|
||||
CONF_CHIPSET,
|
||||
CONF_IS_RGBW,
|
||||
|
Loading…
Reference in New Issue
Block a user