public void SetRGBW(RGBColor color, WhiteColor white, bool persist = true) { if (m_protocol == LedProtocolType.kLedNet_Original) { throw new InvalidOperationException("Bulb does not support Warm White settings"); } if (!m_rgbwprotocol) { throw new InvalidOperationException("Bulb does not support setting RGB and WW simultaneously"); } var bcolor = color.AsBytes(); var msg = GetColorSetMsg(persist, COLOR_AND_WHITE_WRITEMASK); msg[1] = bcolor.r; msg[2] = bcolor.g; msg[3] = bcolor.b; msg[4] = white.WarmWhite; if (m_protocol == LedProtocolType.kLedNet_9byte) { msg[5] = white.ColdWhite; } SendMsg(msg); UpdateState(); }
public void SetRGB(RGBColor color, bool persist = true) { var bcolor = color.AsBytes(); byte[] msg; if (m_protocol == LedProtocolType.kLedNet_Original) { msg = new byte[5]; msg[0] = 0x56; msg[1] = bcolor.r; msg[2] = bcolor.g; msg[3] = bcolor.b; msg[4] = 0xaa; } else { msg = GetColorSetMsg(persist, COLOR_ONLY_WRITEMASK); msg[1] = bcolor.r; msg[2] = bcolor.g; msg[3] = bcolor.b; } SendMsg(msg); UpdateState(); }