From 61238eecd2496ad711cc60a56fda00cae2dd6fd1 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Mon, 11 Feb 2013 13:21:37 +0100 Subject: Updates. TBT --- scripts/global.lua | 4 ++ scripts/global_custom_scripts.lua | 108 +++++++++++++++++++++++--------------- scripts/slimax_script_readme.txt | 4 +- 3 files changed, 72 insertions(+), 44 deletions(-) diff --git a/scripts/global.lua b/scripts/global.lua index 2d6cf3e..fef9ac6 100755 --- a/scripts/global.lua +++ b/scripts/global.lua @@ -261,6 +261,10 @@ function GetSLIMaxInfo() if mOSPBlinkTime == nil then mOSPBlinkTime = 32 end 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 + -- get current speed Limiter LED index mSpeedLimiterLED = GetContextInfo("ledspeedlimiterindex") if mSpeedLimiterLED == nil then mSpeedLimiterLED = 5 end diff --git a/scripts/global_custom_scripts.lua b/scripts/global_custom_scripts.lua index 55ae244..9c2d337 100755 --- a/scripts/global_custom_scripts.lua +++ b/scripts/global_custom_scripts.lua @@ -66,77 +66,101 @@ function global_custom_rightDigitsEvent(swPosition) end function global_custom_spdLmtMethodEvent(idx) - if idx > 2 then - -- reinit RPM leds only if method > 2 - initLedTable(mRPMLedTable, 0) - SetRPMLed("mRPMLedTable") - end + if idx > 2 then + -- reinit RPM leds only if method > 2 + initLedTable(mRPMLedTable, 0) + SetRPMLed("mRPMLedTable") + end - -- continue with standard behaviour + -- continue with standard behaviour return 2 end function global_custom_gearEvent(gear) -- type your custom gear event script here - -- check if gear == 'E' (see ascii table ) - if gear == 69 then + -- check if gear == 'E' (see ascii table ) + if gear == 69 then - -- toggle OFF in this example - toggleAllLed(0) + -- toggle OFF in this example + toggleAllLed(0) - -- control gear digit display - SetGearDigit(GetCurrentGear()) + -- control gear digit display + SetGearDigit(GetCurrentGear()) - -- control left panel (6 chars max) - -- nothing display in this example - local ldigits = " " - SetLeftDigits( ldigits ) - -- control right panel (6 chars max) - -- nothing display in this example - local rdigits = " " - SetRightDigits( rdigits ) + -- control left panel (6 chars max) + -- nothing display in this example + local ldigits = " " + SetLeftDigits( ldigits ) + -- control right panel (6 chars max) + -- nothing display in this example + local rdigits = " " + SetRightDigits( rdigits ) - -- refresh SLI board - SLISendReport(1) + -- refresh SLI board + SLISendReport(1) - -- return 1 to bypass std behavior - return 1 - end + -- return 1 to bypass std behavior + return 1 + end return 2 end function global_custom_enterSessionEvent(devType) - initLedTable(mRPMLedTable,0) + initLedTable(mRPMLedTable,0) SetRPMLed("mRPMLedTable") - for j = 1, 0 do - for i = 0, 12 do - led = led.format("RPM%d",i) - mRPMLedTable[led] = j - SetRPMLed("mRPMLedTable") - print( string.format("rpm%d : %d", i, j)) - win.Sleep(200) - end - end + for j = 1, 0 do + for i = 0, 6 do + led = led.format("RPM%d", i) + mRPMLedTable[led] = j + led = led.format("RPM%d",12-i) + mRPMLedTable[led] = j + SetRPMLed("mRPMLedTable") + SLISleep(200) + end + end + + for j = 1,0 do + for i = 0,2 do + SetWarnLed(1+i, j) + SetWarnLed(6-i, j) + SetExtLed(1+i, j) + SetExtLed(5-i, j) + SLISleep(200) + end + end - return 2 + return 1 end function global_custom_exitSessionEvent(devType) -- type your custom script on session ending, here - local ldigits = " exit " - SetLeftDigits( ldigits ) - local rdigits = " exit " - SetRightDigits( rdigits ) + local ldigits = " exit " + SetLeftDigits( ldigits ) + local rdigits = " exit " + SetRightDigits( rdigits ) - -- refresh SLI board - SLISendReport(1) + -- refresh SLI board + SLISendReport(1) return 1 end function global_custom_ledEvent(idx, ledFunction, state) + -- bypass for power led -- + if ledFunction == 10 + then + if mPowerLED > 0 + then + if mPowerLED > 6 + then + setExtLed(mPowerLED - 6, state) + else + setWarnLed(mPowerLED, state) + end + -- continue + end return 2 end diff --git a/scripts/slimax_script_readme.txt b/scripts/slimax_script_readme.txt index 8e5fc44..4090d3b 100755 --- a/scripts/slimax_script_readme.txt +++ b/scripts/slimax_script_readme.txt @@ -135,7 +135,7 @@ param integer = number from 0 to 10 set leds of BU0710 device (e.g. see shiftlights.lua script) --------------------------------------------- -SetGeadDigit(string) +SetGearDigit(string) param string = one char string (i.e. "r" or "n" or "1") set gear digit of current targeted SLI device (e.g. see gear.lua script) @@ -538,4 +538,4 @@ LEFT and RIGHT Functions utilities -- local num_available = FuncGetNewIndex("cfg/sli_left_functions.ecfg") -- or right list: -- local num_available = FuncGetNewIndex("cfg/sli_right_functions.ecfg") --- return value >=100 (0 to 99 are reserved ) \ No newline at end of file +-- return value >=100 (0 to 99 are reserved ) -- cgit v1.2.3