--- a/svghmi/parse_labels.ysl2 Thu May 05 10:37:36 2022 +0200
+++ b/svghmi/parse_labels.ysl2 Thu May 05 11:48:43 2022 +0200
@@ -44,7 +44,12 @@
- if "$freq" attrib "freq" > «$freq»
+ if "not(regexp:test($freq,'^[0-9]*(\.[0-9]+)?[smh]'))" { + error > Widget id:«$id» label:«$label» has wrong syntax of frequency forcing «$freq» + attrib "freq" > «$freq» foreach "str:split(substring-after($args, ':'), ':')" {
--- a/svghmi/svghmi.js Thu May 05 10:37:36 2022 +0200
+++ b/svghmi/svghmi.js Thu May 05 11:48:43 2022 +0200
@@ -18,16 +18,7 @@
function init_widgets() {
Object.keys(hmi_widgets).forEach(function(id) {
let widget = hmi_widgets[id];
- let init = widget.init;
- if(typeof(init) == "function"){
- if(widget.forced_frequency !== undefined)
- widget.frequency = widget.forced_frequency;
--- a/svghmi/widgets_common.ysl2 Thu May 05 10:37:36 2022 +0200
+++ b/svghmi/widgets_common.ysl2 Thu May 05 11:48:43 2022 +0200
@@ -85,7 +85,7 @@
@@ -186,6 +186,36 @@
+ if(widget.forced_frequency !== undefined){ + let s = widget.forced_frequency; + once every 10 seconds : 10s + let unit = s.slice(-1); + widget.frequency = factor ? 1/(factor * Number(s.slice(0,-1))) + if(typeof(init) == "function"){