--- a/svghmi/svghmi.js Thu Dec 24 16:56:19 2020 +0100
+++ b/svghmi/svghmi.js Thu Dec 24 17:00:43 2020 +0100
@@ -267,21 +267,20 @@
const quotes = {"'":null, '"':null};
-function change_hmi_value(index, opstr) {
+function eval_operation_string(old_val, opstr) { - return undefined; // TODO raise
- return undefined; // TODO raise
if(opstr[opstr.length-1] == opstr[1]){
given_val = opstr.slice(2,opstr.length-1);
given_val = Number(opstr.slice(1));
- let old_val = cache[index];
@@ -300,11 +299,19 @@
new_val = old_val / given_val;
+function change_hmi_value(index, opstr) { + let old_val = cache[index]; + let new_val = eval_operation_string(old_val, opstr); if(new_val != undefined && old_val != new_val)
send_hmi_value(index, new_val);
var current_visible_page;
var current_subscribed_page;
--- a/svghmi/widgets_common.ysl2 Thu Dec 24 16:56:19 2020 +0100
+++ b/svghmi/widgets_common.ysl2 Thu Dec 24 17:00:43 2020 +0100
@@ -182,10 +182,13 @@
change_hmi_value(index, opstr) {
let realindex = this.get_variable_index(index);
if(realindex == undefined) return undefined;
- return change_hmi_value(realindex, opstr);
+ let old_val = cache[realindex]; + let new_val = eval_operation_string(old_val, opstr); + return apply_hmi_value(realindex, new_val); apply_hmi_value(index, new_val) {