# HG changeset patch # User Edouard Tisserant # Date 1571777935 -7200 # Node ID 64e6f73b98594be47b2ca02be9b84858cf96a7ba # Parent 390acff12755097cde8b256e4f0dbf19c0a13f4c SVGHMI - Fixed svghmi.{c,js} about HMI -> PLC data unpack. diff -r 390acff12755 -r 64e6f73b9859 svghmi/gen_index_xhtml.xslt --- 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 @@ 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])); } @@ -608,17 +608,17 @@ 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])]); diff -r 390acff12755 -r 64e6f73b9859 svghmi/svghmi.c --- 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(); diff -r 390acff12755 -r 64e6f73b9859 svghmi/svghmi.js --- 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])]); };