Given that you will allow different times for the peak-hold... can you not just have a peak-hold variable - and accept numeric values (in mS maybe) - and text for off and infinite (or permanent).
Not sure about msg.peak.... what happens if msg.peak is smaller than msg.payload ?
It will be easy to implement but will it be easy to understand from user perspective without deeply digging into nodes info page. Explaining such stuff with easy to understand sentences is kind of challenge. Well for me at least. As I understand the world wide, for sure ther is users with wide range of results of making sense of terminology. I just try to make it as straightforward as possible.
well - if you will keep adding options ....it will get more complex...
Personally I would just have off or peak hold mode - which decays over time (like those good old fashioned VU meters) - and only work off the incoming payload.
Since v0.1.9
Peak option
As advised the complexity is avoided.
Peak option is available only if color option Multiple segments is used (default).
Peak hold time is adjustable in range 800ms ... 10000ms
The time range is fine if the node is used as a VU meter type display, but having a maximum delay of 10 seconds does cut down the number of applications where this could be useful.
For example; monitoring processor temperature - if the temperature increased and then reduced back down, the peak temp would only show this for 10 seconds, and unless you're constantly looking at the display - it would be lost.
IMO, the below would allow far greater flexibility.
However, I can perfectly understand your wish to avoid complexity, and grateful for the work you have done implementing this feature.
It will be changed tomorrow
I noticed that the peak value does not animate in the same way the actual value (instead of falling to the current value, it just disappears.
Is that by design.
It is by design and probably stays that way. Peak pixel has no animations, it just moved to position if peak value rises. If delay is reached the current value is equal with peak value and there is no visible peak.
Animating the peak pixel (decay by fade or step down) is possible but I didn't create that just to keep overall performance as good as possible. It is not that important i think.
I love how it is coming on.
A thought:
And sorry if I am not exact on things I say. Brain still booting.
You are discussing a peak
indication and a peak-hold
.
peak
could be to signal that you want to indicate/display the peak value.
peak-hold
is a time value for how long it holds the display.
Idea:
peak
is easy. It is a simple tick button/box. It is either on or off.
peak-hold
is a value (number) from (nominal) 1 to 2,001
Ok, Why the weird number as the maximum?
Reason, it helps distinguish it.
Normally people want the peak-hold to be akin the old VU meters of sound systems, and display the peak for a short while.
My trick is that it is normal to have a peak hold for up to 2 seconds. (That is nominal as said.)
Having a peak-HOLD where if holds the maximum value for . . . . ever, or until reset.
You set the value to 2,001. (Comma only there for effect)
Then the user knows that it will be held and it is a concous (? spelling) entry to enter 2001 and not 2000.
Why starting at one?
Sending a peak-hold
value of 0
resets the indication.
This cuts down on the vocabulary size the node needs to understand.
I think messages are getting crossed here. (Pun intended)
msg.peak - as I read it would only be a boolean on/off and is used to indicate that the peak value should be held for a time set by msg.peak-hold
(or via context if not in the message).
Is that helpful or confusing?
I suppose you could apply the same determination about the animations being applied to the normal level readings, yet those have been implemented.
Would it make such a difference to performance?
The 'peak' readings would decay/step down far less often than the normal level readings, and therefore have a lesser effect upon performance.
Also, if peak animations were linked to normal animations, there would not be the need for further dialogues in the node settings, and if performance was an issue- then of course animations could be turned off.
I only comment because this is common display format for digital VU displays, and is a nice enhancement to compliment the normal level reading animations.
But I of course realize that it's your node, and I'll respect whatever decision you make.
Paul
This statement is not valid anymore.
After constructive feedback there is a bit more work to do than I can fit into one day.
Thank you @Paul-Reed @Trying_to_learn and @dceejay
Digging deeply into it.
Truth is a function of time.
Since v0.1.10
Peak option improvement
- Peak time can be configured to infinity (reset peak via
msg.peakreset = true
)
- Peak pixel is animated (if overall animations enabled)
This is complicated stuff, I can tell. It is not perfect and in some situations peak may behave slightly not as expected. There is a lot of timing relations and as the peak time configuration is kind of wide range and node can not predict how often new messages will come in and now if animations added (witch creates another layer of timings), it is nearly impossible to find bulletproof solution.
But what can break can also fix it. If peak does not behave correctly - adjust the peak hold time. It may help.
But overall, it seems a nice little addition for the ui-level and I am pretty happy about it.
@hotNipi - The info panel say's;
"... or infinity
to hold peak until node receives `msg.peakreset = true``"
But not working here, maybe I've got it wrong..
Please try this test flow.
[{"id":"3ea15e0c.420722","type":"ui_level","z":"c53060.842a0fa","group":"61d2dced.3db8f4","order":4,"width":"9","height":"1","name":"","label":"","colorHi":"#ff8080","colorWarn":"#ff9900","colorNormal":"#00b33c","colorOff":"#595959","min":0,"max":100,"segWarn":"","segHigh":"","unit":"units","layout":"sh","channelA":"","channelB":"","decimals":0,"animations":"soft","shape":"2","colorschema":"fixed","textoptions":"default","colorText":"#eeeeee","fontLabel":"","fontValue":"","fontSmall":"","colorFromTheme":true,"textAnimations":false,"hideValue":false,"peakmode":true,"peaktime":"infinity","x":630,"y":1060,"wires":[]},{"id":"b0904125.036b2","type":"random","z":"c53060.842a0fa","name":"","low":"1","high":"50","inte":"true","property":"payload","x":400,"y":1020,"wires":[["3ea15e0c.420722"]]},{"id":"1d55bf27.ac78b1","type":"inject","z":"c53060.842a0fa","name":"","topic":"","payload":"","payloadType":"date","repeat":"1","crontab":"","once":false,"onceDelay":0.1,"x":210,"y":1020,"wires":[["b0904125.036b2"]]},{"id":"9481bc72.f3a76","type":"inject","z":"c53060.842a0fa","name":"","topic":"","payload":"88","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":230,"y":1060,"wires":[["3ea15e0c.420722"]]},{"id":"21f67eab.01a2c2","type":"change","z":"c53060.842a0fa","name":"","rules":[{"t":"set","p":"peakreset","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":1110,"wires":[["3ea15e0c.420722"]]},{"id":"1955a418.4bae3c","type":"inject","z":"c53060.842a0fa","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":230,"y":1110,"wires":[["21f67eab.01a2c2"]]},{"id":"61d2dced.3db8f4","type":"ui_group","z":"","name":"flowtest","tab":"3c94630c.13381c","disp":true,"width":"12","collapse":false},{"id":"3c94630c.13381c","type":"ui_tab","z":0,"name":"Test","icon":"dashboard","order":6}]
True . Fix in v0.1.12
V0.1.15
Without any I just the animations cos I it this way more.
Me too!!
Nice work @hotNipi
Does setting the segment values work in a negative scale?
msg.control = {seg1:-20, seg2:-10};
I'm not seeing segmentation in the demo flow below;
[{"id":"3ea15e0c.420722","type":"ui_level","z":"c53060.842a0fa","group":"61d2dced.3db8f4","order":4,"width":"9","height":"1","name":"","label":"","colorHi":"#ff8080","colorWarn":"#ff9900","colorNormal":"#00b33c","colorOff":"#595959","min":"-30","max":"5","segWarn":"","segHigh":"","unit":"db","layout":"ph","channelA":"Left","channelB":"Right","decimals":0,"animations":"soft","shape":"2","colorschema":"fixed","textoptions":"default","colorText":"#eeeeee","fontLabel":"","fontValue":"","fontSmall":"","colorFromTheme":true,"textAnimations":false,"hideValue":false,"peakmode":true,"peaktime":"800","x":630,"y":1062,"wires":[]},{"id":"3e45963a.b1e58a","type":"function","z":"c53060.842a0fa","name":"","func":"var A = ((Math.floor((Math.random() * 32) + 1)*-1)+2);\nvar B = ((Math.floor((Math.random() * 32) + 1)*-1)+2);\nmsg.payload = [A, B];\nmsg.control = {seg1:-20, seg2:-10};\nreturn msg;","outputs":1,"noerr":0,"x":460,"y":1060,"wires":[["eec99fa.bb4676","3ea15e0c.420722"]]},{"id":"4e3aa107.7291a","type":"inject","z":"c53060.842a0fa","name":"","topic":"","payload":"","payloadType":"date","repeat":"0.8","crontab":"","once":true,"onceDelay":0.1,"x":300,"y":1060,"wires":[["3e45963a.b1e58a"]]},{"id":"eec99fa.bb4676","type":"debug","z":"c53060.842a0fa","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":630,"y":1010,"wires":[]},{"id":"61d2dced.3db8f4","type":"ui_group","z":"","name":"flowtest","tab":"3c94630c.13381c","disp":true,"width":"12","collapse":false},{"id":"3c94630c.13381c","type":"ui_tab","z":0,"name":"Test","icon":"dashboard","order":6}]
Will investigate segment stuff tomorrow.
Pair layout fit into one unit height is something I never considered. Should it be covered?
With your setup you are changing segments with every incoming message (with rate of 800ms). That is not practical use of changing the options on fly. But negative values seems to work for me. I think you can try it with some more reasonable test case?
Maybe. I was rushing with the demo and overlooked it (I've now updated the demo image above to 2 units high)
I'm not changing the segments, the segments remain a constant {seg1:-20, seg2:-10}
(but it is refreshed with every incoming message).
Not a problem though.