コード例 #1
0
ファイル: LightControl.cs プロジェクト: Alix1723/WhipFlash
        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
ファイル: LightControl.cs プロジェクト: Alix1723/WhipFlash
 public void SetPatternLayer(int patternIndex)
 {
     if (patternIndex >= 0 && patternIndex < PatternLayers.Length)
     {
         currentPatternLayer = PatternLayers[patternIndex];
     }
     else
     {
         Console.WriteLine($"Can't change to pattern {patternIndex}");
     }
 }