thermferm/devices.c

changeset 671
b2e2cbb13cb3
parent 661
8c1e7a52e24f
child 672
0c2c66920d79
--- a/thermferm/devices.c	Thu Apr 11 11:19:04 2024 +0200
+++ b/thermferm/devices.c	Thu Apr 11 13:18:20 2024 +0200
@@ -236,7 +236,7 @@
 {
     devices_list	*device;
     time_t		now, my_timestamp;
-    int			rc, my_value, test_value;
+    int			my_value, test_value;
 #ifdef HAVE_WIRINGPI_H
     int			i;
     char		buf[40];
@@ -296,30 +296,30 @@
 			 * the "other" PIO channel. To make things a bit more complicated
 			 * the bits in the state register differ from the output register.
 			 */
-			uint8_t	state, output;
+//			uint8_t	state, output;
 
-			if ((rc = read_w1(device->address, (char *)"state")) >= 0) {
-			    state = (unsigned int)rc;
-			    output = (state & 0x01) + ((state & 0x04) >> 1);
+//			if ((rc = read_w1(device->address, (char *)"state")) >= 0) {
+//			    state = (unsigned int)rc;
+//			    output = (state & 0x01) + ((state & 0x04) >> 1);
 
-			    if (device->subdevice == 0) {
-				output = (output & 0xfe);
-				output |= (value == 0) ? 0x01 : 0x00;
-			    } else if (device->subdevice == 1) {
-				output = (output & 0xfd);
-				output |= (value == 0) ? 0x02 : 0x00;
-			    } else {
-				output = 0xff;
-			    }
+//			    if (device->subdevice == 0) {
+//				output = (output & 0xfe);
+//				output |= (value == 0) ? 0x01 : 0x00;
+//			    } else if (device->subdevice == 1) {
+//				output = (output & 0xfd);
+//				output |= (value == 0) ? 0x02 : 0x00;
+//			    } else {
+//				output = 0xff;
+//			    }
 
-			    if ((write_w1(device->address, (char *)"output", output)) == 0) {
+//			    if ((write_w1(device->address, (char *)"output", output)) == 0) {
 			    	syslog(LOG_NOTICE, "DS2413 PIO%c value=%d (%s)", (device->subdevice == 0) ? 'A' : 'B', (value == 0) ? 0 : 1, device->comment);
 //				pthread_mutex_lock(&mutexes[LOCK_DEVICES]);
 				device->value = (value == 0) ? 0 : 1;
 				device->timestamp = time(NULL);
 //				pthread_mutex_unlock(&mutexes[LOCK_DEVICES]);
-			    }
-			}
+//			    }
+//			}
 		    }
 		}
 

mercurial