File tree Expand file tree Collapse file tree 3 files changed +18
-1
lines changed
components/led/lightbulb_driver Expand file tree Collapse file tree 3 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 11# ChangeLog
22
3+ ## v1.3.2 - 2024-09-19
4+
5+ ### Enhancements:
6+
7+ * Added cct range check in precision mode
8+
39## v1.3.1 - 2024-08-28
410
511### Bug Fixes:
Original file line number Diff line number Diff line change 1- version : " 1.3.1 "
1+ version : " 1.3.2 "
22description : Provide multiple dimming driver solutions to easily build lightbulb applications
33url : https://github.com/espressif/esp-iot-solution/tree/master/components/led/lightbulb_driver
44dependencies :
Original file line number Diff line number Diff line change @@ -254,6 +254,14 @@ static uint8_t standard_kelvin_convert_to_percentage(uint16_t kelvin)
254254 */
255255static uint8_t precise_kelvin_convert_to_percentage (uint16_t kelvin )
256256{
257+ // Ensure the input kelvin value is within the specified range
258+ if (kelvin > s_lb_obj -> cct_manager .kelvin_range .max ) {
259+ kelvin = s_lb_obj -> cct_manager .kelvin_range .max ;
260+ }
261+ if (kelvin < s_lb_obj -> cct_manager .kelvin_range .min ) {
262+ kelvin = s_lb_obj -> cct_manager .kelvin_range .min ;
263+ }
264+
257265 // Ensure the input kelvin value is within the specified range
258266 lightbulb_cct_mapping_data_t data ;
259267 data = search_mapping_cct_data (kelvin );
@@ -842,6 +850,9 @@ esp_err_t lightbulb_init(lightbulb_config_t *config)
842850 s_lb_obj -> cct_manager .mix_table = calloc (s_lb_obj -> cct_manager .table_size , sizeof (lightbulb_cct_mapping_data_t ));
843851 LIGHTBULB_CHECK (s_lb_obj -> cct_manager .mix_table , "calloc fail" , goto EXIT );
844852
853+ s_lb_obj -> cct_manager .kelvin_range .min = config -> cct_mix_mode .precise .table [0 ].cct_kelvin ;
854+ s_lb_obj -> cct_manager .kelvin_range .max = config -> cct_mix_mode .precise .table [config -> cct_mix_mode .precise .table_size - 1 ].cct_kelvin ;
855+
845856 for (int i = 0 ; i < s_lb_obj -> cct_manager .table_size ; i ++ ) {
846857 memcpy (& s_lb_obj -> cct_manager .mix_table [i ], & config -> cct_mix_mode .precise .table [i ], sizeof (lightbulb_cct_mapping_data_t ));
847858 }
You can’t perform that action at this time.
0 commit comments