MCPcopy Create free account
hub / github.com/CalcProgrammer1/OpenRGB / SetColor

Method SetColor

Controllers/PhilipsHueController/PhilipsHueController.cpp:46–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46void PhilipsHueController::SetColor(unsigned char red, unsigned char green, unsigned char blue)
47{
48 hueplusplus::RGB rgb;
49 rgb.r = red;
50 rgb.g = green;
51 rgb.b = blue;
52
53 if((red == 0) && (green == 0) && (blue == 0))
54 {
55 if(!dark)
56 {
57 try
58 {
59 light.setColorRGB(rgb, 0);
60 }
61 catch(const std::exception& e)
62 {
63 LOG_ERROR("[PhilipsHueController] An error occured while setting the colors: %s", e.what());
64 }
65 }
66
67 dark = true;
68 }
69 else
70 {
71 dark = false;
72
73 try
74 {
75 light.setColorRGB(rgb, 0);
76 }
77 catch(std::exception& e)
78 {
79 LOG_ERROR("[PhilipsHueController] An error occured while setting the colors: %s", e.what());
80 }
81 }
82}

Callers 2

DeviceUpdateLEDsMethod · 0.45
DeviceUpdateLEDsMethod · 0.45

Calls 2

setColorRGBMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected