# HG changeset patch # User Michiel Broek # Date 1712575002 -7200 # Node ID daa22055cd3dcbacfffb7199aac8e9affa62859e # Parent 4df4c8b17733c047cbd0375cc86a1c2d48fb7791 Reboot from the panel is now restart application. The restart is working again, also via bmsapp. diff -r 4df4c8b17733 -r daa22055cd3d thermferm/mqtt.c --- 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; diff -r 4df4c8b17733 -r daa22055cd3d thermferm/thermferm.c --- 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;