thermferm/thermferm.c

changeset 233
5874a6480322
parent 227
1cb55ea51f76
child 234
b69438db19ec
--- 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;

mercurial