1
0
mirror of https://github.com/esphome/esphome.git synced 2025-10-26 12:43:48 +00:00
This commit is contained in:
J. Nick Koston
2025-10-21 22:19:07 -10:00
parent 777e73fd04
commit c6711fc354
2 changed files with 9 additions and 0 deletions

View File

@@ -184,6 +184,12 @@ inline bool has_capability(const ColorModeMask &mask, ColorCapability capability
} // namespace esphome
// Template specializations for ColorMode must be in global namespace
//
// C++ requires template specializations to be declared in the same namespace as the
// original template. Since EnumBitmask is in the esphome namespace (not esphome::light),
// we must provide these specializations at global scope with fully-qualified names.
//
// These specializations define how ColorMode enum values map to/from bit positions.
/// Map ColorMode enum values to bit positions (0-9)
/// Bit positions follow the enum declaration order

View File

@@ -26,6 +26,9 @@ namespace esphome {
/// if (modes.contains(CLIMATE_MODE_HEAT)) { ... }
/// for (auto mode : modes) { ... } // Iterate over set bits
///
/// For complete usage examples with template specializations, see:
/// - esphome/components/light/color_mode.h (ColorMode example)
///
/// Design notes:
/// - Uses compile-time type selection for optimal size (uint8_t/uint16_t/uint32_t)
/// - Iterator converts bit positions to actual enum values during traversal