diff -r d92d201d22e1 -r 9101a72a1da0 svghmi/gen_index_xhtml.xslt --- a/svghmi/gen_index_xhtml.xslt Wed Dec 18 13:31:22 2019 +0100 +++ b/svghmi/gen_index_xhtml.xslt Fri Jan 10 13:15:07 2020 +0100 @@ -264,6 +264,12 @@ + var heartbeat_index = + + ; + + + var hmitree_types = [ @@ -576,6 +582,32 @@ + // artificially subscribe the watchdog widget to "/heartbeat" hmi variable + + // Since dispatch directly calls change_hmi_value, + + // PLC will periodically send variable at given frequency + + subscribers[heartbeat_index].add({ + + /* type: "Watchdog", */ + + frequency: 1, + + indexes: [heartbeat_index], + + dispatch: function(value) { + + console.log("Heartbeat" + value); + + change_hmi_value(this.indexes[0], "+1"); + + } + + }); + + + function update_subscriptions() { let delta = []; @@ -592,6 +624,8 @@ + // subscribing with a zero period is unsubscribing + let new_period = 0; if(widgets.size > 0) {