Suggested Modification

2008-05-07
2013-04-16
  • I am using the settings

      Level=66 128
      Level=68 3
      Level=70 4
      Level=72 5
      Level=74 6
      Level=76 7

    to have the BIOS handle the default situation but full FAN if needed. The current code does not work with these settings, so I modified the faulty method. Here is the modified code:

    //-------------------------------------------------------------------------
    //  smart fan control depending on temperature
    //-------------------------------------------------------------------------
    int
    FANCONTROL::SmartControl(void)
    {
        int ok= 0, i,
            newfanctrl= -1,   
            fanctrl= this->State.FanCtrl;   

        // if currently auto force initial fan speed according to rules
        if ((fanctrl & 0x80)!=0 && this->PreviousMode==1) { 
            fanctrl= -1;
            newfanctrl= 0;
        }

        // check for fan-up
        for (i= 0; this->SmartLevels[i].temp!=-1; i++) {
            if (this->MaxTemp>=this->SmartLevels[i].temp
                            // does not work with BIOS mode value 128, luckily it is not needed
                //&& this->SmartLevels[i].fan>fanctrl
                )
                newfanctrl= this->SmartLevels[i].fan;
        }
    /** the 2nd loop is superfluos /
        // not uptriggered check for downtrigger (previous level hit)
        if (newfanctrl==-1) {   
            for (i= 0; this->SmartLevels[i].temp!=-1; i++) {
                if (this->MaxTemp<=this->SmartLevels[i].temp && this->SmartLevels[i].fan<fanctrl) {
                    newfanctrl= this->SmartLevels[i].fan;
                    break;
                }
            }
        }
    /**/
        // fan speed needs change?
        if (newfanctrl!=-1 && newfanctrl!=fanctrl) {

            if (newfanctrl==0x80) { // switch to BIOS-auto mode
            //    this->ModeToDialog(1); // bios
            }
               
            ok= this->SetFan("Smart", newfanctrl);           
        }

        return ok;
    }

    Bebbo