From 922efe9210d514a94f4c7abdb8b54a2c3735af4c Mon Sep 17 00:00:00 2001 From: Vanessa Dannenberg Date: Fri, 17 Aug 2018 10:07:34 -0400 Subject: [PATCH] clarify README regarding scrolling also make sure to `return false` from the scroll_text function if the scroll timer was last set to a value below the allowed minimum (which would mean the user/program intended to shut it off by setting it to 0, or the stepper was called manually, implying no timer) --- README.md | 6 +++--- init.lua | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 05c637b..3ee0a57 100644 --- a/README.md +++ b/README.md @@ -43,10 +43,10 @@ The panels also respond to these control messages: * "off_multi" or "clear" turns all panels in a lineup or wall off - essentially a "clear screen" command. * "allon_multi" turns on all LEDs of all panels in a lineup/wall (by filling them with char #144, i.e. the reverse of "clear"). -* "start_scroll" starts the last-displayed message scrolling to the left, automatically moving, and automatically re-starting. The scroll action will spread across and down a multi-line wall (just set a new, different channel on the first row you want to exclude). -* "stop_scroll" actually does nothing, since all printable messages automatically stop the timer, but it's a human-readable way to indicate it. +* "start_scroll" starts the automatic scrolling function, repeatedly moving the last displayed message to the left one character space each time the scroll timer runs out (and automatically restarting it, natch). The scroll action will spread across the line, and down a multi-line wall (just set a new, different channel on the first row you want to exclude), and will continue until "stop_scroll" or any displayable message is received. +* "stop_scroll" does just what it says - it stops the auto-scroll timer. * "scroll_speed" followed by a decimal number (in the string, not a byte value) sets the time between scroll steps. Minimum 0.5s, maximum 5s. -* "scroll_step" will immediately advance the last-displayed message by one character. Omit the "start_scroll" and "scroll_speed" keywords, and use this instead if you want to let your LuaController control the scrolling speed. +* "scroll_step" will immediately advance the last-displayed message by one character. Omit the above automatic scrolling keywords, and use ONLY this keyword instead if you want to let your LuaController control the scrolling speed. If you need vertical scrolling, you will have to handle that yourself (since the size of a screen/wall is not hard-coded). diff --git a/init.lua b/init.lua index c3f8cd6..4167158 100644 --- a/init.lua +++ b/init.lua @@ -77,6 +77,7 @@ led_marquee.scroll_text = function(pos, elapsed) led_marquee.display_msg(pos, channel, msg.." ") if string.byte(string.sub(msg,1,1)) < 32 then index = index + 1 end meta:set_int("index", index + 1) + if not elapsed or elapsed < 0.5 then return false end return true end