thermferm/thermferm.c

changeset 654
e981d0185485
parent 652
16d3d4b58b5b
child 656
ca47c742a25d
--- a/thermferm/thermferm.c	Wed Mar 27 18:59:39 2024 +0100
+++ b/thermferm/thermferm.c	Tue Apr 02 15:03:12 2024 +0200
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * Copyright (C) 2014-2022
+ * Copyright (C) 2014-2024
  *   
  * Michiel Broek <mbroek at mbse dot eu>
  *
@@ -22,15 +22,16 @@
 
 #include "lock.h"
 #include "rdconfig.h"
-#include "devices.h"
 #include "server.h"
 #include "thermferm.h"
+#include "devices.h"
 #include "delay.h"
 #include "simulator.h"
 #include "lcd-pcf8574.h"
 #include "lcd-buffer.h"
 #include "slcd.h"
 #include "panel.h"
+#include "one-wire.h"
 #include "futil.h"
 #include "xutil.h"
 #include "pid.h"
@@ -51,6 +52,7 @@
 extern int		my_panel_state;
 extern int		my_server_state;
 extern int		my_simulator_state;
+extern int		my_one_wire_state;
 int			setupmenu = MENU_NONE;
 units_list		*current_unit = NULL;		/* In panel editor this points to the current unit. */
 float			temp_temp = 20.0;
@@ -1064,6 +1066,14 @@
 	t++;
     }
 
+    rc = pthread_create(&threads[t], NULL, my_one_wire_loop, (void *)t );
+    if (rc) {
+	fprintf(stderr, "my_one_wire_loop thread didn't start rc=%d\n", rc);
+	syslog(LOG_NOTICE, "my_one_wire_loop thread didn't start rc=%d", rc);
+    } else {
+	t++;
+    }
+
 #ifdef USE_SIMULATOR
     rc = pthread_create(&threads[t], NULL, my_simulator_loop, (void *)t );
     if (rc) {
@@ -1915,9 +1925,9 @@
 
     /*
      * Note that we don't care if the command server is stopped, this one
-     * does almost certain keep running but tat doesn't harm.
+     * does almost certain keep running but that doesn't harm.
      */
-    while ((my_devices_state + my_panel_state + my_simulator_state) > 0) { sleep(1); };
+    while ((my_devices_state + my_panel_state + my_simulator_state + my_one_wire_state) > 0) { sleep(1); };
     mqtt_disconnect();
 
     stopLCD();

mercurial