# HG changeset patch # User Edouard Tisserant # Date 1596465143 -7200 # Node ID a9a45977bac0f1bd27adad5cdfe3b43f6605ed9d # Parent f87d2ac70d047d95263d49a48852b5fb53d9d00f SVGHMI: prefer apply_hmi_value() to change_hmi_value() when possible diff -r f87d2ac70d04 -r a9a45977bac0 svghmi/svghmi.js --- 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); } }); diff -r f87d2ac70d04 -r a9a45977bac0 svghmi/widget_button.ysl2 --- 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 +}