thermferm/devices.c

changeset 588
322a29000fd7
parent 587
b8580eedfcc7
child 589
230a502b75ec
--- a/thermferm/devices.c	Sun Apr 28 16:27:54 2019 +0200
+++ b/thermferm/devices.c	Sun Apr 28 17:03:45 2019 +0200
@@ -734,7 +734,7 @@
 #endif
 
     /*
-     * Set the temperature sensors to 12 bits resolution.
+     * Set the temperature sensors to 12 bits resolution and write it in EEPROM
      */
     for (device = Config.devices; device; device = device->next) {
 	if ((device->type == DEVTYPE_W1) &&
@@ -747,12 +747,10 @@
             addr = xstrcat(addr, device->address);
             addr = xstrcat(addr, (char *)"/w1_slave");
             if ((fp = fopen(addr, "w"))) {
-		rc = fprintf(fp, "12\n0\n");
+		rc = fprintf(fp, "12\n0\n");	// According to the kernel documentation. Seems to work.
 		fclose(fp);
-		if (rc == 5) {
-		    syslog(LOG_NOTICE, "written 12 bits setting to %s", addr);
-		} else {
-		    syslog(LOG_NOTICE, "error rc=%d for %s", rc, addr);
+		if (rc != 5) {
+		    syslog(LOG_NOTICE, "Program 12 bits resolution error rc=%d for %s", rc, addr);
                 }
 	    }
 	    free(addr);

mercurial