thermferm/units.c

changeset 170
3cb99272b84b
parent 164
f16def8472ba
child 175
b73490398368
--- a/thermferm/units.c	Fri Aug 01 14:45:32 2014 +0200
+++ b/thermferm/units.c	Fri Aug 01 16:13:55 2014 +0200
@@ -46,7 +46,7 @@
 	}
     }
 
-    return 1;
+    return DEVPRESENT_NO;
 }
 
 
@@ -103,7 +103,7 @@
 
 	    if (unit->air_address) {
 		rc = read_w1_28(unit->air_address, &temp);
-		if (rc == 2) {
+		if (rc == DEVPRESENT_YES) {
 		    /*
 		     * It is possible to have read errors or extreme values.
 		     * This can happen with bad connections so we compare the
@@ -123,7 +123,7 @@
 			    fprintf(stdout, "deviation error deviation=%d, old=%d new=%d\n", deviation, unit->air_temperature, temp);
 			}
 		    }
-		} else if (rc == 3) {
+		} else if (rc == DEVPRESENT_ERROR) {
 		    unit->air_state = 1;
 		} else {
 		    unit->air_state = 2;
@@ -134,7 +134,7 @@
 
 	    if (unit->beer_address) {
 		rc = read_w1_28(unit->beer_address, &temp);
-		if (rc == 2) {
+		if (rc == DEVPRESENT_YES) {
 		    deviation = 20000;
 		    if ((unit->beer_temperature == 0) ||
 		    	(unit->beer_temperature && (temp > (int)unit->beer_temperature - deviation) && (temp < ((int)unit->beer_temperature + deviation)))) {
@@ -146,7 +146,7 @@
 			    fprintf(stdout, "deviation error deviation=%d, old=%d new=%d\n", deviation, unit->beer_temperature, temp);
 		    	}
 		    }
-		} else if (rc == 3) {
+		} else if (rc == DEVPRESENT_ERROR) {
 		    unit->beer_state = 1;
 		} else {
 		    unit->beer_state = 2;

mercurial