SVGHMI: fix again appication of frequency value when given in label. Use it on PushButton instance in svghmi test.
authorEdouard Tisserant
Wed, 19 Jan 2022 11:41:04 +0100
changeset 3417 9b9775d230f5
parent 3414 0ff608310312
child 3418 a1d9a0353053
SVGHMI: fix again appication of frequency value when given in label. Use it on PushButton instance in svghmi test.
svghmi/svghmi.js
svghmi/widget_button.ysl2
svghmi/widgets_common.ysl2
tests/svghmi/svghmi_0@svghmi/svghmi.svg
--- a/svghmi/svghmi.js	Wed Jan 19 08:56:16 2022 +0100
+++ b/svghmi/svghmi.js	Wed Jan 19 11:41:04 2022 +0100
@@ -26,6 +26,8 @@
                 console.log(err);
             }
         }
+        if(widget.forced_frequency !== undefined)
+            widget.frequency = widget.forced_frequency;
     });
 };
 
--- a/svghmi/widget_button.ysl2	Wed Jan 19 08:56:16 2022 +0100
+++ b/svghmi/widget_button.ysl2	Wed Jan 19 11:41:04 2022 +0100
@@ -163,7 +163,6 @@
 
 function "generated_button_class" {
     param "fsm";
-    |     frequency = 5;
 
     |     display = "inactive";
     |     state = "init";
@@ -202,6 +201,7 @@
 
 
 widget_class("Button"){
+    |     frequency = 5;
     const "fsm","exsl:node-set($_button_fsm)";
     call "generated_button_class" with "fsm", "$fsm";
 }
@@ -211,6 +211,7 @@
 }
 
 widget_class("PushButton"){
+    |     frequency = 20;
     const "fsm","exsl:node-set($_push_button_fsm)";
     call "generated_button_class" with "fsm", "$fsm";
 }
--- a/svghmi/widgets_common.ysl2	Wed Jan 19 08:56:16 2022 +0100
+++ b/svghmi/widgets_common.ysl2	Wed Jan 19 11:41:04 2022 +0100
@@ -174,7 +174,6 @@
         constructor(elt_id, freq, args, indexes, minmaxes, members){
             this.element_id = elt_id;
             this.element = id(elt_id);
-            if(freq !== undefined) this.frequency = freq;
             this.args = args;
             this.indexes = indexes;
             this.minmaxes = minmaxes;
@@ -183,6 +182,7 @@
             this.inhibit = indexes.map(() => undefined);
             this.pending = indexes.map(() => undefined);
             this.bound_unhinibit = this.unhinibit.bind(this);
+            this.forced_frequency = freq;
         }
 
         unsub(){
--- a/tests/svghmi/svghmi_0@svghmi/svghmi.svg	Wed Jan 19 08:56:16 2022 +0100
+++ b/tests/svghmi/svghmi_0@svghmi/svghmi.svg	Wed Jan 19 11:41:04 2022 +0100
@@ -128,11 +128,11 @@
      inkscape:current-layer="hmi0"
      showgrid="false"
      units="px"
-     inkscape:zoom="0.40092402"
-     inkscape:cx="-239.69441"
-     inkscape:cy="-2504.0401"
-     inkscape:window-width="3840"
-     inkscape:window-height="2096"
+     inkscape:zoom="0.20046201"
+     inkscape:cx="1401.1703"
+     inkscape:cy="-1495.7332"
+     inkscape:window-width="1600"
+     inkscape:window-height="836"
      inkscape:window-x="0"
      inkscape:window-y="27"
      inkscape:window-maximized="1"
@@ -7612,7 +7612,7 @@
   <g
      transform="matrix(0.57180538,0,0,0.57180538,1234.9549,1536.0365)"
      id="g443-2"
-     inkscape:label="HMI:PushButton@/SELECTION"
+     inkscape:label="HMI:PushButton|50@/SELECTION"
      style="stroke-width:1">
     <rect
        style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#e6e6e6;fill-opacity:1;fill-rule:nonzero;stroke:#ff6600;stroke-width:5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"