thermferm/thermferm.c

changeset 245
b01b6238eb67
parent 244
2f868eaefec2
child 246
6df404da3537
--- a/thermferm/thermferm.c	Sat Aug 16 17:11:09 2014 +0200
+++ b/thermferm/thermferm.c	Mon Aug 18 15:10:09 2014 +0200
@@ -35,6 +35,8 @@
 
 int			my_shutdown = FALSE;
 static pid_t		pgrp, mypid;
+int			run_pause = FALSE;
+int			run_hold = FALSE;
 
 extern int		debug;
 extern sys_config	Config;
@@ -500,6 +502,31 @@
 	if (my_shutdown)
 	    run = 0;
 
+	/*
+	 * Use to stop processing units. Should be used when a unit is
+	 * added or removed.
+	 */
+	if (run_pause) {
+	    run_hold = TRUE;
+	    syslog(LOG_NOTICE, "run_pause: entering hold state");
+	    for (;;) {
+		usleep(100000);
+		if (! run_pause)
+		    break;
+	    }
+	    syslog(LOG_NOTICE, "run_pause: leaving hold state");
+	    run_hold = FALSE;
+#ifdef HAVE_WIRINGPI_H
+	    /*
+	     * In case the LCD buffers were cleared, setup the first page.
+	     */
+	    piLock(LOCK_LCD);
+	    lcd_buf_write(1, (char *)"   ThermFerm    ");
+	    lcd_buf_write(2, (char *)" Version %s     ", VERSION);
+	    piUnlock(LOCK_LCD);
+#endif
+	}
+
 	now = time(NULL);
 	if (now != last) {
 	    /*

mercurial