SVGHMI - Fixed svghmi.{c,js} about HMI -> PLC data unpack.
--- a/svghmi/gen_index_xhtml.xslt Tue Oct 22 17:06:31 2019 +0200
+++ b/svghmi/gen_index_xhtml.xslt Tue Oct 22 22:58:55 2019 +0200
@@ -586,13 +586,13 @@
</xsl:text>
<xsl:text> subscriptions[index] = new_period;
</xsl:text>
- <xsl:text> delta.push(new Blob([
+ <xsl:text> delta.push(
</xsl:text>
<xsl:text> new Uint8Array([2]), /* subscribe = 2 */
</xsl:text>
<xsl:text> new Uint32Array([index]),
</xsl:text>
- <xsl:text> new Uint16Array([new_period])]));
+ <xsl:text> new Uint16Array([new_period]));
</xsl:text>
<xsl:text> }
</xsl:text>
@@ -608,17 +608,17 @@
</xsl:text>
<xsl:text>function send_hmi_value(index, value) {
</xsl:text>
- <xsl:text> iectype = hmitree_types[index];
-</xsl:text>
- <xsl:text> jstype = typedarray_types[iectype];
+ <xsl:text> let iectype = hmitree_types[index];
+</xsl:text>
+ <xsl:text> let jstype = typedarray_types[iectype];
</xsl:text>
<xsl:text> send_blob([
</xsl:text>
<xsl:text> new Uint8Array([0]), /* setval = 0 */
</xsl:text>
- <xsl:text> new jstype([value])
-</xsl:text>
- <xsl:text> ]);
+ <xsl:text> new Uint32Array([index]),
+</xsl:text>
+ <xsl:text> new jstype([value])]);
</xsl:text>
<xsl:text>
</xsl:text>
--- a/svghmi/svghmi.c Tue Oct 22 17:06:31 2019 +0200
+++ b/svghmi/svghmi.c Tue Oct 22 22:58:55 2019 +0200
@@ -286,7 +286,7 @@
void *dst_p = &rbuf[dsc->buf_index];
uint32_t sz = __get_type_enum_size(dsc->type);
- if((valptr + sz) < end)
+ if((valptr + sz) <= end)
{
// rescheduling spinlock until free
while(AtomicCompareExchange(&dsc->rlock, 0, 1)) sched_yield();
--- a/svghmi/svghmi.js Tue Oct 22 17:06:31 2019 +0200
+++ b/svghmi/svghmi.js Tue Oct 22 22:58:55 2019 +0200
@@ -129,10 +129,10 @@
if(previous_period != new_period) {
subscriptions[index] = new_period;
- delta.push(new Blob([
+ delta.push(
new Uint8Array([2]), /* subscribe = 2 */
new Uint32Array([index]),
- new Uint16Array([new_period])]));
+ new Uint16Array([new_period]));
}
}
@@ -140,12 +140,12 @@
};
function send_hmi_value(index, value) {
- iectype = hmitree_types[index];
- jstype = typedarray_types[iectype];
+ let iectype = hmitree_types[index];
+ let jstype = typedarray_types[iectype];
send_blob([
new Uint8Array([0]), /* setval = 0 */
- new jstype([value])
- ]);
+ new Uint32Array([index]),
+ new jstype([value])]);
};