SVGHMI: prefer apply_hmi_value() to change_hmi_value() when possible svghmi
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Mon, 03 Aug 2020 16:32:23 +0200
branchsvghmi
changeset 3000 a9a45977bac0
parent 2999 f87d2ac70d04
child 3001 003fd80ff0b8
SVGHMI: prefer apply_hmi_value() to change_hmi_value() when possible
svghmi/svghmi.js
svghmi/widget_button.ysl2
--- a/svghmi/svghmi.js	Mon Aug 03 16:30:16 2020 +0200
+++ b/svghmi/svghmi.js	Mon Aug 03 16:32:23 2020 +0200
@@ -191,7 +191,7 @@
     frequency: 1,
     indexes: [heartbeat_index],
     dispatch: function(value) {
-        change_hmi_value(heartbeat_index, "+1");
+        apply_hmi_value(heartbeat_index, value+1);
     }
 });
 
--- a/svghmi/widget_button.ysl2	Mon Aug 03 16:30:16 2020 +0200
+++ b/svghmi/widget_button.ysl2	Mon Aug 03 16:32:23 2020 +0200
@@ -9,14 +9,14 @@
     |         this.active_elt.setAttribute("style", this.active_style);
     |         this.inactive_elt.setAttribute("style", "display:none");
     |     }
-    |     change_hmi_value(this.indexes[0], "=1");
+    |     apply_hmi_value(this.get_idx(0), 1);
     | },
     | on_mouse_up: function(evt) {
     |     if (this.active_style && this.inactive_style) {
     |         this.active_elt.setAttribute("style", "display:none");
     |         this.inactive_elt.setAttribute("style", this.inactive_style);
     |     }
-    |     change_hmi_value(this.indexes[0], "=0");
+    |     apply_hmi_value(this.get_idx(0), 0);
     | },
     | active_style: undefined,
     | inactive_style: undefined,
@@ -30,4 +30,4 @@
     |   this.element.setAttribute("onmousedown", "hmi_widgets['«$hmi_element/@id»'].on_mouse_down(evt)");
     |   this.element.setAttribute("onmouseup", "hmi_widgets['«$hmi_element/@id»'].on_mouse_up(evt)");
     | },
-}
\ No newline at end of file
+}