thermferm/simulator.c

changeset 646
e3edc783006b
parent 595
d7342a8e7f4d
child 652
16d3d4b58b5b
--- a/thermferm/simulator.c	Sat Mar 23 12:18:14 2024 +0100
+++ b/thermferm/simulator.c	Sat Mar 23 16:01:24 2024 +0100
@@ -1,5 +1,5 @@
 /*****************************************************************************
- * Copyright (C) 2014-2019
+ * Copyright (C) 2014-2024
  *   
  * Michiel Broek <mbroek at mbse dot eu>
  *
@@ -23,22 +23,20 @@
 #include "thermferm.h"
 #include "simulator.h"
 
+int			my_simulator_state = 0;
+
 #ifdef USE_SIMULATOR
 
 extern int		my_shutdown;
 extern sys_config	Config;
 
-int SIMcooling = 0;
-int SIMheating = 0;
-int SIMfan = 0;
-int SIMlight = 0;
+int			SIMcooling = 0;
+int			SIMheating = 0;
+int			SIMfan = 0;
+int			SIMlight = 0;
 
 
-#ifdef HAVE_WIRINGPI_H
-PI_THREAD (my_simulator_loop)
-#else
 void *my_simulator_loop(void *threadid)
-#endif
 {
     simulator_list	*simulator;
     time_t		now, last = (time_t)0;
@@ -46,6 +44,7 @@
     double		k_room_air, sqm_room_air, thick_room_air, air_heat_transfer;
     double		air_change, vhc_air = 0.00121;
 
+    my_simulator_state = 1;
     syslog(LOG_NOTICE, "Thread my_simulator_loop started");
 
     for (simulator = Config.simulators; simulator; simulator = simulator->next) {
@@ -131,6 +130,7 @@
     }
 
     syslog(LOG_NOTICE, "Thread my_simulator_loop stopped");
+    my_simulator_state = 0;
     return 0;
 }
 

mercurial