private void bg_sensors_DoWork(object sender, DoWorkEventArgs e)
{
while (!bg_sensors.CancellationPending)
{
foreach (NvidiaGPU gpu in gpulist)
gpu.Update();
ovheat = false;
tempstat = "GPU: ";
int tmpcnt = 0;
foreach (Sensor temps in tempsensors)
{
if (temps.Index == 0 || (hightemp < temps.Value))
hightemp = (int)temps.Value;
if (temps.Value >= unsafetmp)
ovheat = true;
tempstat += temps.Value + "°C";
if (tempsensors.Count > 1 && tmpcnt++ < (tempsensors.Count - 1))
tempstat += " | ";
}
fanstat = "Fan: ";
int fancnt = 0;
foreach (Sensor fans in fansensors)
{
if (fans.Index == 0 || (fanspeed > fans.Value))
fanspeed = (int)fans.Value;
fanstat += fans.Value + "%";
if (fansensors.Count > 1 && fancnt++ < (fansensors.Count - 1))
fanstat += " | ";
}
bg_sensors.ReportProgress(1);
//save GPU from overheat
heatShield();
Thread.Sleep(500);
}
}