#+TITLE: PiFanControlTUI #+AUTHOR: A simple TUI to set your RPi5 fan curve. * Install This #TODO: now its not packaged, package it. * Workings This project's backend works by setting the following dtparams in =/boot/firmware/config.txt=. Settings require reboot to work. The RaspberryPi 5 firmware supports up to 4 different [[https://github.com/raspberrypi/firmware/blob/4aa2a51fecb99ce16fe591391f6779174b9b5bea/boot/overlays/README#L271][thresholds]]. The backend validates the new config and only if valid it writes it to disk. Each threshold is defined by: 1. *fan_tempN*: temperature fan activates at in millicelsius 2. *fan_tempN_hyst*: fan turns off (or to lower setting) when temperature is =fan_tempN - fan_tempN_hyst=. Also in millicelsius 3. *fan_tempN_speed*: fan speed in range [0, 255] where 255 is 100% fan speed An example of the additions to your =/boot/firmware/config.txt:= #+begin_src diff [all] + # Auto-Generated Fan Curve parameters by PiFanUI + dtparam=fan_temp0=55000,fan_temp0_hyst=2000,fan_temp0_speed=90 + dtparam=fan_temp1=65000,fan_temp1_hyst=3000,fan_temp1_speed=160 + dtparam=fan_temp2=70000,fan_temp2_hyst=4000,fan_temp2_speed=200 + dtparam=fan_temp3=72000,fan_temp3_hyst=5000,fan_temp3_speed=255 #+end_src ** Defaults The following are the default values used by the firmware: #+begin_src txt fan_temp0 Temperature threshold (in millicelcius) for 1st cooling level (default 50000). fan_temp0_hyst Temperature hysteresis (in millicelcius) for 1st cooling level (default 5000). fan_temp0_speed Fan PWM setting for 1st cooling level (0-255, default 75). fan_temp1 Temperature threshold (in millicelcius) for 2nd cooling level (default 60000). fan_temp1_hyst Temperature hysteresis (in millicelcius) for 2nd cooling level (default 5000). fan_temp1_speed Fan PWM setting for 2nd cooling level (0-255, default 125). fan_temp2 Temperature threshold (in millicelcius) for 3rd cooling level (default 67500). fan_temp2_hyst Temperature hysteresis (in millicelcius) for 3rd cooling level (default 5000). fan_temp2_speed Fan PWM setting for 3rd cooling level (0-255, default 175). fan_temp3 Temperature threshold (in millicelcius) for 4th cooling level (default 75000). fan_temp3_hyst Temperature hysteresis (in millicelcius) for 4th cooling level (default 5000). fan_temp3_speed Fan PWM setting for 4th cooling level (0-255, default 250). #+end_src ** Future Work - [ ] add TUI - [ ] add =-d, --dry-run= flag that generates a =.diff= file instead of modifying config - [ ] support partial threshold definitions