private void LJresetHandlers() { if (this.LJhandleHue != this.LJhandleFadeHue) { this.LJhandleHue = this.LJhandleDefaultHue; } this.LJhandleSaturation = this.LJhandleDefaultSaturation; this.LJhandleValue = this.LJhandleDefaultValue; }
private void LJSetStrobeSaturation(int Period) { if (this.LJStrobeSatTimebase.IsRunning == false) { this.LJStrobeSatTimebase.Restart(); } this.LJhandleValue = this.LJhandleStrobeSaturation; this.LJStrobeSatPeriod = Period; this.LJUpdateLEDs = true; }
private void LJFadeHue(int Period) { if ((this.LJFadeTimebase.IsRunning == false) || (this.LJFadePeriod != Period)) { this.LJFadePhase = (int)((double)Period * this.LJBaseColors[0].H / 360.0); this.LJFadeTimebase.Restart(); } this.LJhandleHue = this.LJhandleFadeHue; this.LJFadePeriod = Period; this.LJUpdateLEDs = true; }
private void LJSetConstantColor(double Hue) { this.LJhandleHue = this.LJHandleConstantColor; this.LJconstanHue = Hue; this.LJUpdateLEDs = true; }
private void HandleLJMode(List <LEDStrahler> StrahlerListe) { List <Key> PressedKeysClone = new List <Key>(this.PressedKeys); //Copy list this.UpdateLJBaseColorsList(StrahlerListe); //Reset handlers this.LJresetHandlers(); foreach (Key Taste in PressedKeysClone) { switch (Taste) { case Key.Q: //Set fixed color this.LJSetConstantColor(0.0); break; case Key.W: //Set fixed color this.LJSetConstantColor(36.0); break; case Key.E: //Set fixed color this.LJSetConstantColor(72.0); break; case Key.R: //Set fixed color this.LJSetConstantColor(108.0); break; case Key.T: //Set fixed color this.LJSetConstantColor(144.0); break; case Key.Z: //Set fixed color this.LJSetConstantColor(180.0); break; case Key.U: //Set fixed color this.LJSetConstantColor(216.0); break; case Key.I: //Set fixed color this.LJSetConstantColor(252.0); break; case Key.O: //Set fixed color this.LJSetConstantColor(288.0); break; case Key.P: //Set fixed color this.LJSetConstantColor(324.0); break; case Key.A: //Set color fading this.LJFadeHue(5000); break; case Key.S: //Set color fading this.LJFadeHue(10000); break; case Key.D: //Set color fading this.LJFadeHue(20000); break; case Key.F: //Set color fading this.LJFadeHue(30000); break; case Key.G: this.LJhandleValue = this.LJhandleLEDoff; break; case Key.H: this.LJSetStrobeSaturation(50); break; case Key.J: this.LJSetStrobeSaturation(100); break; case Key.K: //Set value strobing this.LJSetStrobeValue(50); break; case Key.L: //Set value strobing this.LJSetStrobeValue(100); break; case Key.Y: this.LJFadeUniform = false; break; case Key.X: this.LJFadeUniform = true; break; case Key.C: this.LJStrobeUniform = false; break; case Key.V: this.LJStrobeUniform = true; break; case Key.B: this.LJSetUniform = false; break; case Key.N: this.LJSetUniform = true; break; case Key.M: break; default: try { this.PressedKeys.Remove(Taste); } catch { //Do nothing in case of failure } break; } } //Handle fading and strobing this.LJhandleHue(); this.LJhandleSaturation(); this.LJhandleValue(); //Actually write stuff //Currently only implemented in broadcast mode if (this.LJUpdateLEDs == true) { ushort Hue = (ushort)(65535.0 * this.LJBaseColors[0].H / 360.0); ushort Saturation = (ushort)(65535.0 * this.LJBaseColors[0].S); ushort Value = (ushort)(65535.0 * this.LJBaseColors[0].V * (double)this.GUI.GroupControls[0].Backend.GetBrightnessScale()); LEDStrahlerSerial.SetHSV(0, Hue, Saturation, Value); } }