--- a/svghmi/svghmi.c Wed Dec 15 11:56:34 2021 +0100
+++ b/svghmi/svghmi.c Thu Dec 16 08:15:34 2021 +0100
@@ -87,9 +87,8 @@
uint32_t session_index = 0;
- void *real_value_p = NULL;
- void *visible_value_p = NULL;
while(session_index < MAX_CONNECTIONS) {
if(dsc->wstate[session_index] == buf_set){
/* if being subscribed */
@@ -111,17 +110,14 @@
int already_subscribed = dsc->refresh_period_ms[session_index] > 0;
- visible_value_p = UnpackVar(dsc, &real_value_p, &flags);
+ UnpackVar(dsc, &value_p, NULL, &sz); - sz = ((STRING*)visible_value_p)->len + 1;
- sz = __get_type_enum_size(dsc->type);
+ sz = ((STRING*)value_p)->len + 1; dest_p = &wbuf[dsc->buf_index];
- value_changed = memcmp(dest_p, visible_value_p, sz) != 0;
+ value_changed = memcmp(dest_p, value_p, sz) != 0; do_sample = value_changed;
@@ -149,7 +145,7 @@
/* copy value if changed (and subscribed) */
- memcpy(dest_p, visible_value_p, sz);
+ memcpy(dest_p, value_p, sz); // else ... : PLC can't wait, variable will be updated next turn
@@ -189,10 +185,10 @@
if(dsc->rstate == buf_set)
void *src_p = &rbuf[dsc->buf_index];
- void *real_value_p = NULL;
- void *visible_value_p = UnpackVar(dsc, &real_value_p, &flags);
- memcpy(real_value_p, src_p, __get_type_enum_size(dsc->type));
+ UnpackVar(dsc, &value_p, NULL, &sz); + memcpy(value_p, src_p, sz); @@ -378,11 +374,10 @@
if(index < HMI_ITEM_COUNT)
hmi_tree_item_t *dsc = &hmi_tree_item[index];
- void *real_value_p = NULL;
- void *visible_value_p = UnpackVar(dsc, &real_value_p, &flags);
+ UnpackVar(dsc, &value_p, NULL, &sz); void *dst_p = &rbuf[dsc->buf_index];
- uint32_t sz = __get_type_enum_size(dsc->type);
sz = ((STRING*)valptr)->len + 1;