mirror of
https://github.com/esphome/esphome.git
synced 2025-10-22 11:43:51 +01:00
Merge branch 'light_effects_fixed_vector' into integration
This commit is contained in:
@@ -177,9 +177,10 @@ void LightState::set_gamma_correct(float gamma_correct) { this->gamma_correct_ =
|
|||||||
void LightState::set_restore_mode(LightRestoreMode restore_mode) { this->restore_mode_ = restore_mode; }
|
void LightState::set_restore_mode(LightRestoreMode restore_mode) { this->restore_mode_ = restore_mode; }
|
||||||
void LightState::set_initial_state(const LightStateRTCState &initial_state) { this->initial_state_ = initial_state; }
|
void LightState::set_initial_state(const LightStateRTCState &initial_state) { this->initial_state_ = initial_state; }
|
||||||
bool LightState::supports_effects() { return !this->effects_.empty(); }
|
bool LightState::supports_effects() { return !this->effects_.empty(); }
|
||||||
const std::vector<LightEffect *> &LightState::get_effects() const { return this->effects_; }
|
const FixedVector<LightEffect *> &LightState::get_effects() const { return this->effects_; }
|
||||||
void LightState::add_effects(const std::vector<LightEffect *> &effects) {
|
void LightState::add_effects(const std::vector<LightEffect *> &effects) {
|
||||||
this->effects_.reserve(this->effects_.size() + effects.size());
|
// Called once from Python codegen during setup with all effects from YAML config
|
||||||
|
this->effects_.init(effects.size());
|
||||||
for (auto *effect : effects) {
|
for (auto *effect : effects) {
|
||||||
this->effects_.push_back(effect);
|
this->effects_.push_back(effect);
|
||||||
}
|
}
|
||||||
|
@@ -11,7 +11,7 @@
|
|||||||
#include "light_traits.h"
|
#include "light_traits.h"
|
||||||
#include "light_transformer.h"
|
#include "light_transformer.h"
|
||||||
|
|
||||||
#include <vector>
|
#include "esphome/core/helpers.h"
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
|
|
||||||
namespace esphome {
|
namespace esphome {
|
||||||
@@ -159,7 +159,7 @@ class LightState : public EntityBase, public Component {
|
|||||||
bool supports_effects();
|
bool supports_effects();
|
||||||
|
|
||||||
/// Get all effects for this light state.
|
/// Get all effects for this light state.
|
||||||
const std::vector<LightEffect *> &get_effects() const;
|
const FixedVector<LightEffect *> &get_effects() const;
|
||||||
|
|
||||||
/// Add effects for this light state.
|
/// Add effects for this light state.
|
||||||
void add_effects(const std::vector<LightEffect *> &effects);
|
void add_effects(const std::vector<LightEffect *> &effects);
|
||||||
@@ -260,7 +260,7 @@ class LightState : public EntityBase, public Component {
|
|||||||
/// The currently active transformer for this light (transition/flash).
|
/// The currently active transformer for this light (transition/flash).
|
||||||
std::unique_ptr<LightTransformer> transformer_{nullptr};
|
std::unique_ptr<LightTransformer> transformer_{nullptr};
|
||||||
/// List of effects for this light.
|
/// List of effects for this light.
|
||||||
std::vector<LightEffect *> effects_;
|
FixedVector<LightEffect *> effects_;
|
||||||
/// Object used to store the persisted values of the light.
|
/// Object used to store the persisted values of the light.
|
||||||
ESPPreferenceObject rtc_;
|
ESPPreferenceObject rtc_;
|
||||||
/// Value for storing the index of the currently active effect. 0 if no effect is active
|
/// Value for storing the index of the currently active effect. 0 if no effect is active
|
||||||
|
@@ -12,7 +12,7 @@ platformio==6.1.18 # When updating platformio, also update /docker/Dockerfile
|
|||||||
esptool==5.1.0
|
esptool==5.1.0
|
||||||
click==8.1.7
|
click==8.1.7
|
||||||
esphome-dashboard==20251013.0
|
esphome-dashboard==20251013.0
|
||||||
aioesphomeapi==41.16.1
|
aioesphomeapi==41.17.0
|
||||||
zeroconf==0.148.0
|
zeroconf==0.148.0
|
||||||
puremagic==1.30
|
puremagic==1.30
|
||||||
ruamel.yaml==0.18.15 # dashboard_import
|
ruamel.yaml==0.18.15 # dashboard_import
|
||||||
|
Reference in New Issue
Block a user