AaronLiddiment / RGBLEDS

Matrix, Text & Sprite libraries for use with FastLED
68 stars 28 forks source link

Multiple scrolling lines issue #8

Closed bikemule closed 9 years ago

bikemule commented 9 years ago

So I am calling ScrollingMsg.SetText like the examples, but when I create a string like: EFFECT_SCROLL_LEFT "first" EFFECT_SCROLL_RIGHT "dnoces" I get three lines displayed:

I have this in my setup(): ScrollingMsg.SetFont(MatriseFontData); ScrollingMsg.Init(&leds, leds.Width(), ScrollingMsg.FontHeight() + 1, 0, 0); ScrollingMsg.SetText((unsigned char *)current_string, sizeof(connect_string)-1); ScrollingMsg.SetTextColrOptions(COLR_RGB | COLR_SINGLE, 0xff, 0x00, 0xff); Options = INSTANT_OPTIONS_MODE; ScrollingMsg.SetOptionsChangeMode(Options);

And this in my loop: FastLED.clear(); if (text_updated || ScrollingMsg.UpdateText() == -1) { ScrollingMsg.SetText(current_string, current_string_size); Options ^= INSTANT_OPTIONS_MODE; ScrollingMsg.SetOptionsChangeMode(Options); text_updated = 0; }

These are both pretty much copied from the examples, but I think I'm doing something wrong. Possibly related: when I am only scrolling one line, the text will scroll partway, then stop, restart, and scroll fully.

AaronLiddiment commented 9 years ago

Its the INSTANT_OPTIONS_MODE, you haven't mentioned how wide your display is but I am guessing it is wider than the text "first". Basically, by default, any change of scroll direction in the text message or end of message will not happen until the previous displayable message has scrolled off the display, but when the INSTANT mode is enabled they take effect straight away. Usually when using the INSTANT mode you will also need to use extra spaces to get the effect you are after. In the above code you will be seeing both of these effects as in the loop code you are flipping the INSTANT mode every time the text message restarts.

bikemule commented 9 years ago

Thanks for the prompt reply. I understand now. I put the INSTANT_OPTIONS_MODE flipping while initially trying to get parts of the code to work, thinking it was necessary for some reason.

bikemule commented 9 years ago

I guess one related question while this is open, how can I get two separate EFFECT_SCROLL_LEFT effects in the same string one after the other? If I have EFFECT_SCROLL_LEFT "FOO" EFFECT_SCROLL_LEFT "BAR" I just get FOOBAR.

AaronLiddiment commented 9 years ago

Hi, Any scroll direction command will remain active until a new direction is set, so if you want to just have text scrolling left as in your example you should just put spaces between the words to spread them out. If you only want one word visible at a time just put enough spaces in to cover the display width.

bikemule commented 9 years ago

Perfect. I get it. Thanks so much for all your work and super-responsive help!