예제 #1
0
        public void Initialise(int striplength = 0, bool isDebug = false, LightsConfiguration inputConfig = null)
        {
            debugmode = isDebug;

            if (inputConfig != null)
            {
                SetCurrentConfig(inputConfig);
            }

            if (striplength < 1)
            {
                foreach (LightChannel lc in LightChannels)
                {
                    striplength = Math.Max(striplength, lc.StripRangeEnd + 1);
                }
            }

            stripStack = new Colour[striplength];

            if (!debugmode)
            {
                strip = new LedStripOutput(striplength);
                strip.SetStrip(Colour.Blank());
            }

            currentPatternLayer = PatternLayers[0];

            fixedUpdateTimeDelta = (1000 / updatesPerSecond);
            Console.WriteLine($"Running at {updatesPerSecond} updates/sec ({fixedUpdateTimeDelta}ms frametime)");
            var bgtask = Task.Run(UpdateValues);
        }
예제 #2
0
 public void SetPatternLayer(int patternIndex)
 {
     if (patternIndex >= 0 && patternIndex < PatternLayers.Length)
     {
         currentPatternLayer = PatternLayers[patternIndex];
     }
     else
     {
         Console.WriteLine($"Can't change to pattern {patternIndex}");
     }
 }