Reboot from the panel is now restart application. The restart is working again, also via bmsapp.

Mon, 08 Apr 2024 13:16:42 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Mon, 08 Apr 2024 13:16:42 +0200
changeset 669
daa22055cd3d
parent 668
4df4c8b17733
child 670
6c62e99ade00

Reboot from the panel is now restart application. The restart is working again, also via bmsapp.

thermferm/mqtt.c file | annotate | diff | comparison | revisions
thermferm/thermferm.c file | annotate | diff | comparison | revisions
--- a/thermferm/mqtt.c	Mon Apr 08 11:23:45 2024 +0200
+++ b/thermferm/mqtt.c	Mon Apr 08 13:16:42 2024 +0200
@@ -408,7 +408,7 @@
 			if (json_object_get_boolean(val) == true) {
 			    syslog(LOG_NOTICE, "MQTT: `Node Control/Reboot' command");
 			    /*
-			     * Reboot. The erver process will restart which is handled
+			     * Restart. The server process will restart which is handled
 			     * in the main thread loop.
 			     */
 			    my_reboot = my_shutdown = TRUE;
--- a/thermferm/thermferm.c	Mon Apr 08 11:23:45 2024 +0200
+++ b/thermferm/thermferm.c	Mon Apr 08 13:16:42 2024 +0200
@@ -393,9 +393,9 @@
 
 	case MENU_SYS_REBOOT:	
 #ifdef HAVE_WIRINGPI_H				
-				lcdPuts(lcdHandle, "Reboot system");
+				lcdPuts(lcdHandle, "Restart app.");
 #endif
-				slcdPuts(slcdHandle, "Reboot system");
+				slcdPuts(slcdHandle, "Restart app.");
 				break;
     }
 
@@ -874,8 +874,12 @@
 			if ((key == KEY_DOWN) || (key == KEY_UP))
 			    go_menu(MENU_SYS_HALT);
 			if (key == KEY_CONFIRM) {
-			    rc = system("/sbin/reboot");
-			    syslog(LOG_NOTICE, "System reboot from panel: /sbin/reboot rc=%d", rc);
+			    /*
+			     * Restart. The server process will restart which is handled
+			     * in the main thread loop.
+			     */
+			    my_reboot = my_shutdown = TRUE;
+			    syslog(LOG_NOTICE, "Application restart from panel");
 			    go_menu(MENU_NONE);
 			}
 			break;
@@ -943,26 +947,6 @@
     syslog(LOG_NOTICE, "Build with simulator");
 #endif
 
-    if ((rc = initLCD (Config.lcd_cols, Config.lcd_rows))) {
-	fprintf(stderr, "Cannot initialize LCD display, rc=%d\n", rc);
-	return 1;
-    }
-
-#ifdef HAVE_WIRINGPI_H
-    lcdCharDef(lcdHandle, 1, degC);
-    lcdCharDef(lcdHandle, 2, SP_Symbol);
-    lcdCharDef(lcdHandle, 3, CoolONOFF);
-    lcdCharDef(lcdHandle, 4, RevCoolONOFF);
-    lcdCharDef(lcdHandle, 5, HeatONOFF);
-    lcdCharDef(lcdHandle, 6, RevHeatONOFF);
-#endif
-    slcdCharDef(slcdHandle, 1, degC);
-    slcdCharDef(slcdHandle, 2, SP_Symbol);
-    slcdCharDef(slcdHandle, 3, CoolONOFF);
-    slcdCharDef(slcdHandle, 4, RevCoolONOFF);
-    slcdCharDef(slcdHandle, 5, HeatONOFF);
-    slcdCharDef(slcdHandle, 6, RevHeatONOFF);
-
     if (foreground) {
 	/*
 	 * Run in foreground.
@@ -1873,7 +1857,34 @@
     long	t = 0;
 
     syslog(LOG_NOTICE, "Server process started");
+
+    if ((rc = initLCD (Config.lcd_cols, Config.lcd_rows))) {
+        fprintf(stderr, "Cannot initialize LCD display, rc=%d\n", rc);
+        return 1;
+    }
+
+#ifdef HAVE_WIRINGPI_H
+    lcdCharDef(lcdHandle, 1, degC);
+    lcdCharDef(lcdHandle, 2, SP_Symbol);
+    lcdCharDef(lcdHandle, 3, CoolONOFF);
+    lcdCharDef(lcdHandle, 4, RevCoolONOFF);
+    lcdCharDef(lcdHandle, 5, HeatONOFF);
+    lcdCharDef(lcdHandle, 6, RevHeatONOFF);
+#endif
+    slcdCharDef(slcdHandle, 1, degC);
+    slcdCharDef(slcdHandle, 2, SP_Symbol);
+    slcdCharDef(slcdHandle, 3, CoolONOFF);
+    slcdCharDef(slcdHandle, 4, RevCoolONOFF);
+    slcdCharDef(slcdHandle, 5, HeatONOFF);
+    slcdCharDef(slcdHandle, 6, RevHeatONOFF);
+
     my_shutdown = my_reboot = FALSE;
+    my_devices_shutdown = my_panel_shutdown = my_server_shutdown = my_one_wire_shutdown = 0;
+    my_devices_state = my_panel_state = my_server_state = my_one_wire_state = 0;
+    my_simulator_state = 0;
+#ifdef USE_SIMULATOR
+    my_simulator_shutdown = 0;
+#endif
     if (lockprog((char *)"thermferm")) {
 	syslog(LOG_NOTICE, "Can't lock");
 	return 1;

mercurial