08.11.2017, 12:30
It can also be done like this, but if you have several error messages the resulting string can be too large (string type is limited to 250 characters).
You can also make it multi-line by replacing '; ' in table.concat with '\n', but then you need some extra CSS:
Set "Additional classes" of your text object to "multiline" (without quotes) in Visualization editor.
Add to Custom CSS (Vis. graphics > Edit custom CSS)
.multiline {
white-space: pre;
text-align: left;
}
Code:
value = event.getvalue()
-- table key is bit number starting from 0
errors = {
[0] = 'Stop & Go ratio ',
[1] = 'Increased position travel ',
[2] = 'Overload, reference position not attained ',
[3] = 'No support at present',
[8] = 'Connected actuator does not correspond to parameterised type',
[9] = 'No communication possible at this address',
[10] = 'Connected actuator signalling error, see Low-Byte',
[11] = 'No valid Min / Max values',
[12] = 'Non-Hall sensor motor actuators only: Actuator not yet synchronised',
[13] = 'Test run active',
[14] = 'Monitoring time of reference value elapsed',
}
result = {}
for i = 0, 15 do
mask = bit.lshift(1, i)
if bit.band(mask, value) ~= 0 then
if errors[ i ] then
table.insert(result, errors[ i ])
end
end
end
text = table.concat(result, '; ')
grp.update('1/1/1', text)
You can also make it multi-line by replacing '; ' in table.concat with '\n', but then you need some extra CSS:
Set "Additional classes" of your text object to "multiline" (without quotes) in Visualization editor.
Add to Custom CSS (Vis. graphics > Edit custom CSS)
.multiline {
white-space: pre;
text-align: left;
}