thermferm/one-wire.c

changeset 715
f5d85af156ab
parent 712
93a87fe230cc
child 724
01e3936f62d4
--- a/thermferm/one-wire.c	Tue Apr 30 17:26:41 2024 +0200
+++ b/thermferm/one-wire.c	Wed May 01 14:38:37 2024 +0200
@@ -181,13 +181,7 @@
 			dev_w1->timestamp = time(NULL);
 			pthread_mutex_unlock(&mutexes[LOCK_ONE_WIRE]);
 			changed = true;
-			for (device = Config.devices; device; device = device->next) {
-			    if (strcmp(dev_w1->address, device->address) == 0) {
-//				pthread_mutex_lock(&mutexes[LOCK_DEVICES]);
-				device->present = DEVPRESENT_YES;
-//				pthread_mutex_unlock(&mutexes[LOCK_DEVICES]);
-			    }
-			}
+			device_present(dev_w1->address, DEVPRESENT_YES);
 		    }
 		    break;
 		}
@@ -248,14 +242,7 @@
 	    dev_w1->timestamp = time(NULL);
 	    pthread_mutex_unlock(&mutexes[LOCK_ONE_WIRE]);
 	    changed = true;
-	    for (device = Config.devices; device; device = device->next) {
-		if (strcmp(dev_w1->address, device->address) == 0) {
-//		    pthread_mutex_lock(&mutexes[LOCK_DEVICES]);
-		    device->present = DEVPRESENT_NO;
-		     syslog(LOG_NOTICE, "One-wire device %s marked device %s not present", dev_w1->address, device->address);
-//		    pthread_mutex_unlock(&mutexes[LOCK_DEVICES]);
-		}
-	    }
+	    device_present(dev_w1->address, DEVPRESENT_NO);
 	}
 	free(devfile);
 	devfile = NULL;

mercurial