Skip to content

Commit 39f4152

Browse files
P-R-O-C-H-YCopilot
andauthored
Apply suggestions from code review
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent c6b6023 commit 39f4152

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

libraries/Zigbee/keywords.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,4 +343,7 @@ ZIGBEE_COLOR_CAPABILITY_HUE_SATURATION LITERAL1
343343
ZIGBEE_COLOR_CAPABILITY_ENHANCED_HUE LITERAL1
344344
ZIGBEE_COLOR_CAPABILITY_COLOR_LOOP LITERAL1
345345
ZIGBEE_COLOR_CAPABILITY_X_Y LITERAL1
346-
ZIGBEE_COLOR_CAPABILITY_COLOR_TEMP LITERAL1
346+
ZIGBEE_COLOR_CAPABILITY_COLOR_TEMP LITERAL1
347+
ZIGBEE_COLOR_MODE_HUE_SATURATION LITERAL1
348+
ZIGBEE_COLOR_MODE_CURRENT_X_Y LITERAL1
349+
ZIGBEE_COLOR_MODE_TEMPERATURE LITERAL1

libraries/Zigbee/src/ep/ZigbeeColorDimmableLight.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,8 +423,8 @@ bool ZigbeeColorDimmableLight::setLightColor(espHsvColor_t hsv_color) {
423423
lightChangedHsv();
424424

425425
// Clamp hue and saturation to valid Zigbee range (0-254, where 254 = 0xFE is max per ZCL spec)
426-
uint8_t hue = std::min(std::max((uint8_t)hsv_color.h, (uint8_t)0), (uint8_t)254);
427-
uint8_t saturation = std::min(std::max((uint8_t)hsv_color.s, (uint8_t)0), (uint8_t)254);
426+
uint8_t hue = std::clamp((uint8_t)hsv_color.h, (uint8_t)0, (uint8_t)254);
427+
uint8_t saturation = std::clamp((uint8_t)hsv_color.s, (uint8_t)0, (uint8_t)254);
428428

429429
log_v("Updating light HSV: H=%d, S=%d, V=%d (level=%d)", hue, saturation, hsv_color.v, _current_level);
430430
/* Update light clusters */

0 commit comments

Comments
 (0)