It appears that I wrote some script to adjust fan speed: https://raw.githubusercontent.com/Fourd ... et_cpu_fan
This was started work with XU4 fan interface: https://github.com/Fourdee/DietPi/issues/1818
Actually we wanted to add support for more devices, but it appears that the variety of CPU fan (PWM) control APIs is veeery large. Huge work, too much to achieve that currently. For this reason we did not yet implement it into DietPi, as long as XU4 is supported only. But as it fits perfect in your case, give it a try
Interesting that you use a different interface than me: /sys/devices/odroid_fan.*/temp_levels
I used according to the guide: /sys/devices/virtual/thermal/thermal_zone*/trip_point_[0-2]_temp
Perhaps the XU4 has different APIs for that? Was the same with some x86 PC, so could be.
So as far as I understood the API:
- /sys/devices/odroid_fan.*/temp_levels respectively /sys/devices/virtual/thermal/thermal_zone*/trip_point_[0-2]_temp is used to define the three temperature trip points. If they are reached, the CPU fan speed is increased to the desired speed, that you can configure for each trip point.
- Use /sys/devices/platform/pwm-fan/hwmon/hwmon0/fan_speed to apply the related trip fan speeds via values from 0 (0% PWM) to 255 (100% PWM). E.g.
First value is for temps below first temp point, second value after first temp point, third after second temp point, fourth after third temp point.
Code: Select all
echo '0 120 180 240' /sys/devices/platform/pwm-fan/hwmon/hwmon0/fan_speed
- /sys/devices/platform/pwm-fan/hwmon/hwmon0/automatic btw. needs to be value "1", but that should be default.
But I would like, if you test my script. Would be great if it could be debugged at least to work well with XU4. Also everything is well explained within whiptail GUI. To try it out:
Code: Select all
wget https://raw.githubusercontent.com/Fourdee/DietPi/dietpi-set_cpu_fan/dietpi/func/dietpi-set_cpu_fan -O /DietPi/dietpi/func/dietpi-set_cpu_fan
chmod +x /DietPi/dietpi/func/dietpi-set_cpu_fan
sed -i '\|/DietPi/dietpi/func/dietpi-set_cpu|a\\t\t/DietPi/dietpi/func/dietpi-set_cpu_fan 1 \&|' /DietPi/dietpi/preboot
This installs the script alls runs (reapplies) fan settings on boot.
To configure it: /DietPi/dietpi/func/dietpi-set_cpu_fan