public void UpdateSettings(FanSettings fs) { if (fc != null) { fc.UpdateSettings(fs); } }
static int CalculateFanSpeed(double motherboardtemp, double cputinavg, FanSettings fs) { const double DIV = 100.0 / 255; if (fs.AutoSpeed) { var OFFSET = motherboardtemp - 27; var SOFFSET = OFFSET * 2; var TOFFSET = OFFSET / 2; // max speed = 100% var speed = 0xff; // min speed = 35% var MINSPEED = Math.Max(45 / DIV, (fs.SpeedLow + SOFFSET) / DIV); var MAXSPEED = (fs.SpeedHigh) / DIV; var BOTTOMTEMP = fs.TempLow + TOFFSET; var TOPTEMP = fs.TempHigh; if (cputinavg < BOTTOMTEMP) { // min speed = 35% speed = (int)MINSPEED; } else if (cputinavg < TOPTEMP) { // from 45 - 70 deg slope from 35% - 100% speed = Math.Min(255, (int)(MINSPEED + (cputinavg - BOTTOMTEMP) * (MAXSPEED - MINSPEED) / (TOPTEMP - BOTTOMTEMP))); } return(speed); } else { return((int)(fs.SpeedManual / DIV)); } }
static int CalculateFanSpeed(double motherboardtemp, double cputinavg, FanSettings fs) { const double DIV = 100.0 / 255; if (fs.AutoSpeed) { var OFFSET = motherboardtemp - 27; var SOFFSET = OFFSET * 2; var TOFFSET = OFFSET / 2; // max speed = 100% var speed = 0xff; // min speed = 35% var MINSPEED = Math.Max(45/DIV, (fs.SpeedLow + SOFFSET)/ DIV); var MAXSPEED = (fs.SpeedHigh) / DIV; var BOTTOMTEMP = fs.TempLow + TOFFSET; var TOPTEMP = fs.TempHigh; if (cputinavg < BOTTOMTEMP) { // min speed = 35% speed = (int)MINSPEED; } else if (cputinavg < TOPTEMP) { // from 45 - 70 deg slope from 35% - 100% speed = Math.Min(255, (int)(MINSPEED + (cputinavg - BOTTOMTEMP) * (MAXSPEED - MINSPEED) / (TOPTEMP - BOTTOMTEMP))); } return speed; } else { return (int)(fs.SpeedManual / DIV); } }
public void UpdateSettings(FanSettings fs) { fansettings[fs.Name] = fs; }