--- a/svghmi/svghmi.py Thu Jul 22 12:02:50 2021 +0200
+++ b/svghmi/svghmi.py Thu Jul 22 12:03:34 2021 +0200
@@ -56,6 +56,19 @@
def Generate_C(self, buildpath, varlist, IECCFLAGS):
global hmi_tree_root, on_hmitree_update, maxConnectionsTotal
+ already_found_watchdog = False + for CTNChild in self.GetCTR().IterChildren(): + if isinstance(CTNChild, SVGHMI): + # collect maximum connection total for all svghmi nodes + maxConnectionsTotal += CTNChild.GetParamsAttributes("SVGHMI.MaxConnections")["value"] + if CTNChild.GetParamsAttributes("SVGHMI.EnableWatchdog")["value"]: + if already_found_watchdog: + self.FatalError("SVGHMI: Only one watchdog enabled HMI allowed") + already_found_watchdog = True @@ -198,11 +211,6 @@
# "programs_declarations": "\n".join(["extern %(type)s %(C_path)s;" %
# p for p in self._ProgramList]),
- for CTNChild in self.GetCTR().IterChildren():
- if isinstance(CTNChild, SVGHMI):
- maxConnectionsTotal += CTNChild.GetParamsAttributes("SVGHMI.MaxConnections")["value"]
# C code to observe/access HMI tree variables
svghmi_c_filepath = paths.AbsNeighbourFile(__file__, "svghmi.c")
svghmi_c_file = open(svghmi_c_filepath, 'r')