public List<VideoCard> GetVideoCards(ref string strError) { List<VideoCard> cards = new List<VideoCard>(); int index = 0; NvidiaGroup gpus = new NvidiaGroup(); foreach (NvidiaGPU gpu in gpus.Hardware) { gpu.Update(); index++; VideoCard card = new VideoCard(); card.Name = gpu.Name; card.Number = index; foreach (Sensor sensor in gpu.Sensors) { if (sensor.SensorType == SensorType.Temperature) card.TemperatureSensors.Add(sensor); else if (sensor.SensorType == SensorType.Control) card.FanSensors.Add(sensor); else if (sensor.SensorType == SensorType.Clock) card.ClockSensors.Add(sensor); } cards.Add(card); } return cards; }
public void RefreshCard(VideoCard card) { string strError = string.Empty; SettingCall settingsCall = new SettingCall(); Settings settings = settingsCall.GetSettings(ref strError); ; nvidiaCard = card; int temp = Convert.ToInt32(card.TemperatureSensors[0].Value); Color clr = Color.White; if (temp < 70) clr = Color.Green; else if (temp >= 70 && temp < 90) clr = Color.Orange; else if (temp >= 90) clr = Color.Red; lblNumber.Text = card.Number.ToString(); lblName.Text = card.Name; lblTemp.Text = card.TemperatureSensors[0].Value.ToString() + "°C"; lblClockSpeed.Text = Convert.ToInt32(card.ClockSensors[0].Value).ToString() + " MHz"; lblTemp.ForeColor = clr; if (!cbxFanSpeed.DroppedDown) //We don't want to add the fan % if this is dropped down because then the user will have a hard time selecting a new value cbxFanSpeed.Text = card.FanSensors[0].Value.ToString() + "%"; if (settings.Options.IsTempProtectionActivated) { if (TemperatureRun > 0) TemperatureRun++; if (card.TemperatureSensors[0].Value >= settings.Options.TemperatureMax && !IsCoolingDown) { SendNotificationToTray("Temperature Protection", "Temperature threshold reached. The Fan will run at 100% for 3 minutes and then run at 50%."); nvidiaCard.FanSensors[0].Control.SetSoftware(100); IsCoolingDown = true; } else if (!settings.Options.IsTempProtectionActivated || card.TemperatureSensors[0].Value < settings.Options.TemperatureMax && TemperatureRun >= 180) //180 = 3 minutes. Let the fan run for 3 minutes { IsCoolingDown = false; TemperatureRun = 0; nvidiaCard.FanSensors[0].Control.SetSoftware(50); } } }