nan0s7 / nfancurve

A small and lightweight POSIX script for using a custom fan curve in Linux for those with an Nvidia GPU.
GNU General Public License v3.0
314 stars 57 forks source link

BETA - New features "Equation-Mode" and "Smooth-Decrease" #46

Closed ThiloU closed 2 years ago

ThiloU commented 2 years ago

I always found it a bit annoying that you could hear the GPU changing fan speeds, because the values for the fan curve where to far apart. With these two features, which can be enabled optionaly, the fan speeds change very smoothly without the need to fill the fan curve with lots of values.

With "Equation-Mode" you can input an equation instead of manually defining values for the fan curve. To get an equation, you could for example use this interactive tool to get an exponential equation (Just put in a couple points and a fitting equation will be generated). The equation might look like this:9.6533531762886*1.0305283856818^$cur_t (where "$cur_t" represents the current GPU temperature). This way, the fan speed is smoothly calculated for every temperature change.

The other feature, "Smooth-Decrease" detects if the fan speed is currently decreasing. If it is, it lowers the fan speed by 1% every time the script checks the temperature until it reaches a defined value. If the fan speed starts rising, the fan curve / equation takes over again.

nan0s7 commented 2 years ago

Quite interesting! I wonder why you go for an exponential equation over something like a linear or polynomial one. Technically sh and other shells don't natively support decimal numbers (unless there's a new feature in one of them, I think zsh does though). I'll add it to master for now until I have some time to go over it and make sure everything is still compatible with sh.

Love that you've added these features though! I look forward to exploring them, and shall add you to the readme when I can! :)

ThiloU commented 2 years ago

Thanks for accepting my contributions! You are right, I probably should have mentioned that I used the bc command to do the calculations. I used an exponential equation because I felt that it worked best using my system.

nan0s7 commented 2 years ago

That's alright! I'll have a look at bc but it should be fine. Ideally it'd be self contained but I have some ideas on how to get around it. Yeah I guess it could depend on preference and curve values. Perhaps in the future it could be something people can choose between for their interpolation; linear, polynomial, exponential, etc. Shouldn't be too hard now that one of them is working.