cct

How to get XY value from ct in Philips Hue?

纵饮孤独 提交于 2020-12-13 03:13:49
问题 How to get XY value from ct. Ex: ct = 217, I want to get x="0.3127569", y= "0.32908". I'm able to convert XY value into ct value using this below code. float R1 = [hue[0] floatValue]; float S1 = [hue[1] floatValue]; float result = ((R1-0.332)/(S1-0.1858)); NSString *ctString = [NSString stringWithFormat:@"%f", ((-449*result*result*result)+(3525*result*result)-(6823.3*result)+(5520.33))]; float micro2 = (float) (1 / [ctString floatValue] * 1000000); NSString *ctValue = [NSString

How to get XY value from ct in Philips Hue?

妖精的绣舞 提交于 2020-12-13 03:11:17
问题 How to get XY value from ct. Ex: ct = 217, I want to get x="0.3127569", y= "0.32908". I'm able to convert XY value into ct value using this below code. float R1 = [hue[0] floatValue]; float S1 = [hue[1] floatValue]; float result = ((R1-0.332)/(S1-0.1858)); NSString *ctString = [NSString stringWithFormat:@"%f", ((-449*result*result*result)+(3525*result*result)-(6823.3*result)+(5520.33))]; float micro2 = (float) (1 / [ctString floatValue] * 1000000); NSString *ctValue = [NSString