From cc6b798f2ba69bd01c9591dd3f7d6a044449be94 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 18 Oct 2025 13:15:47 -1000 Subject: [PATCH] overkill --- esphome/components/light/color_mode.h | 7 +++---- esphome/components/light/light_call.cpp | 11 +---------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/esphome/components/light/color_mode.h b/esphome/components/light/color_mode.h index 4fc65ac5f0..a91df200c9 100644 --- a/esphome/components/light/color_mode.h +++ b/esphome/components/light/color_mode.h @@ -209,17 +209,16 @@ class ColorModeMask { /// Build a bitmask of modes that match the given capability requirements /// @param require_caps Capabilities that must be present in the mode - /// @param exclude_caps Capabilities that must not be present in the mode (for none case) /// @return Raw bitmask value - static constexpr color_mode_bitmask_t build_mask_matching(uint8_t require_caps, uint8_t exclude_caps = 0) { + static constexpr color_mode_bitmask_t build_mask_matching(uint8_t require_caps) { color_mode_bitmask_t mask = 0; // Check each mode to see if it matches the requirements // Skip UNKNOWN (bit 0), iterate through actual color modes (bits 1-9) for (int bit = 1; bit < COLOR_MODE_COUNT; ++bit) { ColorMode mode = bit_to_mode(bit); uint8_t mode_val = static_cast(mode); - // Mode matches if it has all required caps and none of the excluded caps - if ((mode_val & require_caps) == require_caps && (mode_val & exclude_caps) == 0) { + // Mode matches if it has all required caps + if ((mode_val & require_caps) == require_caps) { mask |= (1 << bit); } } diff --git a/esphome/components/light/light_call.cpp b/esphome/components/light/light_call.cpp index fbc1b8f97d..036de98639 100644 --- a/esphome/components/light/light_call.cpp +++ b/esphome/components/light/light_call.cpp @@ -469,16 +469,7 @@ color_mode_bitmask_t LightCall::get_suitable_color_modes_mask_() { if (has_cwww) require_caps |= static_cast(ColorCapability::COLD_WARM_WHITE); - // If no specific color parameters set, exclude modes with color capabilities - uint8_t exclude_caps = 0; - if (!has_rgb && !has_white && !has_ct && !has_cwww) { - // For "none" case, we want all modes but don't exclude anything - // Just require ON_OFF + BRIGHTNESS which all modes have - return ColorModeMask::build_mask_matching( - static_cast(ColorCapability::ON_OFF | ColorCapability::BRIGHTNESS), exclude_caps); - } - - return ColorModeMask::build_mask_matching(require_caps, exclude_caps); + return ColorModeMask::build_mask_matching(require_caps); } LightCall &LightCall::set_effect(const std::string &effect) {