thermferm/thermferm.c

changeset 259
b7c967359771
parent 248
870d0be6880d
child 267
a84792cab21c
--- a/thermferm/thermferm.c	Wed Aug 20 22:15:12 2014 +0200
+++ b/thermferm/thermferm.c	Fri Aug 22 17:12:42 2014 +0200
@@ -26,6 +26,7 @@
 #include "devices.h"
 #include "server.h"
 #include "thermferm.h"
+#include "simulator.h"
 #include "lcd-pcf8574.h"
 #include "lcd-buffer.h"
 #include "panel.h"
@@ -49,7 +50,7 @@
 #endif
 
 #ifndef HAVE_WIRINGPI_H
-pthread_t		threads[4];
+pthread_t		threads[5];
 #endif
 extern const char       UNITMODE[5][8];
 extern const char	PROFSTATE[4][6];
@@ -889,6 +890,23 @@
     }
 #endif
 
+
+#ifdef USE_SIMULATOR
+#ifdef HAVE_WIRINGPI_H
+    rc = piThreadCreate(my_simulator_loop);
+#else
+    rc = pthread_create(&threads[t], NULL, my_simulator_loop, (void *)t );
+#endif
+    if (rc) {
+	fprintf(stderr, "my_simulator_loop thread didn't start rc=%d\n", rc);
+	syslog(LOG_WARNING, "my_simulator_loop thread didn't start rc=%d", rc);
+#ifndef HAVE_WIRINGPI_H
+    } else {
+	t++;
+#endif
+    }
+#endif
+
     /*
      * Initialize units for processing
      */

mercurial