mirror of
https://github.com/esphome/esphome.git
synced 2024-11-10 01:07:45 +01:00
[esp32_rmt_led_strip] Check if `max_refresh_rate_
` actually has a value
This commit is contained in:
parent
3ba9caa118
commit
8d22cbeef5
2 changed files with 4 additions and 4 deletions
|
@ -1,5 +1,5 @@
|
||||||
#include <cinttypes>
|
|
||||||
#include "led_strip.h"
|
#include "led_strip.h"
|
||||||
|
#include <cinttypes>
|
||||||
|
|
||||||
#ifdef USE_ESP32
|
#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) {
|
void ESP32RMTLEDStripLightOutput::write_state(light::LightState *state) {
|
||||||
// protect from refreshing too often
|
// protect from refreshing too often
|
||||||
uint32_t now = micros();
|
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
|
// try again next loop iteration, so that this change won't get lost
|
||||||
this->schedule_show();
|
this->schedule_show();
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
import esphome.codegen as cg
|
|
||||||
import esphome.config_validation as cv
|
|
||||||
from esphome import pins
|
from esphome import pins
|
||||||
|
import esphome.codegen as cg
|
||||||
from esphome.components import esp32_rmt, light
|
from esphome.components import esp32_rmt, light
|
||||||
|
import esphome.config_validation as cv
|
||||||
from esphome.const import (
|
from esphome.const import (
|
||||||
CONF_CHIPSET,
|
CONF_CHIPSET,
|
||||||
CONF_IS_RGBW,
|
CONF_IS_RGBW,
|
||||||
|
|
Loading…
Reference in a new issue