733 unit->cooler_state = 100; |
733 unit->cooler_state = 100; |
734 else |
734 else |
735 unit->cooler_state = 0; |
735 unit->cooler_state = 0; |
736 device_out(unit->cooler_address, unit->cooler_state); |
736 device_out(unit->cooler_address, unit->cooler_state); |
737 } |
737 } |
|
738 if (unit->heater_address && unit->cooler_address && unit->fan_address) { |
|
739 /* |
|
740 * If the temperature difference between air and beer is more then |
|
741 * xxx degrees, turn the fan on to make an airflow. |
|
742 * Maybe, run the fan too if the heater is on because the heater in |
|
743 * most cases will be some sort of radiating heat device. |
|
744 * For cooling ??? dunno yet. |
|
745 */ |
|
746 if (((unit->air_temperature - unit->beer_temperature) > 1000) || |
|
747 ((unit->air_temperature - unit->beer_temperature) < -1000)) { |
|
748 unit->fan_state = 100; |
|
749 } else { |
|
750 unit->fan_state = 0; |
|
751 } |
|
752 device_out(unit->fan_address, unit->fan_state); |
|
753 } |
738 } else { |
754 } else { |
739 err = 0.0; |
755 err = 0.0; |
740 unit->PID_I_err = 0.0; |
756 unit->PID_I_err = 0.0; |
741 unit->PID_err_old = 0.0; |
757 unit->PID_err_old = 0.0; |
742 } |
758 } |