Exemple #1
0
        public void GetCurrentConfig(ref List <Color> colours,
                                     out ushort stepDuration,
                                     out bool breathingEnabled,
                                     out bool invertedRChannel,
                                     out bool invertedGChannel,
                                     out bool invertedBChannel,
                                     out FlashingSpeed flashingSpeed)
        {
            foreach (byte index in Range(1, 8))
            {
                Color c = _lighting.GetColour(index).Value;
                c.R *= 0x11; // Colour is exposed as 12-bit depth, but colour picker expects 24-bit depth
                c.G *= 0x11;
                c.B *= 0x11;
                colours.Add(c);
            }

            stepDuration = _lighting.GetStepDuration();

            breathingEnabled = _lighting.IsBreathingModeEnabled();

            invertedRChannel = _lighting.IsRChannelInverted();
            invertedGChannel = _lighting.IsGChannelInverted();
            invertedBChannel = _lighting.IsBChannelInverted();

            flashingSpeed = (FlashingSpeed)_lighting.GetFlashingSpeed();
        }
        public void ApplyConfig(List <Color> colours,
                                ushort stepDuration,
                                bool breathingEnabled,
                                FlashingSpeed flashingSpeed)
        {
            _lighting.BatchBegin();

            foreach (byte index in Range(1, 8))
            {
                Color c = colours[index - 1];
                c.R /= 0x11; // Colour must be passed with 12-bit depth
                c.G /= 0x11;
                c.B /= 0x11;
                _lighting.SetColour(index, c);
            }

            _lighting.SetStepDuration(stepDuration);

            // Since breathing mode can't be enabled if flashing was previously enabled
            // we need to set the new flashing speed setting before trying to change breathing mode state
            _lighting.SetFlashingSpeed((Lighting.FlashingSpeed)flashingSpeed);

            _lighting.SetBreathingModeEnabled(breathingEnabled);

            _lighting.BatchEnd();
        }
Exemple #3
0
        public void ApplyConfig(List <Color> colours,
                                ushort stepDuration,
                                bool breathingEnabled,
                                bool invertedRChannel,
                                bool invertedGChannel,
                                bool invertedBChannel,
                                FlashingSpeed flashingSpeed)
        {
            _lighting.BatchBegin();

            foreach (byte index in Range(1, 8))
            {
                Color c = colours[index - 1];
                c.R /= 0x11; // Colour must be passed with 12-bit depth
                c.G /= 0x11;
                c.B /= 0x11;

                if (invertedRChannel) // if inverting colour channels, transform colours from
                // colour picker appropriately (which are never inverted)
                {
                    c.R = (byte)(0x0F - c.R);
                }

                if (invertedGChannel)
                {
                    c.G = (byte)(0x0F - c.G);
                }

                if (invertedBChannel)
                {
                    c.B = (byte)(0x0F - c.B);
                }

                _lighting.SetColour(index, c);
            }

            _lighting.SetStepDuration(stepDuration);

            // Since breathing mode can't be enabled if flashing was previously enabled
            // we need to set the new flashing speed setting before trying to change breathing mode state
            _lighting.SetFlashingSpeed((Lighting.FlashingSpeed)flashingSpeed);

            _lighting.SetBreathingModeEnabled(breathingEnabled);

            _lighting.SetRChannelInverted(invertedRChannel);
            _lighting.SetGChannelInverted(invertedGChannel);
            _lighting.SetBChannelInverted(invertedBChannel);

            _lighting.BatchEnd();
        }