thermferm/one-wire.c

changeset 724
01e3936f62d4
parent 715
f5d85af156ab
child 728
da038d0bed04
equal deleted inserted replaced
723:99e3e6971f97 724:01e3936f62d4
95 95
96 96
97 97
98 void *my_one_wire_loop(void *threadid) 98 void *my_one_wire_loop(void *threadid)
99 { 99 {
100 pid_t pid = gettid();
101
100 my_one_wire_state = 1; 102 my_one_wire_state = 1;
101 syslog(LOG_NOTICE, "Thread my_one_wire_loop started"); 103 syslog(LOG_NOTICE, "Thread my_one_wire_loop started, pid=%d", pid);
102 104
103 /* 105 /*
104 * Run the state machine 106 * Run the state machine
105 */ 107 */
106 one_wire(); 108 one_wire();
389 if ((fgets(buffer, 25, fp))) { 391 if ((fgets(buffer, 25, fp))) {
390 sscanf(buffer, "%d", &value); 392 sscanf(buffer, "%d", &value);
391 if (cur_w1->value != value) { 393 if (cur_w1->value != value) {
392 cur_w1->timestamp = time(NULL); 394 cur_w1->timestamp = time(NULL);
393 changed = true; 395 changed = true;
394 syslog(LOG_NOTICE, "One-wire device %s temperature read %d => %d", cur_w1->address, cur_w1->value, value); 396 if (debug)
397 syslog(LOG_NOTICE, "One-wire device %s temperature read %d => %d", cur_w1->address, cur_w1->value, value);
395 } 398 }
396 cur_w1->value = value; /* devices.c will pick this up */ 399 cur_w1->value = value; /* devices.c will pick this up */
397 } else { 400 } else {
398 syslog(LOG_NOTICE, "One-wire device %s temperature read error", cur_w1->address); 401 syslog(LOG_NOTICE, "One-wire device %s temperature read error", cur_w1->address);
399 } 402 }

mercurial