--- a/svghmi/gen_index_xhtml.xslt Sun Oct 27 21:38:10 2019 +0100
+++ b/svghmi/gen_index_xhtml.xslt Sun Oct 27 22:28:51 2019 +0100
@@ -426,8 +426,6 @@
- <xsl:text> //console.log("Recv something.");
<xsl:text> for(let hash_int of hmi_hash) {
@@ -444,16 +442,10 @@
- <xsl:text> //console.log("Recv something GOOD.");
<xsl:text> while(i < data.byteLength){
<xsl:text> let index = dv.getUint32(i, true);
- <xsl:text> //console.log("Recv something index is "+index);
<xsl:text> let iectype = hmitree_types[index];
@@ -586,7 +578,7 @@
<xsl:text> if(previous_period != new_period) {
@@ -596,14 +588,12 @@
<xsl:text> new Uint8Array([2]), /* subscribe = 2 */
- <xsl:text> new Uint32Array([index]),
+ <xsl:text> new Uint32Array([index]), <xsl:text> new Uint16Array([new_period]));
<xsl:text> send_blob(delta);
@@ -670,7 +660,9 @@
<xsl:text> if(new_val != undefined && old_val != new_val)
- <xsl:text> return send_hmi_value(index, new_val);
+ <xsl:text> send_hmi_value(index, new_val); + <xsl:text> return new_val; @@ -901,9 +893,11 @@
- <xsl:text> evt => change_hmi_value(this.indexes[0], "</xsl:text>
+ <xsl:text> evt => {let new_val = change_hmi_value(this.indexes[0], "</xsl:text> <xsl:value-of select="@inkscape:label"/>
+ <xsl:text> this.value_elt.textContent = String(new_val);}); --- a/svghmi/gen_index_xhtml.ysl2 Sun Oct 27 21:38:10 2019 +0100
+++ b/svghmi/gen_index_xhtml.ysl2 Sun Oct 27 22:28:51 2019 +0100
@@ -345,7 +345,9 @@
foreach "$hmi_element/*[regexp:test(@inkscape:label,'^[=+\-][0-9]+')]" {
| document.getElementById("«@id»").addEventListener(
- | evt => change_hmi_value(this.indexes[0], "«@inkscape:label»"));
+ | evt => {let new_val = change_hmi_value(this.indexes[0], "«@inkscape:label»"); + | this.value_elt.textContent = String(new_val);}); + /* could gray out value until refreshed */ --- a/svghmi/svghmi.js Sun Oct 27 21:38:10 2019 +0100
+++ b/svghmi/svghmi.js Sun Oct 27 22:28:51 2019 +0100
@@ -134,10 +134,9 @@
subscriptions[index] = new_period;
new Uint8Array([2]), /* subscribe = 2 */
- new Uint32Array([index]),
+ new Uint32Array([index]), new Uint16Array([new_period]));
@@ -171,7 +170,8 @@
if(new_val != undefined && old_val != new_val)
- return send_hmi_value(index, new_val);
+ send_hmi_value(index, new_val); --- a/tests/svghmi/plc.xml Sun Oct 27 21:38:10 2019 +0100
+++ b/tests/svghmi/plc.xml Sun Oct 27 22:28:51 2019 +0100
@@ -1,7 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<project xmlns:ns1="http://www.plcopen.org/xml/tc6_0201" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.plcopen.org/xml/tc6_0201">
<fileHeader companyName="Unknown" productName="Unnamed" productVersion="1" creationDateTime="2019-08-06T14:23:42"/>
- <contentHeader name="Unnamed" modificationDateTime="2019-10-23T11:12:09">
+ <contentHeader name="Unnamed" modificationDateTime="2019-10-27T21:48:33"> @@ -91,43 +91,159 @@
- <inVariable localId="3" executionOrderId="0" height="25" width="30" negated="false">
- <position x="380" y="140"/>
+ <inVariable localId="5" executionOrderId="0" height="30" width="125" negated="false"> + <position x="150" y="100"/> - <relPosition x="30" y="10"/>
+ <relPosition x="125" y="15"/> - <expression>23</expression>
+ <expression>TargetPressure</expression> - <outVariable localId="4" executionOrderId="0" height="30" width="60" negated="false">
- <position x="640" y="135"/>
+ <inOutVariable localId="4" executionOrderId="0" height="30" width="60" negatedOut="false" negatedIn="false"> + <position x="510" y="80"/> <relPosition x="0" y="15"/>
- <connection refLocalId="3">
- <position x="640" y="150"/>
- <position x="410" y="150"/>
+ <connection refLocalId="6" formalParameter="OUT"> + <position x="510" y="95"/> + <position x="470" y="95"/> + <relPosition x="60" y="15"/> <expression>Sloth</expression>
- <outVariable localId="1" executionOrderId="0" height="30" width="75" negated="false">
- <position x="285" y="105"/>
+ <block localId="6" typeName="ADD" executionOrderId="0" height="60" width="65"> + <position x="405" y="65"/> + <variable formalParameter="IN1"> + <relPosition x="0" y="30"/> + <connection refLocalId="4"> + <position x="405" y="95"/> + <position x="385" y="95"/> + <position x="385" y="50"/> + <position x="580" y="50"/> + <position x="580" y="95"/> + <position x="570" y="95"/> + <variable formalParameter="IN2"> + <relPosition x="0" y="50"/> + <connection refLocalId="7" formalParameter="OUT"> + <position x="405" y="115"/> + <position x="360" y="115"/> + <variable formalParameter="OUT"> + <relPosition x="65" y="30"/> + <inVariable localId="1" executionOrderId="0" height="30" width="75" negated="false"> + <position x="150" y="135"/> + <relPosition x="75" y="15"/> + <expression>Pressure</expression> + <block localId="7" typeName="SUB" executionOrderId="0" height="60" width="65"> + <position x="295" y="85"/> + <variable formalParameter="IN1"> + <relPosition x="0" y="30"/> + <connection refLocalId="5"> + <position x="295" y="115"/> + <position x="275" y="115"/> + <variable formalParameter="IN2"> + <relPosition x="0" y="50"/> + <connection refLocalId="1"> + <position x="295" y="135"/> + <position x="285" y="135"/> + <position x="285" y="150"/> + <position x="225" y="150"/> + <variable formalParameter="OUT"> + <relPosition x="65" y="30"/> + <inVariable localId="2" executionOrderId="0" height="30" width="60" negated="false"> + <position x="240" y="190"/> + <relPosition x="60" y="15"/> + <expression>Sloth</expression> + <outVariable localId="3" executionOrderId="0" height="30" width="75" negated="false"> + <position x="435" y="205"/> <relPosition x="0" y="15"/>
- <connection refLocalId="5">
- <position x="285" y="120"/>
- <position x="240" y="120"/>
- <position x="240" y="115"/>
- <position x="195" y="115"/>
+ <connection refLocalId="8" formalParameter="OUT"> + <position x="435" y="220"/> + <position x="410" y="220"/> <expression>Pressure</expression>
- <inVariable localId="5" executionOrderId="0" height="30" width="125" negated="false">
- <position x="70" y="100"/>
+ <block localId="8" typeName="DIV" executionOrderId="0" height="60" width="65"> + <position x="345" y="190"/> + <variable formalParameter="IN1"> + <relPosition x="0" y="30"/> + <connection refLocalId="2"> + <position x="345" y="220"/> + <position x="335" y="220"/> + <position x="335" y="205"/> + <position x="300" y="205"/> + <variable formalParameter="IN2"> + <relPosition x="0" y="50"/> + <connection refLocalId="9"> + <position x="345" y="240"/> + <position x="305" y="240"/> + <variable formalParameter="OUT"> + <relPosition x="65" y="30"/> + <inVariable localId="9" executionOrderId="0" height="30" width="60" negated="false"> + <position x="245" y="225"/> - <relPosition x="125" y="15"/>
+ <relPosition x="60" y="15"/> - <expression>TargetPressure</expression>
+ <expression>100</expression>