diff -r bee2600d3d30 -r 5874a6480322 thermferm/thermferm.c --- a/thermferm/thermferm.c Wed Aug 13 20:47:00 2014 +0200 +++ b/thermferm/thermferm.c Wed Aug 13 21:04:29 2014 +0200 @@ -735,6 +735,22 @@ unit->cooler_state = 0; device_out(unit->cooler_address, unit->cooler_state); } + if (unit->heater_address && unit->cooler_address && unit->fan_address) { + /* + * If the temperature difference between air and beer is more then + * xxx degrees, turn the fan on to make an airflow. + * Maybe, run the fan too if the heater is on because the heater in + * most cases will be some sort of radiating heat device. + * For cooling ??? dunno yet. + */ + if (((unit->air_temperature - unit->beer_temperature) > 1000) || + ((unit->air_temperature - unit->beer_temperature) < -1000)) { + unit->fan_state = 100; + } else { + unit->fan_state = 0; + } + device_out(unit->fan_address, unit->fan_state); + } } else { err = 0.0; unit->PID_I_err = 0.0;