LED messages leaking to other LED

a place to share your patches and get help with the Max/MSP Dev. Kit.
User avatar
Rodrigo
Posts: 25
Joined: Wed Feb 22, 2012 11:49 am
Location: Manchester, England
Contact:

Re: LED messages leaking to other LED

Postby Rodrigo » Thu Feb 23, 2012 12:12 pm

So your 'yellow off' message is actually independent green/red off messages? So every message you send is at least 3 things?

My plan is doing something likes what you've set up that it changes to a new color regardless of what's going on.
Peter Ostry
Posts: 23
Joined: Fri Jul 22, 2011 1:56 pm

Re: LED messages leaking to other LED

Postby Peter Ostry » Fri Feb 24, 2012 12:04 am

Rodrigo wrote:So your 'yellow off' message is actually independent green/red off messages? So every message you send is at least 3 things?

Fortunately, with colour number 2, we can switch yellow directly. This gives the same result as setting green and red to the same state. Therefore "yellow off" is perfect to turn a LED off.

To switch the LED #5 to "red slow flashing", first turn the
LED off by sending "yellow off", then set it to the desired state:
40 4, 41 2, 42 0 —> Pad 5, yellow, off (= "LED off")
40 4, 41 1, 42 2 —> Pad 5, red, slow flashing

And to avoid leaking to the next LED because of consecutive
messages you can insert the "dummy" message:
40 4, 41 2, 42 0 —> Pad 5, yellow, off
0 0, 0 0, 0 0 —> dummy to avoid LED-leaking
40 4, 41 1, 42 2 —> Pad 5, red, slow flashing

You may put the whole thing with commas into one
single message box but this is not very convenient:
40 4, 41 2, 42 0, 0 0, 0 0, 0 0, 40 4, 41 1, 42 2

----------

This patch shows a reliable output stage where
you can construct your LED messages as you like:

Image

On the Softstep you may notice that the LED switches a little later and softer than usual. This is because of the dummy message that avoids LED-leaking to the next LED.

----------

To let the LED flash at a custom speed you also use the dummy message, but switching the LED off before each "blink" message would generate unnecessary traffic. Better switch it off when the tempo-pulse starts, afterwards only send the dummy and the blink message at the desired speed:

Image

The metro setting of 120 ms results in a flashing rate
of about 8 Hz which seems to be a practical limit.

Warning:
Apart from the fact that the LED goes twitchy if you set the metro much lower than 120, you can overload the SoftStep buffer and the device gets blocked. Then you need to send a slower pulse for a while to let it recover, or restart the device which is not desirable. The message will still not leak to the next LED because of the dummy message.

==========

I am not sure if the LED leaking comes from the SoftStep itself or from the firmware. My SoftStep is one of the first generation. It may be a good idea to check if your device does the LED leaking.

Turn all LEDs off, paste the following line into a message box and
send it to the device by clicking a couple of times on the box:

Code: Select all

40 2, 41 0, 42 1, 40 2, 41 1, 42 1, 40 2, 41 1, 42 0, 40 2, 41 0, 42 0


Image

These messages go to LED #3 but on my Softstep they operate LEDs #3 and #4 in an irregular pattern. If your SoftStep does the same, you have the LED leaking and should always precede a LED message by the dummy message 0 0, 0 0, 0 0.

I will however ask KMI if sending the dummy is a safe method.
Last edited by Peter Ostry on Fri Feb 24, 2012 12:52 am, edited 2 times in total.
User avatar
Rodrigo
Posts: 25
Joined: Wed Feb 22, 2012 11:49 am
Location: Manchester, England
Contact:

Re: LED messages leaking to other LED

Postby Rodrigo » Fri Feb 24, 2012 12:31 am

I'll test it with your last bit of code, but I get leaking messages using the Kaiser LED abstraction (took me a bit to figure out what was happening).

I would imagine it's firmware related (like an internal 'speedlim' thing so fast messages get muffed up on entry).

Thanks for posting bits of your code as it shows reasonable ways to deal with this stuff.
User avatar
Rodrigo
Posts: 25
Joined: Wed Feb 22, 2012 11:49 am
Location: Manchester, England
Contact:

Re: LED messages leaking to other LED

Postby Rodrigo » Fri Feb 24, 2012 5:01 pm

For some reason I can't seem to be able to use the \ character in an object in Max6. If I make a sprintf object like your example a few posts ago it turns into "sprintf %d %d, %d %d, etc..." rather than having the \, pair.

It kind of breaks that, which sucks.

Looking at using pipe+counter to pass all the messages without dummy messages but with a slight delay between each message to see if that works.
User avatar
Rodrigo
Posts: 25
Joined: Wed Feb 22, 2012 11:49 am
Location: Manchester, England
Contact:

Re: LED messages leaking to other LED

Postby Rodrigo » Fri Feb 24, 2012 5:34 pm

Here's a compact example using your coll idea and some prepend/append so that you can send a single text message "1 red on" and the current LED is turned off, and dummy messages are sent after each thing.

----------begin_max5_patcher----------
1081.3ocyXssiihCD84juBK14gckXivFCA521uioGE4DbRyLfMxX5ail+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0QzmMW+5vprJGyI60uR5la07Sk1pKsURdllrQUk
TUQbCQJEoaqj0mya2Bcz7sTSAUXC7Qrcr2yLmH7cTyXgm6nBP9+wJFdmrmLy
G0bNqe5XyMZUK+2IqRdkXWqI2djffOVEJgVJSYlMr0YPA+9fdJMIgx5tQujz
R8wTYbOuSNscQ1CbH6AMa1ida4CxOgyG+nOsxAsGceZyk8frI9Id9rmHKrG8
NglI6w2l4K8gYLW7i28U7iUzSv7ktGdmYO9VXOyW1E1lr8OYySp8.swdluUK
7so5i+0NeUuXOon3YpnrQmFSQ0Cz24hi6dwQ0ES8iFMpZn94z1wiWp01uV9+
.ozU1uB
-----------end_max5_patcher-----------

And the slightly adjusted entries for coll:

1, 40 0;
2, 40 1;
3, 40 2;
4, 40 3;
5, 40 4;
6, 40 5;
7, 40 6;
8, 40 7;
9, 40 8;
10, 40 9;
green, 41 0;
red, 41 1;
yellow, 41 2;
off, 42 0;
on, 42 1;
slow, 42 2;
fast, 42 3;
blink, 42 4;
Peter Ostry
Posts: 23
Joined: Fri Jul 22, 2011 1:56 pm

Re: LED messages leaking to other LED

Postby Peter Ostry » Sat Feb 25, 2012 2:18 am

Rodrigo wrote:Here's a compact example using your coll idea and some prepend/append so that you can send a single text message "1 red on" and the current LED is turned off, and dummy messages are sent after each thing.

If the LED colors and states are hardcoded in message boxes I would do it differently. And yes, differently from my previous suggestions: There is no need to write CCs for "yellow off" at the output stage. We can send "yellow off" before our LED command and let the [coll] do the work like for all other commands. Then we can just append the dummy to each complete LED message. This is now possible because the [coll] already decoded "yellow off".

    Image
    (I added the "all" message to the [coll] to switch all LEDs at once.)

Here is the patch:

Code: Select all

<pre><code>
----------begin_max5_patcher----------
1182.3oc4Ys0iaiBE94jeEHq9X1QFvWh22p5yUck5isqF4DSRYquDYS5LSq5
+8EC3DOYLNDarmQpZjhGvbfykuy2Av+Z4BmMEORpb.+M3KfEK90xEKDcU2wB
U6ENYwOtMMtRLLmsEYYjblyJ46XjGYh9iSeH9oJP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WV7A9t36IJ31q6+4UipJNVtsoFRy0XCNSumPpXz7XFkGfZMnmMl
uQSRH4s2IaFM4PAe+tUM2wsrtATd8PnysjdfWTzzTkEYjxFbaZK1yqV+fAhM
PqzcQqwpsnIPaQ3oRacm.sUE6su1V+cKsOrcZPs9XCz0KLnqpriTmfFEs4GK
slI8Fi13H4Fp8CN0ZjZ6ZCT1vY0+Ue841F+gmJ.nQzlWXQStCzDxw5KSdN0I
SRJlWUBaTMD3fpgDEJu2nSMlEc08sm+q9ZmGr+SkmZC+mI0zPAyq+yjThKxk
m7ZWdlnSyKN6BlJqTOPAyre8.SJmBmY+mApz5YUilf.5H0HiphOurCFnQyLe
UnApj2Xv17F+d4+yZrm43
-----------end_max5_patcher-----------
</code></pre>


Btw – the dummy message is not safe enough to let us scroll through number boxes and switch different LEDs very fast. However, we are not programming disco lights on the SoftStep. For that we would have to make a controlled step-by-step output stage.
User avatar
Rodrigo
Posts: 25
Joined: Wed Feb 22, 2012 11:49 am
Location: Manchester, England
Contact:

Re: LED messages leaking to other LED

Postby Rodrigo » Sat Feb 25, 2012 6:50 pm

Ideally I'd want to use something like a matrixctrl (10x4) to control off/green/yellow/red (in order to do some monome-like programming), and for the blinking messages just sending it hardcoded message boxes.

Aren't both of our patches outputting the same thing anyways?
Peter Ostry
Posts: 23
Joined: Fri Jul 22, 2011 1:56 pm

Re: LED messages leaking to other LED

Postby Peter Ostry » Sun Feb 26, 2012 7:46 am

Rodrigo wrote:... something like a matrixctrl (10x4) ...

If it is for the LED configuration in your application you could use a 5x4 matrix in dial mode:

    Image

For blinking states you may have a diagonal line through the bullet for slow blinking, a cross for fast, a point for "blink once" or something similar. Or different shapes.
Peter Ostry
Posts: 23
Joined: Fri Jul 22, 2011 1:56 pm

Re: LED messages leaking to other LED

Postby Peter Ostry » Sun Feb 26, 2012 7:49 am

Rodrigo wrote:Aren't both of our patches outputting the same thing anyways?

Don't know which two patches you mean but until now appending the dummy message 0 0 0 0 0 0 to each 3-element-group gave the best result.

But:

I found out where the problem lies. The buffer of the Softstep is ok. The issue is not the speed of messages and slowing them generally down isn't a perfect solution because although it would solve the leaking problem it would also make everything much slower.

The real problem is that the firmware needs to detect the three pairs with CC numbers 40, 41 and 42 and interpret them as a LED message. For that it is simply not fast enough. So we don't need to reduce the overall speed but rather add a pause after each complete LED message. This is the explanation why a dummy message works.

I did a speed test and found out that my dummy message does not reliably prevent LED leaking at higher speeds. But a double dummy does the trick!

If you do this after each complete LED message ...
[append 0 0 0 0 0 0 0 0 0 0 0 0]
... the SoftStep LEDs will never leak.


I sent thousands of LED messages with the "double dummy" as fast as possible through an [uzi]. After that the LEDs flickered for a long time without changing positions or colours which is an indication that the SoftStep buffer works very good. After a while the LEDs were steady.

For me the leaking problem is solved. I will tell KMI what I found out and hopefully they can fix it. If not, the [append] with the "double dummy" will simply stay in my LED output section.
User avatar
Rodrigo
Posts: 25
Joined: Wed Feb 22, 2012 11:49 am
Location: Manchester, England
Contact:

Re: LED messages leaking to other LED

Postby Rodrigo » Sun Feb 26, 2012 2:19 pm

Nice research!

It sucks that it involves a workaround to get it working consistently, so hopefully they can fix it in firmware (have they been good at addressing issues with firmware? I've only recently got one)).

Return to “SoftStep Max/MSP Dev Kit forum”

Who is online

Users browsing this forum: No registered users and 1 guest