first, the fan runs at full speed for 2.5sec to leave no doubts whether the PS is really on. Also, the Pin 10 and 13 LED does 2 fast and one slow blink. This is to make sure the code got uploaded alright. After that, the Pin 10 and 13 LEDs are constantly on.
Then, both the load share voltage and the temp probe voltage are sampled 4 times each with 500ms in between, and the average is calculated to remove fluctuation influences a bit. The fan speed setting is updated every 2sec.
I then have defined a low threshold for both load and temp:
5A
60°C
Below this, the fan runs at idle speed.
The high thresholds are:
~60A
70°C
Between the low and high thresholds, the fan's speed is increased in a linear manner.
Above the high thresholds, the fan runs at max power.
Also, if both criterions demand a different fan speed, maybe because the load is low but the temperature is high, or vice versa, always the higher fan speed is chosen.
If the temperature is above 75°C, the Pin 10 and 13 LEDs flash at 1Hz.