How to use new datatype RGB-W - Printable Version +- Logic Machine Forum (https://forum.logicmachine.net) +-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1) +--- Forum: Visualization (https://forum.logicmachine.net/forumdisplay.php?fid=9) +--- Thread: How to use new datatype RGB-W (/showthread.php?tid=2793) Pages:
1
2
|
How to use new datatype RGB-W - gdimaria - 14.08.2020 Hi, I already know how to use RGB datatype (by a little tutorial by schneider), so I can split the value to the 3 objects (Red, Green, Blue) and viceversa. Now how I can do with RGB-white? And I tested it on visualization but it seems to me a little confusion RE: How to use new datatype RGB-W - Daniel - 14.08.2020 What is that you want to use it for? There is dedicated dpt for it and some KNX devices support it. RE: How to use new datatype RGB-W - admin - 14.08.2020 Which browser are you using? The slider is not displayed correctly. Are you using zoom/scaling? RE: How to use new datatype RGB-W - gdimaria - 22.08.2020 (14.08.2020, 12:59)admin Wrote: Which browser are you using? The slider is not displayed correctly. Are you using zoom/scaling? Chrome without any scaling... same on Firefox and Edge. I just want to let the user to click on RGB-W icon to set it. On the other side I would like to update the value when I set it with a script. That's a ordinary conversion I do with a script for a RGB: Write to RGB ---------------- Red = bit.rshift(bit.band(value, 0xFF0000), 16) Green = bit.rshift(bit.band(value, 0xFF00), 8) Blue = bit.band(value, 0xFF) grp.write(redGroup, Red, dt.uint8) grp.write(greenGroup, Green, dt.uint8) grp.write(blueGroup, Blue, dt.uint8) Read RGB ------------ red = grp.find(redGroup) green = grp.find(greenGroup) blue = grp.find(blueGroup) redHex = red.datahex greenHex = green.datahex blueHex = blue.datahex RGB = lmcore.hextoint(redHex..greenHex..blueHex) grp.update(rgbGroup, RGB) Now how I a can do the same with a RGB-W object, which is made up of 4 scale % objects: RED - GREEN - BLU - WHITE? Thanks. Peppe RE: How to use new datatype RGB-W - Erwin van der Zwart - 23.08.2020 Hi, Use this for 4 byte RGBW: Code: value = event.getvalue() Erwin RE: How to use new datatype RGB-W - gdimaria - 23.08.2020 Thank you so much! BR Peppe RE: How to use new datatype RGB-W - gdimaria - 25.08.2020 (23.08.2020, 10:02)Erwin van der Zwart Wrote: Hi, I think there is a little mistake in that code because the colors shown by the icon don't match both ways: splitting and merging. RE: How to use new datatype RGB-W - Erwin van der Zwart - 25.08.2020 Hi, Just tested it and works as it should, are you using dpt 12.600? BR, Erwin RE: How to use new datatype RGB-W - gdimaria - 25.08.2020 (25.08.2020, 10:45)Erwin van der Zwart Wrote: Hi,yes, I do.... and I use 05.001 scale for R, G, B and W. Maybe it depends about when both scprits are enabled, they generate a sort of loop back. Here are my script: EVENT SCRIPT 'mergeRGBW' R= grp.getvalue('32/3/1') G = grp.getvalue('32/3/2') B= grp.getvalue('32/3/3') W = grp.getvalue('32/3/4') RGBW = R * 0x1000000 + G * 0x10000 + B * 0x100 + W if RGBW ~= grp.getvalue('32/1/20') then grp.update('32/1/20', RGBW) --- icon address alert (RGBW) end EVENT SCRIPT 'splitRGB' value = event.getvalue() ---- from 32/1/20 icon address -- Split R = bit.rshift(bit.band(value,0xff000000),24) G = bit.rshift(bit.band(value,0x00ff0000),16) B = bit.rshift(bit.band(value,0x0000ff00),8) W = bit.band(value,0x000000ff) if R ~= grp.getvalue('32/3/1') then grp.update('32/3/1', R) alert® end if R ~= grp.getvalue('32/3/2') then grp.update('32/3/2', G) alert(G) end if R ~= grp.getvalue('32/3/3') then grp.update('32/3/3', B) alert(B) end if R ~= grp.getvalue('32/3/4') then grp.update('32/3/4', W) alert(W) end That's all. Still, there is a visualization issue like a reattach here RE: How to use new datatype RGB-W - admin - 25.08.2020 See if this Custom CSS fixes the slider layout for you: Code: .slider-wrap { Add this to both of your scripts to prevent loops: Code: if event.sender == 'se' then RE: How to use new datatype RGB-W - gdimaria - 25.08.2020 (25.08.2020, 11:38)admin Wrote: See if this Custom CSS fixes the slider layout for you: OK! Now everything is fine, thank you so much! Just to a better understanding: what is the core difference between grp.checkupdate, grp.getvalue and grp.update? Thank you for everything BR PEPPE RE: How to use new datatype RGB-W - admin - 25.08.2020 See Lua documentation here: https://openrb.com/docs/lua.htm#grp.checkwrite The basic idea is to write less code by using built-in functions instead of writing more complex code, which leads to more possible errors. RE: How to use new datatype RGB-W - Erwin van der Zwart - 25.08.2020 Hi, I think your issue with the merge is in the 5.001 scale objects as they return 0-100 within the script engine instead of 0-255, when you split/merge a RGBW value you will have 0-255 format so you might want to use a calculation R = math.round((R * 2.55),0) before pushing it to the merge calculation (and do the same with other 3 colors) BR, Erwin RE: How to use new datatype RGB-W - Daniel - 25.08.2020 When merging it is better to use hex values as then it is dpt independent(still 1 byte). Updated the old RGB script, not tested Code: ------------------- Configurable parameters ------------------------------------ RE: How to use new datatype RGB-W - gdimaria - 26.08.2020 (25.08.2020, 15:43)Erwin van der Zwart Wrote: Hi, yes, I noticed it and fixed, thanks. Here another issue with visualization (see attached pic): what are the black spot on preset? How to avoid that? RE: How to use new datatype RGB-W - admin - 26.08.2020 Black spot is W value of RGBW RE: How to use new datatype RGB-W - Daniel - 26.08.2020 This is the white status. Change the white value and it will have different colour RE: How to use new datatype RGB-W - gdimaria - 26.08.2020 (26.08.2020, 08:12)Daniel. Wrote: This is the white status. Change the white value and it will have different colourOk sorry to not understood! RE: Urgent! - gdimaria - 18.09.2020 Sorry, my script was working on the LM (firmware 20200720) in our office. Today I restored it on a new LM (firmware 20200727) at customers' and it doesn't work and give me the attached warning. We are blocked now. Can you please help me? Thanks Peppe RE: How to use new datatype RGB-W - Daniel - 18.09.2020 Paste the script as a code not image |