1430 } |
1430 } |
1431 } |
1431 } |
1432 } |
1432 } |
1433 device_out(unit->cooler_address, unit->cooler_state); |
1433 device_out(unit->cooler_address, unit->cooler_state); |
1434 } |
1434 } |
1435 if (unit->heater_address && unit->cooler_address && unit->fan_address) { |
1435 |
|
1436 if ((unit->heater_address || unit->cooler_address) && unit->fan_address) { |
1436 /* |
1437 /* |
1437 * If the temperature difference between air and beer is more then |
1438 * If there is a heater or cooler and we have a fan, turn fan on if |
1438 * xxx degrees, turn the fan on to make an airflow. |
1439 * cooling or heating. |
1439 * Maybe, run the fan too if the heater is on because the heater in |
|
1440 * most cases will be some sort of radiating heat device. |
|
1441 * For cooling ??? dunno yet. |
|
1442 */ |
1440 */ |
1443 if (((unit->air_temperature - unit->beer_temperature) > 1000) || |
1441 if ((unit->heater_address && unit->heater_state) || (unit->cooler_address && unit->cooler_state)) { |
1444 ((unit->air_temperature - unit->beer_temperature) < -1000)) { |
|
1445 if (! unit->fan_state) |
1442 if (! unit->fan_state) |
1446 syslog(LOG_NOTICE, "Fan Off => On"); |
1443 syslog(LOG_NOTICE, "Fan Off => On"); |
1447 unit->fan_state = 100; |
1444 unit->fan_state = 100; |
1448 } else { |
1445 } else { |
1449 if (unit->fan_state) |
1446 if (unit->fan_state) |
1450 syslog(LOG_NOTICE, "Fan On => Off"); |
1447 syslog(LOG_NOTICE, "Fan On => Off"); |
1451 unit->fan_state = 0; |
1448 unit->fan_state = 0; |
1452 } |
1449 } |
1453 device_out(unit->fan_address, unit->fan_state); |
1450 device_out(unit->fan_address, unit->fan_state); |
1454 } |
1451 } |
|
1452 |
1455 } else { |
1453 } else { |
1456 P_err = 0.0; |
1454 P_err = 0.0; |
1457 unit->PID_iState = 0.0; |
1455 unit->PID_iState = 0.0; |
1458 unit->PID_dState = 0.0; |
1456 unit->PID_dState = 0.0; |
1459 } |
1457 } |