thermferm/thermferm.c

changeset 319
8c454ec761a8
parent 318
aad7789a40f2
child 321
b95baa89c509
equal deleted inserted replaced
318:aad7789a40f2 319:8c454ec761a8
1416 if (Out >= 1) { 1416 if (Out >= 1) {
1417 if (unit->heater_wait < unit->heater_delay) { 1417 if (unit->heater_wait < unit->heater_delay) {
1418 unit->heater_wait++; 1418 unit->heater_wait++;
1419 syslog(LOG_NOTICE, "heater_wait + %d/%d", unit->heater_wait, unit->heater_delay); 1419 syslog(LOG_NOTICE, "heater_wait + %d/%d", unit->heater_wait, unit->heater_delay);
1420 } else { 1420 } else {
1421 if (! unit->heater_state) { 1421 int power = round(Out);
1422 syslog(LOG_NOTICE, "Heater Off => On"); 1422 if (unit->heater_state != power) {
1423 unit->heater_state = 100; 1423 syslog(LOG_NOTICE, "Heater %d%% => %d%%", unit->heater_state, power);
1424 unit->heater_state = power;
1424 } 1425 }
1425 } 1426 }
1426 } else { 1427 } else {
1427 if (unit->heater_wait > 0) { 1428 if (unit->heater_wait > 0) {
1428 unit->heater_wait--; 1429 unit->heater_wait--;
1440 if (Out <= -1) { 1441 if (Out <= -1) {
1441 if (unit->cooler_wait < unit->cooler_delay) { 1442 if (unit->cooler_wait < unit->cooler_delay) {
1442 unit->cooler_wait++; 1443 unit->cooler_wait++;
1443 syslog(LOG_NOTICE, "cooler_wait + %d/%d", unit->cooler_wait, unit->cooler_delay); 1444 syslog(LOG_NOTICE, "cooler_wait + %d/%d", unit->cooler_wait, unit->cooler_delay);
1444 } else { 1445 } else {
1445 if (! unit->cooler_state && ! unit->heater_state) { 1446 int power = round(0 - Out);
1446 syslog(LOG_NOTICE, "Cooler Off => On"); 1447 if (unit->cooler_state != power) {
1447 unit->cooler_state = 100; 1448 syslog(LOG_NOTICE, "Cooler %d%% => %d%%", unit->cooler_state, power);
1449 unit->cooler_state = power;
1448 } 1450 }
1449 } 1451 }
1450 } else { 1452 } else {
1451 if (unit->cooler_wait > 0) { 1453 if (unit->cooler_wait > 0) {
1452 unit->cooler_wait--; 1454 unit->cooler_wait--;

mercurial