From 2a02bb7ee34d426afe2e974067c4a9ea470c3753 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Tue, 12 Feb 2013 05:20:35 +0100 Subject: Test de Marquee --- scripts/global.lua | 39 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 2 deletions(-) (limited to 'scripts/global.lua') diff --git a/scripts/global.lua b/scripts/global.lua index fef9ac6..9cfc573 100755 --- a/scripts/global.lua +++ b/scripts/global.lua @@ -262,8 +262,8 @@ function GetSLIMaxInfo() if mOSPBlinkTime < 1 or mOSPBlinkTime > 48 then mOSPBlinkTime = 32 end -- get current Power LED index - mPowerLED = GetContextInfo("ledpowerindex") - if mPowerLED == nil then mPowerLED = 11 end + --mPowerLED = GetContextInfo("ledpowerindex") + --if mPowerLED == nil then mPowerLED = 11 end -- get current speed Limiter LED index mSpeedLimiterLED = GetContextInfo("ledspeedlimiterindex") @@ -441,6 +441,41 @@ function GetCurrentGear() return result end +-- marquee +function Marquee(mString, mDelay) + local length = string.len(mString) + + for i = 1,length+12 do + + local mRight = "" + local mIddle = " " + local mLeft = "" + + -- right + for j = i-5,i do + if j <= 0 then mRight = mRight .. " " end + if j > 0 and j <= length then mRight = mRight .. string.sub(mString, j, j) end + if j > length then mRight = mRight .. " " end + end + -- middle + j = i - 6 + if j > 0 and j <= length then mIddle = string.sub(mString, j , j) end + -- left + for j = i-12,i-7 do + if j <= 0 then mLeft = mLeft .. " " end + if j > 0 and j <= length then mLeft = mLeft .. string.sub(mString, j, j) end + if j > length then mLeft = mLeft .. " " end + end + + + SetRightDigits(mRight) + SetGearDigit(mIddle) + SetLeftDigits(mLeft) + + SLISendReport(1) + SLISleep(mDelay) + end +end --============================================== require "scripts/slidevice" -- cgit v1.2.3