# HG changeset patch # User Edouard Tisserant # Date 1642578976 -3600 # Node ID 0ff608310312e552e2d5175db6a4a8d02fae9ef8 # Parent 2e84a27822957faf8a3cfe1b2b81f55d353ba6c5 SVGHMI: update generated xslt, and svghmi test project files diff -r 2e84a2782295 -r 0ff608310312 svghmi/analyse_widget.xslt --- a/svghmi/analyse_widget.xslt Wed Jan 19 08:53:49 2022 +0100 +++ b/svghmi/analyse_widget.xslt Wed Jan 19 08:56:16 2022 +0100 @@ -29,7 +29,7 @@ - + @@ -49,8 +49,8 @@ - - + + @@ -221,6 +221,71 @@ Boolean variable + + + frequency = 5; + + display = "inactive"; + + state = "init"; + + dispatch(value) { + + + } + + onmouseup(evt) { + + svg_root.removeEventListener("pointerup", this.bound_onmouseup, true); + + + + + } + + onmousedown(evt) { + + svg_root.addEventListener("pointerup", this.bound_onmouseup, true); + + + + + } + + + animate(){ + + if (this.active_elt && this.inactive_elt) { + + + if(this.display == " + + ") + + this. + + _elt.style.display = ""; + + else + + this. + + _elt.style.display = "none"; + + + } + + } + + init() { + + this.bound_onmouseup = this.onmouseup.bind(this); + + this.element.addEventListener("pointerdown", this.onmousedown.bind(this)); + + } + + diff -r 2e84a2782295 -r 0ff608310312 svghmi/gen_dnd_widget_svg.xslt --- a/svghmi/gen_dnd_widget_svg.xslt Wed Jan 19 08:53:49 2022 +0100 +++ b/svghmi/gen_dnd_widget_svg.xslt Wed Jan 19 08:56:16 2022 +0100 @@ -31,7 +31,7 @@ - + @@ -51,8 +51,8 @@ - - + + diff -r 2e84a2782295 -r 0ff608310312 svghmi/gen_index_xhtml.xslt --- a/svghmi/gen_index_xhtml.xslt Wed Jan 19 08:53:49 2022 +0100 +++ b/svghmi/gen_index_xhtml.xslt Wed Jan 19 08:56:16 2022 +0100 @@ -186,7 +186,7 @@ - + @@ -206,8 +206,8 @@ - - + + @@ -1247,8 +1247,8 @@ - - + + undefined @@ -2214,6 +2214,62 @@ Boolean variable + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -2344,6 +2400,10 @@ _action(){ + console.log("Entering state + + "); + } @@ -2362,74 +2422,80 @@ ); + + + frequency = 5; + + display = "inactive"; + + state = "init"; + + dispatch(value) { + + + } + + onmouseup(evt) { + + svg_root.removeEventListener("pointerup", this.bound_onmouseup, true); + + + + + } + + onmousedown(evt) { + + svg_root.addEventListener("pointerup", this.bound_onmouseup, true); + + + + + } + + + animate(){ + + if (this.active_elt && this.inactive_elt) { + + + if(this.display == " + + ") + + this. + + _elt.style.display = ""; + + else + + this. + + _elt.style.display = "none"; + + + } + + } + + init() { + + this.bound_onmouseup = this.onmouseup.bind(this); + + this.element.addEventListener("pointerdown", this.onmousedown.bind(this)); + + } + + class ButtonWidget extends Widget{ - frequency = 5; - - display = "inactive"; - - state = "init"; - - dispatch(value) { - - - } - - onmouseup(evt) { - - svg_root.removeEventListener("pointerup", this.bound_onmouseup, true); - - - - - } - - onmousedown(evt) { - - svg_root.addEventListener("pointerup", this.bound_onmouseup, true); - - - - - } - - - animate(){ - - if (this.active_elt && this.inactive_elt) { - - - if(this.display == " - - ") - - this. - - _elt.style.display = ""; - - else - - this. - - _elt.style.display = "none"; - - - } - - } - - init() { - - this.bound_onmouseup = this.onmouseup.bind(this); - - this.element.addEventListener("pointerdown", this.onmousedown.bind(this)); - - } - + + + } @@ -2443,6 +2509,28 @@ + + class + PushButtonWidget + extends Widget{ + + + + + + } + + + + + + + + active inactive + + + + @@ -8713,6 +8801,8 @@ function send_hmi_value(index, value) { + console.log("send_hmi_value("+index+", "+value+")") + if(index > last_remote_index){ updates.set(index, value); @@ -8761,9 +8851,11 @@ function apply_hmi_value(index, new_val) { - let old_val = cache[index]; - - if(new_val != undefined && old_val != new_val) + console.log("apply_hmi_value("+index+", "+new_val+")") + + /*let old_val = cache[index];*/ + + if(new_val != undefined /*&& old_val != new_val*/) send_hmi_value(index, new_val); diff -r 2e84a2782295 -r 0ff608310312 tests/svghmi/beremiz.xml --- a/tests/svghmi/beremiz.xml Wed Jan 19 08:53:49 2022 +0100 +++ b/tests/svghmi/beremiz.xml Wed Jan 19 08:56:16 2022 +0100 @@ -1,5 +1,5 @@ - + diff -r 2e84a2782295 -r 0ff608310312 tests/svghmi/plc.xml --- a/tests/svghmi/plc.xml Wed Jan 19 08:53:49 2022 +0100 +++ b/tests/svghmi/plc.xml Wed Jan 19 08:56:16 2022 +0100 @@ -1,7 +1,7 @@ - + diff -r 2e84a2782295 -r 0ff608310312 tests/svghmi/svghmi_0@svghmi/svghmi.svg --- a/tests/svghmi/svghmi_0@svghmi/svghmi.svg Wed Jan 19 08:53:49 2022 +0100 +++ b/tests/svghmi/svghmi_0@svghmi/svghmi.svg Wed Jan 19 08:56:16 2022 +0100 @@ -128,11 +128,11 @@ inkscape:current-layer="hmi0" showgrid="false" units="px" - inkscape:zoom="0.59648442" - inkscape:cx="816.53059" - inkscape:cy="446.56258" - inkscape:window-width="1600" - inkscape:window-height="836" + inkscape:zoom="0.40092402" + inkscape:cx="-239.69441" + inkscape:cy="-2504.0401" + inkscape:window-width="3840" + inkscape:window-height="2096" inkscape:window-x="0" inkscape:window-y="27" inkscape:window-maximized="1" @@ -7518,135 +7518,6 @@ transform="translate(-2307.336,1146.3377)" inkscape:label="HMI:ListSwitch@/ALARMSTATUS" /> - - - - up - - - - - - - up - - - - - - - up - - - up + + + + + + + Home + + + Freq : unspec + + + + + up + + + + + + + + Freq1 + + + + + + + + Freq16 + + + + + + + + Freq + + + + + + + + + Home + + + Freq : 1 + + + + + up + + + + + + + + Freq2 + + + + + + + + Freq0 + + + + + + + + + Home + + + Freq : 2 + + + + + up + + + + + + + + Freq4 + + + + + + + + Freq1 + + + + + + + + + Home + + + Freq : 4 + + + + + up + + + + + + + + Freq16 + + + + + + + + Freq2 + + + + + + + + + Home + + + Freq : 16 + + + + + up + + + + + + + + Freq0 + + + + + + + + Freq4 + +