mirror of
https://github.com/esphome/esphome.git
synced 2026-09-17 18:18:43 +00:00
Merge remote-tracking branch 'origin/light-effect-index-codegen' into integration
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
|
||||
#include "esphome/core/hal.h"
|
||||
#include "esphome/core/helpers.h"
|
||||
#include "esphome/core/progmem.h"
|
||||
#include <strings.h>
|
||||
#include <vector>
|
||||
|
||||
@@ -220,10 +221,10 @@ class LightState : public EntityBase, public Component {
|
||||
|
||||
/// Get effect index by name (const char* overload, avoids std::string construction).
|
||||
uint32_t get_effect_index(const char *name, size_t len) const {
|
||||
StringRef ref(name, len);
|
||||
if (str_equals_case_insensitive(ref, StringRef("none", 4))) {
|
||||
if (len == 4 && ESPHOME_strncasecmp_P(name, ESPHOME_PSTR("none"), 4) == 0) {
|
||||
return 0;
|
||||
}
|
||||
StringRef ref(name, len);
|
||||
for (size_t i = 0; i < this->effects_.size(); i++) {
|
||||
if (str_equals_case_insensitive(ref, this->effects_[i]->get_name())) {
|
||||
return i + 1;
|
||||
|
||||
Reference in New Issue
Block a user