# HG changeset patch # User Edouard Tisserant # Date 1613471520 -3600 # Node ID 80ebb88cf7b712a22ab9a73d9278109685cccb0f # Parent 8388e6d4aa615e6da91b6c656221e99c2b5bbbdc SVGHMI: Fixed sending HMI_REAL to PLC. Added a svghmi_real test that illustrates using printf style formating in HMI:Display to control precision of Float number display. diff -r 8388e6d4aa61 -r 80ebb88cf7b7 svghmi/svghmi.js --- a/svghmi/svghmi.js Mon Feb 15 15:46:47 2021 +0100 +++ b/svghmi/svghmi.js Tue Feb 16 11:32:00 2021 +0100 @@ -142,6 +142,7 @@ INT: (number) => new Int16Array([number]), BOOL: (truth) => new Int16Array([truth]), NODE: (truth) => new Int16Array([truth]), + REAL: (number) => new Float32Array([number]), STRING: (str) => { // beremiz default string max size is 128 str = str.slice(0,128); diff -r 8388e6d4aa61 -r 80ebb88cf7b7 tests/svghmi_real/beremiz.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/svghmi_real/beremiz.xml Tue Feb 16 11:32:00 2021 +0100 @@ -0,0 +1,5 @@ + + + + + diff -r 8388e6d4aa61 -r 80ebb88cf7b7 tests/svghmi_real/plc.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/svghmi_real/plc.xml Tue Feb 16 11:32:00 2021 +0100 @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + var0 + + + + + + + + + + + + + var1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 8388e6d4aa61 -r 80ebb88cf7b7 tests/svghmi_real/svghmi_0@svghmi/baseconfnode.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/svghmi_real/svghmi_0@svghmi/baseconfnode.xml Tue Feb 16 11:32:00 2021 +0100 @@ -0,0 +1,2 @@ + + diff -r 8388e6d4aa61 -r 80ebb88cf7b7 tests/svghmi_real/svghmi_0@svghmi/confnode.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/svghmi_real/svghmi_0@svghmi/confnode.xml Tue Feb 16 11:32:00 2021 +0100 @@ -0,0 +1,2 @@ + + diff -r 8388e6d4aa61 -r 80ebb88cf7b7 tests/svghmi_real/svghmi_0@svghmi/svghmi.svg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/svghmi_real/svghmi_0@svghmi/svghmi.svg Tue Feb 16 11:32:00 2021 +0100 @@ -0,0 +1,647 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + number + + + + + + + + 7 + + + + 4 + + + + 1 + + + + 8 + + + + 5 + + + + 2 + + + + 9 + + + + 6 + + + + 3 + + + + 0 + + + + + Esc + + + + + + + + +/- + + information + + + . + + + + + + 1234 + + + -1 + + + + -10 + + + + +1 + + + + +10 + + + + +.1 + + + + -.1 + + + + %.2f + + + %d + + + temp: %.2f℃ + + + ratio: %.2f%% + + + padded: %'04d + + + this way, %d and %.3f are together + +