lpcmanager

Parents 7b2269900873
Children 1e0b5e72022a
HMI:VarSync widget to sync between PLC and HMI local variable, to use for languages.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/LPCSVGHMI/widget_varsync.ysl2 Mon Jan 26 11:31:16 2026 +0100
@@ -0,0 +1,24 @@
+widget_class("VarSync") {
+ ||
+ dispatch(value, oldval, varnum) {
+ if (varnum === 0) {
+ let dest_index = this.get_variable_index(1);
+ let current_dest_val = cache[dest_index];
+
+ if (value !== current_dest_val) {
+ this.apply_hmi_value(1, value);
+ }
+ }
+ else if (varnum === 1) {
+ let src_index = this.get_variable_index(0);
+ if (value !== cache[src_index]) {
+ this.apply_hmi_value(0, value);
+ }
+ }
+ }
+
+ init() {
+ this.element.style.display = "none";
+ }
+ ||
+}