Instructions

The main loop of this program senses the temperature and stored charge once per
second, and consults two functions fan_needed and fan_notneeded to decide
whether the fan is needed or not. The logic inside these functions could have been
used directly without a function, but using a function makes it easier for you to fine
tune this detection logic independently of the main program. Both functions return a
TRUE or a FALSE depending on the desired outcome.
The fan_needed function decides that the cooling fan is needed only when there
is sufficient stored charge in your Solar Store to allow the fan to run for a long time,
as well as it being hot enough to need some cooling action.
The fan_notneeded function decides that the cooling fan is not needed if the
charge is running low, or if it is no longer hot. Notice also that in the main program
the fan_needed function is called first and the fan_notneeded function is called
in the 'else' part of the code, and due to the different thresholds checked, this
implements the hysteresis shown earlier.
Buttons A and B are provided for an override that allows you to request the fan
manually. Press B to override, and press A to cancel the override. There must be
enough stored charge before the override will work though.
By splitting the program into little sections like this, you can easily change how it
decides if the fan is needed or not, and change what happens when the fan is
turned on and off, without disturbing the main program.
Page 32