Closed Centurio-Macro closed 2 years ago
Thanks for your contribution ! I've commented on the code itself, but feature wise, could you explain a bit why you think it is useful to have a different speed curve for AC/Battery ?
Two different fan profiles for charging/discharging allows for a different optimization goal of the fan curve. On discharging one could have fan curve optimized for low fan speeds in order to save power while accepting a bit more heat. On charging one could have a fan curve that focuses on keeping the CPU from throttling and the system cool, at the expense of fan noise. Somebody who is interested in custom fan curves might be interested in that additional customization aswell. One user stated explicitly the desire for separate fan curves. After announcing my changes, he answered shortly and made suggestions for improvements on my code.
This updated version enables the automatic switch between two different fan curves depending on whether the Laptop is charging or discharging. There are two new functions:
updateStrategy
andgetBatteryChargingStatus
. UpdateStrategy is called from once from init and regularly from run(). UpdateStrategy then calls getBatteryChargingStatus. getBatteryChargingStatus checks whether the charging status changed, compared to the last look up. It returns either no change, or the new charging status. updateStrategy only loads a new fan curve if the charging status changed. Theconfig.json file is only read once, during
init`. The config.json file contains a new key "strategyOnDischarging". The user is supposed to enter one of the defined fan curves which should be active during discharge. If no separate discharge strategy is specified, the tool uses the same strategy as for charging.Info: this is my first Github pull request. Any feedback is appreciated. Only the changes from 19.08.2022. are relevant. The ones from 18.08. are me fuzzing around.