# HG changeset patch # User Edouard Tisserant # Date 1570008662 -7200 # Node ID ba0dd2ec6dc419945b029ab04cae1477d11c31a1 # Parent 2ed9ff826d03370dfde9a67348fba9fab847337c SVGHMI: now built. diff -r 2ed9ff826d03 -r ba0dd2ec6dc4 svghmi/gen_index_xhtml.xslt --- a/svghmi/gen_index_xhtml.xslt Mon Sep 30 13:26:11 2019 +0200 +++ b/svghmi/gen_index_xhtml.xslt Wed Oct 02 11:31:02 2019 +0200 @@ -111,7 +111,7 @@ "; - + name = " "; diff -r 2ed9ff826d03 -r ba0dd2ec6dc4 svghmi/gen_index_xhtml.ysl2 --- a/svghmi/gen_index_xhtml.ysl2 Mon Sep 30 13:26:11 2019 +0200 +++ b/svghmi/gen_index_xhtml.ysl2 Wed Oct 02 11:31:02 2019 +0200 @@ -87,7 +87,7 @@ || /* if label is used, use it as default name */ - if "«@inkscape:label»" + if "@inkscape:label" |> name = "«@inkscape:label»"; | /* -------------- */ diff -r 2ed9ff826d03 -r ba0dd2ec6dc4 svghmi/svghmi.c --- a/svghmi/svghmi.c Mon Sep 30 13:26:11 2019 +0200 +++ b/svghmi/svghmi.c Wed Oct 02 11:31:02 2019 +0200 @@ -60,7 +60,7 @@ %(variable_decl_array)s }; -typedef int(*hmi_tree_iterator)(uint32_t*, hmi_tree_item_t*); +typedef int(*hmi_tree_iterator)(uint32_t, hmi_tree_item_t*); static int traverse_hmi_tree(hmi_tree_iterator fp) { unsigned int i; @@ -76,7 +76,7 @@ %(var_access_code)s -inline int write_iterator(uint32_t index, hmi_tree_item_t *dsc) +static int write_iterator(uint32_t index, hmi_tree_item_t *dsc) { if(AtomicCompareExchange(&dsc->wlock, 0, 1) == 0) { @@ -114,7 +114,7 @@ return 0; } -inline int send_iterator(uint32_t index, hmi_tree_item_t *dsc) +static int send_iterator(uint32_t index, hmi_tree_item_t *dsc) { int res = 0; while(AtomicCompareExchange(&dsc->wlock, 0, 1)) sched_yield(); @@ -141,7 +141,7 @@ return res; } -inline int read_iterator(uint32_t index, hmi_tree_item_t *dsc) +static int read_iterator(uint32_t index, hmi_tree_item_t *dsc) { if(AtomicCompareExchange(&dsc->rlock, 0, 1) == 0) { @@ -167,9 +167,9 @@ AtomicCompareExchange(&dsc->wlock, 1, 0); } -inline int reset_iterator(uint32_t index, hmi_tree_item_t *dsc) -{ - update_refresh_period(*dsc, 0); +static int reset_iterator(uint32_t index, hmi_tree_item_t *dsc) +{ + update_refresh_period(dsc, 0); return 0; } @@ -250,10 +250,10 @@ const uint8_t* cursor = ptr + HMI_HASH_SIZE; const uint8_t* end = ptr + size; - printf("svghmi_recv_dispatch %d\n",size); + printf("svghmi_recv_dispatch %%d\n",size); /* match hmitree fingerprint */ - if(size <= HMI_HASH_SIZE || memcmp(ptr, hmihash, HMI_HASH_SIZE) != 0) + if(size <= HMI_HASH_SIZE || memcmp(ptr, hmi_hash, HMI_HASH_SIZE) != 0) { printf("svghmi_recv_dispatch MISMATCH !!\n"); return EINVAL; @@ -268,7 +268,7 @@ case setval: { uint32_t index = *(uint32_t*)(cursor); - uint8_t *valptr = cursor + sizeof(uint32_t); + uint8_t const *valptr = cursor + sizeof(uint32_t); if(index < HMI_ITEM_COUNT) { @@ -279,7 +279,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(); @@ -311,7 +311,7 @@ if(index < HMI_ITEM_COUNT) { hmi_tree_item_t *dsc = &hmi_tree_item[index]; - update_refresh_period(*dsc, refresh_period_ms); + update_refresh_period(dsc, refresh_period_ms); } else return -EINVAL; @@ -322,6 +322,8 @@ case unsubscribe: { + uint32_t index = *(uint32_t*)(cursor); + if(index < HMI_ITEM_COUNT) { hmi_tree_item_t *dsc = &hmi_tree_item[index]; diff -r 2ed9ff826d03 -r ba0dd2ec6dc4 svghmi/svghmi.py --- a/svghmi/svghmi.py Mon Sep 30 13:26:11 2019 +0200 +++ b/svghmi/svghmi.py Wed Oct 02 11:31:02 2019 +0200 @@ -11,6 +11,7 @@ import shutil from itertools import izip, imap from pprint import pprint, pformat +import hashlib import wx @@ -229,7 +230,7 @@ "item_count": item_count, "var_access_code": targets.GetCode("var_access.c"), "PLC_ticktime": self.GetCTR().GetTicktime(), - "hmi_hash_int": ",".join(map(str,hmi_tree_root.hash())) + "hmi_hash_ints": ",".join(map(str,hmi_tree_root.hash())) } gen_svghmi_c_path = os.path.join(buildpath, "svghmi.c")