Fri, 05 Apr 2024 19:30:41 +0200
Version 0.9.17a2. Disabled a lot of mutex locks, some are blocking and need to be fixed. This version seems to be working, more or less.
configure | file | annotate | diff | comparison | revisions | |
configure.ac | file | annotate | diff | comparison | revisions | |
thermferm/devices.c | file | annotate | diff | comparison | revisions | |
thermferm/one-wire.c | file | annotate | diff | comparison | revisions | |
thermferm/thermferm.c | file | annotate | diff | comparison | revisions |
--- a/configure Fri Apr 05 16:19:39 2024 +0200 +++ b/configure Fri Apr 05 19:30:41 2024 +0200 @@ -2037,7 +2037,7 @@ PACKAGE="mbsePi-apps" -VERSION="0.9.17a1" +VERSION="0.9.17a2" COPYRIGHT="Copyright (C) 2014-2024 Michiel Broek, All Rights Reserved" CYEARS="2014-2024"
--- a/configure.ac Fri Apr 05 16:19:39 2024 +0200 +++ b/configure.ac Fri Apr 05 19:30:41 2024 +0200 @@ -8,7 +8,7 @@ dnl General settings dnl After changeing the version number, run autoconf! PACKAGE="mbsePi-apps" -VERSION="0.9.17a1" +VERSION="0.9.17a2" COPYRIGHT="Copyright (C) 2014-2024 Michiel Broek, All Rights Reserved" CYEARS="2014-2024" AC_SUBST(PACKAGE)
--- a/thermferm/devices.c Fri Apr 05 16:19:39 2024 +0200 +++ b/thermferm/devices.c Fri Apr 05 19:30:41 2024 +0200 @@ -246,7 +246,7 @@ return 0; now = time(NULL); - pthread_mutex_lock(&mutexes[LOCK_DEVICES]); +// pthread_mutex_lock(&mutexes[LOCK_DEVICES]); for (device = Config.devices; device; device = device->next) { if (! strcmp(uuid, device->uuid)) { @@ -273,15 +273,15 @@ for (i = 0; i < strlen(buf); i++) if (buf[i] == '-') buf[i] = ','; - pthread_mutex_unlock(&mutexes[LOCK_DEVICES]); +// pthread_mutex_unlock(&mutexes[LOCK_DEVICES]); enableTransmit(device->gpiopin); rc = toggleSwitch(buf); disableTransmit(); - pthread_mutex_lock(&mutexes[LOCK_DEVICES]); +// pthread_mutex_lock(&mutexes[LOCK_DEVICES]); syslog(LOG_NOTICE, "RC433 command %s rc=%d", buf, rc); device->value = value; device->timestamp = time(NULL); - pthread_mutex_unlock(&mutexes[LOCK_DEVICES]); +// pthread_mutex_unlock(&mutexes[LOCK_DEVICES]); return rc; } @@ -314,10 +314,10 @@ 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]); +// pthread_mutex_lock(&mutexes[LOCK_DEVICES]); device->value = (value == 0) ? 0 : 1; device->timestamp = time(NULL); - pthread_mutex_unlock(&mutexes[LOCK_DEVICES]); +// pthread_mutex_unlock(&mutexes[LOCK_DEVICES]); } } } @@ -344,13 +344,13 @@ } #endif } else { - pthread_mutex_unlock(&mutexes[LOCK_DEVICES]); +// pthread_mutex_unlock(&mutexes[LOCK_DEVICES]); return 0; } // if ((test_value != my_value) || (((int)now - (int)my_timestamp) >= 120)) } // if (! strcmp(uuid, device->uuid)) } // for (device = Config.devices; device; device = device->next) - pthread_mutex_unlock(&mutexes[LOCK_DEVICES]); +// pthread_mutex_unlock(&mutexes[LOCK_DEVICES]); return 0; } @@ -367,7 +367,7 @@ if (uuid == NULL) return 0; - pthread_mutex_lock(&mutexes[LOCK_DEVICES]); +// pthread_mutex_lock(&mutexes[LOCK_DEVICES]); for (device = Config.devices; device; device = device->next) { if (! strcmp(uuid, device->uuid)) { @@ -377,13 +377,13 @@ } else { tmp = 0; } - pthread_mutex_unlock(&mutexes[LOCK_DEVICES]); +// pthread_mutex_unlock(&mutexes[LOCK_DEVICES]); *value = tmp; return present; } } - pthread_mutex_unlock(&mutexes[LOCK_DEVICES]); +// pthread_mutex_unlock(&mutexes[LOCK_DEVICES]); return DEVPRESENT_NO; } @@ -723,15 +723,15 @@ #endif // char *addr = NULL, line1[60], line2[60], *p = NULL; // FILE *fp; - int rc, found; + int found; time_t now; my_devices_state = 1; syslog(LOG_NOTICE, "Thread my_devices_loop started"); #ifdef HAVE_WIRINGPI_H - if ((rc = piHiPri(50))) - syslog(LOG_NOTICE, "my_devices_loop: piHiPri(50) rc=%d", rc); +// if ((rc = piHiPri(50))) +// syslog(LOG_NOTICE, "my_devices_loop: piHiPri(50) rc=%d", rc); #endif dht11_next = time(NULL); @@ -773,6 +773,7 @@ if (my_devices_shutdown) break; +//syslog(LOG_NOTICE, "device type %d address %s-%d comment %s", device->type, device->address, device->subdevice, device->comment); switch (device->type) { case DEVTYPE_W1: @@ -788,7 +789,7 @@ found = FALSE; for (dev_w1 = w1_devices; dev_w1; dev_w1 = dev_w1->next) { if (strcmp(device->address, dev_w1->address) == 0) { - syslog(LOG_NOTICE, "sensor %s value %d", dev_w1->address, dev_w1->value); +// syslog(LOG_NOTICE, "sensor %s value %d", dev_w1->address, dev_w1->value); found = TRUE; if ((dev_w1->value == -1) || (dev_w1->value < -55000)) { syslog(LOG_NOTICE, "sensor %s value error %d", device->address, dev_w1->value); @@ -804,9 +805,9 @@ if (found == FALSE) { if (device->present != DEVPRESENT_NO) { syslog(LOG_NOTICE, "sensor %s is missing", device->address); - pthread_mutex_lock(&mutexes[LOCK_DEVICES]); +// pthread_mutex_lock(&mutexes[LOCK_DEVICES]); device->present = DEVPRESENT_NO; - pthread_mutex_unlock(&mutexes[LOCK_DEVICES]); +// pthread_mutex_unlock(&mutexes[LOCK_DEVICES]); } } @@ -825,16 +826,16 @@ if (device->subdevice == 0) { /* Read once during subdevice 0 */ dht11Read(device->address); - pthread_mutex_lock(&mutexes[LOCK_DEVICES]); +// pthread_mutex_lock(&mutexes[LOCK_DEVICES]); device->present = dht11_state; if (dht11_state == DEVPRESENT_YES) { device->value = dht11_temperature; device->timestamp = time(NULL); } - pthread_mutex_unlock(&mutexes[LOCK_DEVICES]); +// pthread_mutex_unlock(&mutexes[LOCK_DEVICES]); } else if (device->subdevice == 1) { /* Data already present, valid or not. */ - pthread_mutex_lock(&mutexes[LOCK_DEVICES]); +// pthread_mutex_lock(&mutexes[LOCK_DEVICES]); device->present = dht11_state; if (dht11_state == DEVPRESENT_YES) { device->value = dht11_humidity; @@ -843,7 +844,7 @@ } else { dht11_next = now + 1; } - pthread_mutex_unlock(&mutexes[LOCK_DEVICES]); +// pthread_mutex_unlock(&mutexes[LOCK_DEVICES]); } } break; @@ -851,18 +852,18 @@ #ifdef HAVE_WIRINGPI_H case DEVTYPE_GPIO: if (device->direction == DEVDIR_IN_BIN) { - pthread_mutex_lock(&mutexes[LOCK_DEVICES]); +// pthread_mutex_lock(&mutexes[LOCK_DEVICES]); device->value = digitalRead(device->gpiopin); device->offset = 0; device->timestamp = time(NULL); - pthread_mutex_unlock(&mutexes[LOCK_DEVICES]); +// pthread_mutex_unlock(&mutexes[LOCK_DEVICES]); } break; #endif #ifdef USE_SIMULATOR case DEVTYPE_SIM: - pthread_mutex_lock(&mutexes[LOCK_DEVICES]); +// pthread_mutex_lock(&mutexes[LOCK_DEVICES]); if (Config.simulators) { simulator = Config.simulators; if (device->subdevice == 0) { @@ -882,7 +883,7 @@ device->timestamp = time(NULL); } } - pthread_mutex_unlock(&mutexes[LOCK_DEVICES]); +// pthread_mutex_unlock(&mutexes[LOCK_DEVICES]); break; #endif default:
--- a/thermferm/one-wire.c Fri Apr 05 16:19:39 2024 +0200 +++ b/thermferm/one-wire.c Fri Apr 05 19:30:41 2024 +0200 @@ -189,9 +189,9 @@ pthread_mutex_unlock(&mutexes[LOCK_ONE_WIRE]); for (device = Config.devices; device; device = device->next) { if (strcmp(dev_w1->address, device->address) == 0) { - pthread_mutex_lock(&mutexes[LOCK_DEVICES]); +// pthread_mutex_lock(&mutexes[LOCK_DEVICES]); device->present = DEVPRESENT_NO; - pthread_mutex_unlock(&mutexes[LOCK_DEVICES]); +// pthread_mutex_unlock(&mutexes[LOCK_DEVICES]); } } }
--- a/thermferm/thermferm.c Fri Apr 05 16:19:39 2024 +0200 +++ b/thermferm/thermferm.c Fri Apr 05 19:30:41 2024 +0200 @@ -1142,7 +1142,8 @@ pthread_mutex_lock(&mutexes[LOCK_LCD]); lcd_buf_write(1, (char *)" ThermFerm "); - lcd_buf_write(2, (char *)" Version %s ", VERSION); + lcd_buf_write(2, (char *)"Version %s ", VERSION); + // 0.9.17a2 pthread_mutex_unlock(&mutexes[LOCK_LCD]); do { @@ -1168,7 +1169,7 @@ */ pthread_mutex_lock(&mutexes[LOCK_LCD]); lcd_buf_write(1, (char *)" ThermFerm "); - lcd_buf_write(2, (char *)" Version %s ", VERSION); + lcd_buf_write(2, (char *)"Version %s ", VERSION); pthread_mutex_unlock(&mutexes[LOCK_LCD]); }