private void SetEffect(LedEffect effect) { var color = LedScoutColors.InitialColor; var interval = 0; switch (effect) { case LedEffect.None: break; case LedEffect.DroppingFast: interval = 100; color = LedScoutColors.StateColors[BloodSugarState.VeryLow]; break; case LedEffect.Dropping: interval = 250; color = LedScoutColors.StateColors[BloodSugarState.Low]; break; case LedEffect.Rising: interval = 250; color = LedScoutColors.StateColors[BloodSugarState.High]; break; case LedEffect.RisingFast: interval = 100; color = LedScoutColors.StateColors[BloodSugarState.VeryHigh]; break; } if (interval > 0) { LogitechGSDK.LogiLedFlashLighting( color.Red.ToPct(), color.Green.ToPct(), color.Blue.ToPct(), 3000, interval); Thread.Sleep(3100); } }
public void LedPattern(LedColor color, LedEffect effect) { int pattern = (int)color + (int)effect; byte[] cmd = new byte[2]; cmd [0] = (byte)('0' + pattern); dev.Write(cmd); }
public static LedConfigurationDto ToDto(this LedEffect ledConfig) { return(new LedConfigurationDto() { Id = ledConfig.Id.ToString(), Name = ledConfig.Name, Ordinal = ledConfig.Ordinal, UserId = ledConfig.UserId, LedEffect = JsonSerializer.Deserialize <LedEffectDto>(ledConfig.ConfigJson) }); }
public void AddLedConfig(Guid id, string userId, LedEffectDto ledEffect, string newName, int ordinal) { var ledConfig = new LedEffect { Id = id, UserId = userId, Name = newName, Version = 1, Ordinal = ordinal, ConfigJson = JsonSerializer.Serialize(ledEffect) }; _dbContext.LedConfigs.Add(ledConfig); _dbContext.SaveChanges(); }
public static bool SetColor(RGBSurface surface, string type, Color color, LedEffect effect = 0) { IList <Device> devices = GetDevices(surface, type); try { ILedGroup ledGroup = new ListLedGroup(surface.Leds); ledGroup.Brush = new SolidColorBrush(color); return(true); } catch (Exception e) { Console.WriteLine(e); return(false); } }
public void StartEffect(LedEffect effect) { _lastRenderTime = DateTime.UtcNow.AddDays(-1); CurrentEffect = effect ?? throw new ArgumentNullException(nameof(effect)); Console.WriteLine("Starting Effect " + CurrentEffect.Name); }
public void LedPattern(LedColor color, LedEffect effect) { }
public static void LedPattern(LedColor color, LedEffect effect) { Instance.LedPattern(color, effect); }