summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorHugues Hiegel <hugues@hiegel.fr>2013-11-18 21:04:19 +0100
committerHugues Hiegel <hugues@hiegel.fr>2013-11-18 21:04:19 +0100
commitdb7d99359d62b05a1f6e2c551106b7bf26764889 (patch)
treea3d1e56b66a17350a0a43cf7fe46f01fee18d312 /scripts
parent1ad1efb122971563299d626e9210d3943e22e70a (diff)
3.3.0.3 -> 3.3.0.5
Diffstat (limited to 'scripts')
-rw-r--r--scripts/controls.lua491
-rw-r--r--scripts/devhook.lua6
-rw-r--r--scripts/fanatec.lua698
-rw-r--r--scripts/functions_tools.lua162
-rw-r--r--scripts/gear.lua166
-rw-r--r--scripts/global.lua592
-rw-r--r--scripts/osp.lua740
-rw-r--r--scripts/shiftlights.lua581
-rw-r--r--scripts/simracedlx.lua847
-rw-r--r--scripts/simracef1.lua993
-rw-r--r--scripts/slidevice.lua1
-rw-r--r--scripts/slimax_script_readme.txt1657
-rw-r--r--scripts/slipro.lua1236
-rw-r--r--scripts/speedlimiter.lua1406
-rw-r--r--scripts/zdoc_scripts/iracing_common_scripts.lua436
-rw-r--r--scripts/zdoc_scripts/iracing_stuff.lua1068
16 files changed, 5671 insertions, 5409 deletions
diff --git a/scripts/controls.lua b/scripts/controls.lua
index f7a532f..3fa3de3 100644
--- a/scripts/controls.lua
+++ b/scripts/controls.lua
@@ -44,256 +44,253 @@ function controlsEvent(deviceType, ctrlType, ctrlPos, value, funcIndex, targetDe
local oldTcks = GetTicks()
- local delay = 333
+ local delay = 600
if funcIndex ~= -1 then
- if IsSLIFunction("maxgear", funcIndex) and mMaxGearFeedbackAllowed then
- -- max gear switch
- -- value from 4 to 7
- local mxgear = 0
- mxgear = GetCarInfo("maxgear")
-
- leftStr = "GEAR "
- rightStr = rightStr.format( "MAX%1d ", mxgear)
-
- -- set digits
- UpdateDigits(leftStr, rightStr)
- SLISendReport(0)
-
- state = 1
- -- set timeout
- oldTcks = GetTicks() + delay
-
- elseif IsSLIFunction("brightness", funcIndex) and mBrightnessFeedbackAllowed then
- -- brightness feedback (switch or buttons)
- BrightnessFeedBack(targetdev)
-
- leftStr = "888888"
- rightStr = "888888"
-
- SLISendReport(0)
-
- state = 1
- -- set timeout
- oldTcks = GetTicks() + delay
-
- elseif IsSLIFunction("ospfactor", funcIndex) then
- print "ospfactor: " .. ospf
- if mOSPFeedbackAllowed then
- -- OSP Factor feedback
- leftStr = "OSP "
-
- local ospf = GetContextInfo("ospfactor")
- rightStr = rightStr.format(" %03d ", ospf)
-
- -- set digits
- UpdateDigits(leftStr, rightStr)
- SLISendReport(0)
-
- state = 1
- -- set timeout
- oldTcks = GetTicks() + delay
- end
-
- elseif IsSLIFunction("speedmetric", funcIndex) and mUnitFeedbackAllowed then
- -- metric KPH or MPH
- local spdm = false
- spdm = GetContextInfo("speedmetric")
-
- leftStr = "SPD "
- rightStr = " KPH "
- if spdm then rightStr = " MPH " end
-
- -- set digits
- UpdateDigits(leftStr, rightStr)
- SLISendReport(0)
-
- state = 1
- -- set timeout
- oldTcks = GetTicks() + delay
-
- elseif dev == "FANATEC" and IsSLIFunction("ospmethod", funcIndex) and mFanatecOSPFeedbackAllowed then
- -- fanatec speedlimitermethod feedback
- local info = GetContextInfo("ospmethod")
- ftecStr = ftecStr.format("P%2d", info+1)
-
- -- set digits
- SetFanatecDigits(ftecStr)
- FanatecSendReport(0)
-
- state = 1
- -- set timeout
- oldTcks = GetTicks() + delay
- elseif dev == "FANATEC" and IsSLIFunction("shiftlightsmethod", funcIndex) and mFanatecShiftlightsFeedbackAllowed then
- -- fanatec speedlimitermethod feedback
- local info = GetContextInfo("shiftlightsmethod")
- ftecStr = ftecStr.format("P%2d", info+1)
-
- -- set digits
- SetFanatecDigits(ftecStr)
- FanatecSendReport(0)
-
- state = 1
- -- set timeout
- oldTcks = GetTicks() + delay
- elseif dev == "FANATEC" and IsSLIFunction("speedlimitermethod", funcIndex) and mFanatecSpeedLimiterFeedbackAllowed then
- -- fanatec speedlimitermethod feedback
- local info = GetContextInfo("speedlimitermethod")
- ftecStr = ftecStr.format("P%2d", info+1)
-
- -- set digits
- SetFanatecDigits(ftecStr)
- FanatecSendReport(0)
-
- state = 1
- -- set timeout
- oldTcks = GetTicks() + delay
-
- elseif IsSLIFunction("fanatecdigits", funcIndex) and mFanatecDigitsFeedbackAllowed then
- -- fanatecdigits feedback
- local info = GetContextInfo("fanatecdigits")
- ftecStr = ftecStr.format("P%2d", info+1)
-
- -- set digits
- SetFanatecDigits(ftecStr)
- FanatecSendReport(0)
-
- state = 1
- -- set timeout
- oldTcks = GetTicks() + delay
-
- elseif IsSLIFunction("rightdigits", funcIndex) and mRightDigitsFeedbackAllowed then
- -- rightdigits feedback
- local info = GetContextInfo("rightdigits")
-
- if ctrlType == 1 then
- leftStr = leftStr.format("B%02d ", ctrlPos)
- else
- leftStr = leftStr.format("S%1d ", ctrlPos)
- end
- rightStr = rightStr.format("P%02d ", info+1)
-
- -- set digits
- UpdateDigits(leftStr, rightStr)
- SLISendReport(0)
-
- state = 1
- -- set timeout
- oldTcks = GetTicks() + delay
-
- elseif IsSLIFunction("leftdigits", funcIndex) and mLeftDigitsFeedbackAllowed then
- -- leftdigits feedback
- local info = GetContextInfo("leftdigits")
- rightStr = leftStr.format("P%02d ", info+1)
-
- if ctrlType == 1 then
- leftStr = rightStr.format("B%02d ", ctrlPos)
- else
- leftStr = rightStr.format("S%1d ", ctrlPos)
- end
-
- -- set digits
- UpdateDigits(leftStr, rightStr)
- SLISendReport(0)
-
- state = 1
- -- set timeout
- oldTcks = GetTicks() + delay
-
- elseif IsSLIFunction("lowfuel", funcIndex) and mLowFuelFeedbackAllowed then
- -- lowfuel feedback
- -- get the option
- local info = GetContextInfo("lowfuel")
-
- -- set digits
- leftStr = leftStr.format("FUEL ", ctrlPos)
- rightStr = rightStr.format("L %02d ", info)
-
- UpdateDigits(leftStr, rightStr)
- SLISendReport(0)
-
- state = 1
- -- set timeout
- oldTcks = GetTicks() + delay
- end
+ if IsSLIFunction("maxgear", funcIndex) and mMaxGearFeedbackAllowed then
+ -- max gear switch
+ -- value from 4 to 7
+ local mxgear = 0
+ mxgear = GetCarInfo("maxgear")
+
+ leftStr = "GEAR "
+ rightStr = rightStr.format( "MAX%1d ", mxgear)
+
+ -- set digits
+ UpdateDigits(leftStr, rightStr)
+ SLISendReport(0)
+
+ state = 1
+ -- set timeout
+ oldTcks = GetTicks() + delay
+
+ elseif IsSLIFunction("brightness", funcIndex) and mBrightnessFeedbackAllowed then
+ -- brightness feedback (switch or buttons)
+ BrightnessFeedBack(targetdev)
+
+ leftStr = "888888"
+ rightStr = "888888"
+
+ SLISendReport(0)
+
+ state = 1
+ -- set timeout
+ oldTcks = GetTicks() + delay
+
+ elseif IsSLIFunction("ospfactor", funcIndex) and mOSPFeedbackAllowed then
+ -- OSP Factor feedback
+ leftStr = "OSP "
+
+ local ospf = GetContextInfo("ospfactor")
+ rightStr = rightStr.format(" %03d ", ospf)
+
+ -- set digits
+ UpdateDigits(leftStr, rightStr)
+ SLISendReport(0)
+
+ state = 1
+ -- set timeout
+ oldTcks = GetTicks() + delay
+
+ elseif IsSLIFunction("speedmetric", funcIndex) and mUnitFeedbackAllowed then
+ -- metric KPH or MPH
+ local spdm = false
+ spdm = GetContextInfo("speedmetric")
+
+ leftStr = "SPD "
+ rightStr = " KPH "
+ if spdm then rightStr = " MPH " end
+
+ -- set digits
+ UpdateDigits(leftStr, rightStr)
+ SLISendReport(0)
+
+ state = 1
+ -- set timeout
+ oldTcks = GetTicks() + delay
+
+ elseif dev == "FANATEC" and IsSLIFunction("ospmethod", funcIndex) and mFanatecOSPFeedbackAllowed then
+ -- fanatec speedlimitermethod feedback
+ local info = GetContextInfo("ospmethod")
+ ftecStr = ftecStr.format("P%2d", info+1)
+
+ -- set digits
+ SetFanatecDigits(ftecStr)
+ FanatecSendReport(0)
+
+ state = 1
+ -- set timeout
+ oldTcks = GetTicks() + delay
+ elseif dev == "FANATEC" and IsSLIFunction("shiftlightsmethod", funcIndex) and mFanatecShiftlightsFeedbackAllowed then
+ -- fanatec speedlimitermethod feedback
+ local info = GetContextInfo("shiftlightsmethod")
+ ftecStr = ftecStr.format("P%2d", info+1)
+
+ -- set digits
+ SetFanatecDigits(ftecStr)
+ FanatecSendReport(0)
+
+ state = 1
+ -- set timeout
+ oldTcks = GetTicks() + delay
+ elseif dev == "FANATEC" and IsSLIFunction("speedlimitermethod", funcIndex) and mFanatecSpeedLimiterFeedbackAllowed then
+ -- fanatec speedlimitermethod feedback
+ local info = GetContextInfo("speedlimitermethod")
+ ftecStr = ftecStr.format("P%2d", info+1)
+
+ -- set digits
+ SetFanatecDigits(ftecStr)
+ FanatecSendReport(0)
+
+ state = 1
+ -- set timeout
+ oldTcks = GetTicks() + delay
+
+ elseif IsSLIFunction("fanatecdigits", funcIndex) and mFanatecDigitsFeedbackAllowed then
+ -- fanatecdigits feedback
+ local info = GetContextInfo("fanatecdigits")
+ ftecStr = ftecStr.format("P%2d", info+1)
+
+ -- set digits
+ SetFanatecDigits(ftecStr)
+ FanatecSendReport(0)
+
+ state = 1
+ -- set timeout
+ oldTcks = GetTicks() + delay
+
+ elseif IsSLIFunction("rightdigits", funcIndex) and mRightDigitsFeedbackAllowed then
+ -- rightdigits feedback
+ local info = GetContextInfo("rightdigits")
+
+ if ctrlType == 1 then
+ leftStr = leftStr.format("B%02d ", ctrlPos)
else
+ leftStr = leftStr.format("S%1d ", ctrlPos)
+ end
+ rightStr = rightStr.format("P%02d ", info+1)
+
+ -- set digits
+ UpdateDigits(leftStr, rightStr)
+ SLISendReport(0)
+
+ state = 1
+ -- set timeout
+ oldTcks = GetTicks() + delay
+
+ elseif IsSLIFunction("leftdigits", funcIndex) and mLeftDigitsFeedbackAllowed then
+ -- leftdigits feedback
+ local info = GetContextInfo("leftdigits")
+ rightStr = leftStr.format("P%02d ", info+1)
- if ctrlType == 0 then
- -- switch
-
- if mDemoMapToKeyAllowed and ctrlPos == mDemoMapToKeySwitch then
- -- demo script
- -- mapping a keystroke (see global.lua to set the targeted switch)
- local key = ""
- if value == 2 then key = "v" end
- -- if value == 3 then key = "K" end
- -- if value == 4 then key = "v" end
- -- if value == 5 then key = "F5" end
- if key ~= "" then
- -- params: key, delay, modifier
- SetKeystroke(key, 100, "")
- end
- end
-
- if mSwitchFeedbackAllowed then
- -- general switch feedback (see global.lua to activate)
- leftStr = leftStr.format("S%1d ", ctrlPos)
- rightStr = rightStr.format("P%02d ", value)
-
- -- set digits
- UpdateDigits(leftStr, rightStr)
- SLISendReport(0)
-
- state = 1
- -- set timeout
- oldTcks = GetTicks() + delay
- end
- elseif ctrlType == 1 then
- if ctrlPos == mDumpLapButton and dev == "SLI-PRO" and value>0 and mDumpLapAllowed then
- -- sample script using button of SLI-PRO to
- -- toggle telemetry dumplastlap flag (true or false)
- -- telemetry logs are stored in telemetry directory
- -- after each completed lap
- local dlap = GetContextInfo("dumplastlap")
- local flag = not dlap;
- TelemetryTools("dumplastlap", flag);
- -- set digits
- leftStr = "tELENN"
- if flag then
- rightStr = "SAVE "
- else
- rightStr = "FALSE "
- end
- UpdateDigits(leftStr, rightStr)
- SLISendReport(0)
-
- state = 1
- -- set timeout
- oldTcks = GetTicks() + delay
- end
- end
+ if ctrlType == 1 then
+ leftStr = rightStr.format("B%02d ", ctrlPos)
+ else
+ leftStr = rightStr.format("S%1d ", ctrlPos)
+ end
+
+ -- set digits
+ UpdateDigits(leftStr, rightStr)
+ SLISendReport(0)
+
+ state = 1
+ -- set timeout
+ oldTcks = GetTicks() + delay
+
+ elseif IsSLIFunction("lowfuel", funcIndex) and mLowFuelFeedbackAllowed then
+ -- lowfuel feedback
+ -- get the option
+ local info = GetContextInfo("lowfuel")
+
+ -- set digits
+ leftStr = leftStr.format("FUEL ", ctrlPos)
+ rightStr = rightStr.format("L %02d ", info)
+
+ UpdateDigits(leftStr, rightStr)
+ SLISendReport(0)
+
+ state = 1
+ -- set timeout
+ oldTcks = GetTicks() + delay
+ end
+ else
+
+ if ctrlType == 0 then
+ -- switch
+
+ if mDemoMapToKeyAllowed and ctrlPos == mDemoMapToKeySwitch then
+ -- demo script
+ -- mapping a keystroke (see global.lua to set the targeted switch)
+ local key = ""
+ if value == 2 then key = "v" end
+ -- if value == 3 then key = "K" end
+ -- if value == 4 then key = "v" end
+ -- if value == 5 then key = "F5" end
+ if key ~= "" then
+ -- params: key, delay, modifier
+ SetKeystroke(key, 100, "")
+ end
+ end
+
+ if mSwitchFeedbackAllowed then
+ -- general switch feedback (see global.lua to activate)
+ leftStr = leftStr.format("S%1d ", ctrlPos)
+ rightStr = rightStr.format("P%02d ", value)
+
+ -- set digits
+ UpdateDigits(leftStr, rightStr)
+ SLISendReport(0)
+
+ state = 1
+ -- set timeout
+ oldTcks = GetTicks() + delay
+ end
+ elseif ctrlType == 1 then
+ if ctrlPos == mDumpLapButton and dev == "SLI-PRO" and value>0 and mDumpLapAllowed then
+ -- sample script using button of SLI-PRO to
+ -- toggle telemetry dumplastlap flag (true or false)
+ -- telemetry logs are stored in telemetry directory
+ -- after each completed lap
+ local dlap = GetContextInfo("dumplastlap")
+ local flag = not dlap;
+ TelemetryTools("dumplastlap", flag);
+ -- set digits
+ leftStr = "tELENN"
+ if flag then
+ rightStr = "SAVE "
+ else
+ rightStr = "FALSE "
+ end
+ UpdateDigits(leftStr, rightStr)
+ SLISendReport(0)
+
+ state = 1
+ -- set timeout
+ oldTcks = GetTicks() + delay
+ end
+ end
end
if state >= 1 then
- -- loop until timeout
- local newtcks = GetTicks()
- loopFlag = true
- while(oldTcks > newtcks and loopFlag ) do
- SLISleep(10)
- newtcks = GetTicks()
- SetLeftDigits(leftStr)
- SetRightDigits(rightStr)
- SLISendReport(0)
- end
-
- -- cleanup device
- oldTcks = 0
- state = 0
- toggleAllLed(0)
- UpdateDigits(" ", " ")
- SLISendReport(0)
-
- -- allow Mgr to display info on digits
- SetDigitsAllowed(true)
+ -- loop until timeout
+ local newtcks = GetTicks()
+ loopFlag = true
+ while(oldTcks > newtcks and loopFlag ) do
+ SLISleep(10)
+ newtcks = GetTicks()
+ SetLeftDigits(leftStr)
+ SetRightDigits(rightStr)
+ SLISendReport(0)
+ end
+
+ -- cleanup device
+ oldTcks = 0
+ state = 0
+ toggleAllLed(0)
+ UpdateDigits(" ", " ")
+ SLISendReport(0)
+
+ -- allow Mgr to display info on digits
+ SetDigitsAllowed(true)
end
-- skip
@@ -319,8 +316,8 @@ function BrightnessFeedBack(device)
toggleAllLed(1)
if device == "SLI-PRO" then
- -- SLI-PRO Device
- -- set digits
- UpdateDigits("888888", "888888")
+ -- SLI-PRO Device
+ -- set digits
+ UpdateDigits("888888", "888888")
end
end
diff --git a/scripts/devhook.lua b/scripts/devhook.lua
index 4d5d6b5..db8131a 100644
--- a/scripts/devhook.lua
+++ b/scripts/devhook.lua
@@ -25,9 +25,9 @@ function deviceReport(deviceType)
-- limiter ON?
local spdLmt = GetCarInfo("speedlimiter")
if paused or spdLmt == 0 then
- -- reset value
- SetDigitsAllowed(true)
- SetFanatecDigitsAllowed(true)
+ -- reset value
+ SetDigitsAllowed(true)
+ SetFanatecDigitsAllowed(true)
end
diff --git a/scripts/fanatec.lua b/scripts/fanatec.lua
index 7809f2b..22be7f2 100644
--- a/scripts/fanatec.lua
+++ b/scripts/fanatec.lua
@@ -1,8 +1,8 @@
--- Fanatec Lua Script v1.4
+-- Fanatec Lua Script v1.4.1
-- Copyright (c)2012-2013 by Zappadoc - All Rights Reserved.
-- this script builds all functions associated with
-- digits panels of Fanatec device
--- last change by Zappadoc - 2013-09
+-- last change by Zappadoc - 2013-11
-- ============================================================
-- Digits Panel functions
@@ -51,11 +51,11 @@ function fanatecDigitsEvent(swFunction)
qi = GetContextInfo("quickinfobutton")
if qi == nil or qi == 0 then qi = false end
if qi then
- -- get index for fanatec panel
- local qiF = GetContextInfo("fanatecquickinfo")
- if qiF == nil then qiF = 1 end
- -- force position to match QI preference
- swValue = qiF
+ -- get index for fanatec panel
+ local qiF = GetContextInfo("fanatecquickinfo")
+ if qiF == nil then qiF = 1 end
+ -- force position to match QI preference
+ swValue = qiF
end
-- get current simulation name
@@ -66,8 +66,8 @@ function fanatecDigitsEvent(swFunction)
ospt = GetContextInfo("osptracking")
if ospt == nil then ospt = false end
if ospt then
- -- show rpm
- swValue = 22
+ -- show rpm
+ swValue = 22
end
-- lap finished, display lap time a few seconds
@@ -75,7 +75,7 @@ function fanatecDigitsEvent(swFunction)
dlt = GetContextInfo("displaylaptime")
if dlt == nil then dlt = false end
if dlt then
- swValue = 11
+ swValue = 11
end
-- check if PIT Feedback ON
@@ -83,413 +83,459 @@ function fanatecDigitsEvent(swFunction)
pf = GetContextInfo("pitfeedback")
if pf == nil or pf == 0 then pf = false end
if pf then
- -- force position to PIT function if car pits
- local pit = GetCarInfo("inpits")
- if pit > 0 then
- swValue = 41
- end
+ -- force position to PIT function if car pits
+ local pit = GetCarInfo("inpits")
+ if pit > 0 then
+ swValue = 41
+ end
end
-- check postion and compute panel string
if swValue == 1 then
- -- oldGear is intialized in gearEvent (see gear.lua)
- if oldGear ~= nil then
- -- gear
- --local g = GetCarInfo("gear")
+ -- oldGear is intialized in gearEvent (see gear.lua)
+ if oldGear ~= nil then
+ -- gear
+ --local g = GetCarInfo("gear")
- -- get neutral
- local n = string.char(GetContextInfo("neutral"))
- -- get reverse char and convert to string
- local r = string.char(GetContextInfo("reverse"))
- -- get state of custom Optimal Shift Point (OSP) records
- local ospcustom_on = GetContextInfo("ospcustom")
+ -- get neutral
+ local n = string.char(GetContextInfo("neutral"))
+ -- get reverse char and convert to string
+ local r = string.char(GetContextInfo("reverse"))
+ -- get state of custom Optimal Shift Point (OSP) records
+ local ospcustom_on = GetContextInfo("ospcustom")
- -- set neutral, reverse or current gear
- if oldGear == 0 then
- -- if neutral and using custom OSP record then add a dot to gear digit
- SetFanatecGear(n, ospcustom_on)
+ -- set neutral, reverse or current gear
+ if oldGear == 0 then
+ -- if neutral and using custom OSP record then add a dot to gear digit
+ SetFanatecGear(n, ospcustom_on)
- elseif oldGear < 0 then
- -- reverse
- SetFanatecGear(r, false)
+ elseif oldGear < 0 then
+ -- reverse
+ SetFanatecGear(r, false)
- else
- -- if gear = 'E' give the hand to SLIMax Manager
- -- if g == 69 then
- -- return 0
- -- end
+ else
+ -- if gear = 'E' give the hand to SLIMax Manager
+ -- if g == 69 then
+ -- return 0
+ -- end
- SetFanatecGear(string.char(oldGear), false)
- end
+ SetFanatecGear(string.char(oldGear), false)
+ end
- return 1
- end
+ return 1
+ end
elseif swValue == 2 then
- -- speed
- if round(spd) > 0 then
- fPanel = string.format("%3d", round(spd) )
- else
- fPanel = "___"
- end
+ -- speed
+ if round(spd) > 0 then
+ fPanel = string.format("%3d", round(spd) )
+ else
+ fPanel = "___"
+ end
elseif swValue == 3 then
- -- fuel
- local fuel = GetCarInfo("fuel")
- if fuel ~= nil then
- fuel = GetFuel(fuel, unit)
- if fuel >= 100 then
- fPanel = string.format("%03d", round(fuel) )
- elseif fuel >= 10 then
- fPanel = string.format("F%02d", round(fuel))
- else
- fPanel = string.format("F%1.1f", fuel)
- end
- end
+ -- fuel
+ local fuel = GetCarInfo("fuel")
+ if fuel ~= nil then
+ fuel = GetFuel(fuel, unit)
+ if fuel >= 100 then
+ fPanel = string.format("%03d", round(fuel) )
+ elseif fuel >= 10 then
+ fPanel = string.format("F%02d", round(fuel))
+ else
+ fPanel = string.format("F%1.1f", fuel)
+ end
+ end
elseif swValue == 4 then
- -- position
- inf = GetContextInfo("position")
- if inf ~= nil then
- if inf >= 100 then
- fPanel = string.format("%03d", inf)
- else
- fPanel = string.format("P%02d", inf)
- end
- end
+ -- position
+ inf = GetContextInfo("position")
+ if inf ~= nil then
+ if inf >= 100 then
+ fPanel = string.format("%03d", inf)
+ else
+ fPanel = string.format("P%02d", inf)
+ end
+ end
elseif swValue == 5 then
- -- laps completed
- inf = GetContextInfo("laps")
- if inf ~= nil then
- -- if more then 99 laps
- if inf >= 100 then
- fPanel = string.format("%3.0f", inf)
- else
- fPanel = string.format("L%2.0f", inf)
- end
- end
+ -- laps completed
+ inf = GetContextInfo("laps")
+ if inf ~= nil then
+ -- if more then 99 laps
+ if inf >= 100 then
+ fPanel = string.format("%3.0f", inf)
+ else
+ fPanel = string.format("L%2.0f", inf)
+ end
+ end
elseif swValue == 6 then
- -- sector
- local sect = GetCarInfo("sector")
- -- check if sector > 9
- if sect >9 then
- fPanel = string.format("S%2d", sect)
- else
- fPanel = string.format("S%1d ", sect)
- end
+ -- sector
+ local sect = GetCarInfo("sector")
+ -- check if sector > 9
+ if sect >9 then
+ fPanel = string.format("S%2d", sect)
+ else
+ fPanel = string.format("S%1d ", sect)
+ end
elseif swValue == 7 then
- -- total laps
- local tl = GetContextInfo("lapscount")
- if tl < 1 then tl = 0 end
- -- if more then 99 laps
- if tl >= 100 or tl >= 100 then
- fPanel = string.format("%03d", tl)
- else
- fPanel = string.format("t%02d", tl)
- end
+ -- total laps
+ local tl = GetContextInfo("lapscount")
+ if tl < 1 then tl = 0 end
+ -- if more then 99 laps
+ if tl >= 100 or tl >= 100 then
+ fPanel = string.format("%03d", tl)
+ else
+ fPanel = string.format("t%02d", tl)
+ end
elseif swValue == 8 then
- -- water temp
- inf = GetCarInfo("watertemp")
- if inf ~= nil then
- inf = GetTemp(inf, unit)
- fPanel = string.format("%2.1f", inf)
- end
+ -- water temp
+ inf = GetCarInfo("watertemp")
+ if inf ~= nil then
+ inf = GetTemp(inf, unit)
+ fPanel = string.format("%2.1f", inf)
+ end
elseif swValue == 9 then
- -- oil temp
- inf = GetCarInfo("oiltemp")
- if inf ~= nil then
- inf = GetTemp(inf, unit)
- fPanel = string.format("%2.1f", inf)
- end
+ -- oil temp
+ inf = GetCarInfo("oiltemp")
+ if inf ~= nil then
+ inf = GetTemp(inf, unit)
+ fPanel = string.format("%2.1f", inf)
+ end
elseif swValue == 10 then
- -- best lap time
- --timeFlag = true
- --dlt = true
- lpt = GetTimeInfo("bestlaptime")
- mFanatecText = DisplayFormatTime(lpt,mRefreshLapTimeRate,2,0,3)
-
- SetFanatecDigits( mFanatecText )
- return 1
+ -- best lap time
+ --timeFlag = true
+ --dlt = true
+ lpt = GetTimeInfo("bestlaptime")
+ mFanatecText = DisplayFormatTime(lpt,mRefreshLapTimeRate,2,0,3)
+
+ SetFanatecDigits( mFanatecText )
+ return 1
elseif swValue == 11 then
- -- last lap time
- --timeFlag = true
- --dlt = true
- lpt = GetTimeInfo("lastlaptime")
- mFanatecText = DisplayFormatTime(lpt,mRefreshLapTimeRate,2,0,3)
- SetFanatecDigits( mFanatecText )
- return 1
+ -- last lap time
+ --timeFlag = true
+ --dlt = true
+ lpt = GetTimeInfo("lastlaptime")
+ mFanatecText = DisplayFormatTime(lpt,mRefreshLapTimeRate,2,0,3)
+ SetFanatecDigits( mFanatecText )
+ return 1
elseif swValue >= 12 and swValue <= 18 and isAppIRacing(sim) then
- --timeFlag = true
- -- iRacing partials
- local ts = GetContextInfo("partialcount")
- local sector = GetCarInfo("sector")
- if sector == nil then sector = 0 end
- if ts ~= nil and ts > 0 then
- if swValue == 12 then
- lpt = GetPartialTimeInfo("currentpartial", sector)
- elseif swValue == 13 then
- lpt = GetPartialTimeInfo("vsbestlap", sector)
- elseif swValue == 14 then
- lpt = GetPartialTimeInfo("vsoptimallap", sector)
- elseif swValue == 15 then
- lpt = GetPartialTimeInfo("vsoptimalsector", sector)
- elseif swValue == 16 then
- lpt = GetPartialTimeInfo("vssessionbestlap", sector)
- elseif swValue == 17 then
- lpt = GetPartialTimeInfo("vssessionoptimallap", sector)
- elseif swValue == 18 then
- lpt = GetPartialTimeInfo("vssessionoptimalsector", sector)
- end
- else
- lpt = 0.0
- end
- mFanatecText = DisplayFormatTime(lpt,mDeltaTimeDelay,2,1,3)
- SetFanatecDigits( mFanatecText )
- return 1
+ --timeFlag = true
+ -- iRacing partials
+ local ts = GetContextInfo("partialcount")
+ local sector = GetCarInfo("sector")
+ if sector == nil then sector = 0 end
+ if ts ~= nil and ts > 0 then
+ if swValue == 12 then
+ lpt = GetPartialTimeInfo("currentpartial", sector)
+ elseif swValue == 13 then
+ lpt = GetPartialTimeInfo("vsbestlap", sector)
+ elseif swValue == 14 then
+ lpt = GetPartialTimeInfo("vsoptimallap", sector)
+ elseif swValue == 15 then
+ lpt = GetPartialTimeInfo("vsoptimalsector", sector)
+ elseif swValue == 16 then
+ lpt = GetPartialTimeInfo("vssessionbestlap", sector)
+ elseif swValue == 17 then
+ lpt = GetPartialTimeInfo("vssessionoptimallap", sector)
+ elseif swValue == 18 then
+ lpt = GetPartialTimeInfo("vssessionoptimalsector", sector)
+ end
+ else
+ lpt = 0.0
+ end
+ mFanatecText = DisplayFormatTime(lpt,mDeltaTimeDelay,2,1,3)
+ SetFanatecDigits( mFanatecText )
+ return 1
elseif swValue == 19 then
- -- real time diff vs your best
- --timeFlag = true
- lpt = GetTimeInfo("realdiffbest")
- mFanatecText = DisplayFormatTime(lpt,mDeltaTimeDelay,2,1,3)
- SetFanatecDigits( mFanatecText )
- return 1
+ -- real time diff vs your best
+ --timeFlag = true
+ lpt = GetTimeInfo("realdiffbest")
+ mFanatecText = DisplayFormatTime(lpt,mDeltaTimeDelay,2,1,3)
+ SetFanatecDigits( mFanatecText )
+ return 1
elseif swValue == 20 then
- -- real time diff vs your last
- --timeFlag = true
- lpt = GetTimeInfo("realdifflast")
- mFanatecText = DisplayFormatTime(lpt,mDeltaTimeDelay,2,1,3)
- SetFanatecDigits( mFanatecText )
- return 1
+ -- real time diff vs your last
+ --timeFlag = true
+ lpt = GetTimeInfo("realdifflast")
+ mFanatecText = DisplayFormatTime(lpt,mDeltaTimeDelay,2,1,3)
+ SetFanatecDigits( mFanatecText )
+ return 1
elseif swValue == 21 then
- -- get an average consumption of fuel per lap and gives the remaining laps
- local remainintank = GetCarInfo("remainlapsintank")
- if remainintank >= 100 then
+ -- get an average consumption of fuel per lap and gives the remaining laps
+ local remainintank = GetCarInfo("remainlapsintank")
+ if remainintank >= 100 then
fPanel = string.format("%3.0f", math.floor (remainintank))
- else
+ else
fPanel = string.format("L%2.0f", math.floor(remainintank))
- end
+ end
elseif swValue == 22 then
- -- rpm
- isSlowUpdate = true
- local rpm = GetCarInfo("rpm")
- local r = rpm / 100.0
- if r < 100 then
- fPanel = string.format("%2.1f", r)
- else
- fPanel = string.format("%3d.", round(r))
- end
+ -- rpm
+ isSlowUpdate = true
+ local rpm = GetCarInfo("rpm")
+ local r = rpm / 100.0
+ if r < 100 then
+ fPanel = string.format("%2.1f", r)
+ else
+ fPanel = string.format("%3d.", round(r))
+ end
elseif swValue == 23 then
- -- track size
- isSlowUpdate = true
- local trcksz = GetContextInfo("tracksize")
- local r = trcksz / 100
- if r < 100 then
- fPanel = string.format("%2.1f", r)
- else
- fPanel = string.format("%3d.", round(r))
- end
+ -- track size
+ isSlowUpdate = true
+ local trcksz = GetContextInfo("tracksize")
+ local r = trcksz / 100
+ if r < 100 then
+ fPanel = string.format("%2.1f", r)
+ else
+ fPanel = string.format("%3d.", round(r))
+ end
elseif swValue == 24 then
- -- distance percent
- local dist = GetContextInfo("lapdistance")
- -- track size
- local trcksz = GetContextInfo("tracksize")
- local p = round(dist / (trcksz / 100))
- fPanel = string.format("%3d", p )
+ -- distance percent
+ local dist = GetContextInfo("lapdistance")
+ -- track size
+ local trcksz = GetContextInfo("tracksize")
+ local p = round(dist / (trcksz / 100))
+ fPanel = string.format("%3d", p )
elseif swValue == 25 then
- -- kers
- local kers = GetCarInfo("kers")
- fPanel = string.format("%3d", round(kers/1000))
+ -- kers
+ local kers = GetCarInfo("kers")
+ fPanel = string.format("%3d", round(kers/1000))
elseif swValue == 26 then
- -- kers max
- local kmx = GetCarInfo("kersmax")
- fPanel = string.format("%3d", round(kmx/1000))
+ -- kers max
+ local kmx = GetCarInfo("kersmax")
+ fPanel = string.format("%3d", round(kmx/1000))
elseif swValue == 27 then
- -- drs
- local drs = GetCarInfo("drs")
- if drs == 1 then
- fPanel = "ON "
- else
- fPanel = "OFF"
- end
+ -- drs
+ local drs = GetCarInfo("drs")
+ if drs == 1 then
+ fPanel = "ON "
+ else
+ fPanel = "OFF"
+ end
elseif swValue == 28 then
- -- kers percent
- local kers = GetCarInfo("kers")
- fPanel = string.format("%3d", round((kers/1000)/4))
+ -- kers percent
+ local kers = GetCarInfo("kers")
+ fPanel = string.format("%3d", round((kers/1000)/4))
elseif swValue == 29 then
- -- wheels temp if available
- inf = GetCarInfo("wheeltempfrontleft")
- if inf ~= nil then
- -- if rFactor convert Kelvin to Celsius (see global.lua)
- if isAppRFactor(sim) then inf = KtoC(inf) end
- fPanel = string.format("%3.0f", inf)
- end
+ -- wheels temp if available
+ inf = GetCarInfo("wheeltempfrontleft")
+ if inf ~= nil then
+ -- if rFactor convert Kelvin to Celsius (see global.lua)
+ if isAppRFactor(sim) then inf = KtoC(inf) end
+ fPanel = string.format("%3.0f", inf)
+ end
elseif swValue == 30 then
- inf = GetCarInfo("wheeltempfrontright")
- if inf ~= nil then
- if isAppRFactor(sim) then inf = KtoC(inf) end
- fPanel = string.format("%3.0f", inf)
- end
+ inf = GetCarInfo("wheeltempfrontright")
+ if inf ~= nil then
+ if isAppRFactor(sim) then inf = KtoC(inf) end
+ fPanel = string.format("%3.0f", inf)
+ end
elseif swValue == 31 then
- inf = GetCarInfo("wheeltemprearleft")
- if inf ~= nil then
- if isAppRFactor(sim) then inf = KtoC(inf) end
- fPanel = string.format("%3.0f", inf)
- end
+ inf = GetCarInfo("wheeltemprearleft")
+ if inf ~= nil then
+ if isAppRFactor(sim) then inf = KtoC(inf) end
+ fPanel = string.format("%3.0f", inf)
+ end
elseif swValue == 32 then
- inf = GetCarInfo("wheeltemprearright")
- if inf ~= nil then
- if isAppRFactor(sim) then inf = KtoC(inf) end
- fPanel = string.format("%3.0f", inf)
- end
+ inf = GetCarInfo("wheeltemprearright")
+ if inf ~= nil then
+ if isAppRFactor(sim) then inf = KtoC(inf) end
+ fPanel = string.format("%3.0f", inf)
+ end
elseif swValue == 33 then
- -- wheels pressure if available
- inf = GetCarInfo("wheelpressfrontleft")
- if inf ~= nil then
- -- convert to psi
- fPanel = string.format("%2.1f", inf / 6.88)
- end
+ -- wheels pressure if available
+ inf = GetCarInfo("wheelpressfrontleft")
+ if inf ~= nil then
+ -- convert to psi
+ fPanel = string.format("%2.1f", inf / 6.88)
+ end
elseif swValue == 34 then
- inf = GetCarInfo("wheelpressfrontright")
- if inf ~= nil then
- fPanel = string.format("%2.1f", inf / 6.88)
- end
+ inf = GetCarInfo("wheelpressfrontright")
+ if inf ~= nil then
+ fPanel = string.format("%2.1f", inf / 6.88)
+ end
elseif swValue == 35 then
- inf = GetCarInfo("wheelpressrearleft")
- if inf ~= nil then
- fPanel = string.format("%2.1f", inf / 6.88)
- end
+ inf = GetCarInfo("wheelpressrearleft")
+ if inf ~= nil then
+ fPanel = string.format("%2.1f", inf / 6.88)
+ end
elseif swValue == 36 then
- inf = GetCarInfo("wheelpressrearright")
- if inf ~= nil then
- fPanel = string.format("%2.1f", inf / 6.88)
- end
+ inf = GetCarInfo("wheelpressrearright")
+ if inf ~= nil then
+ fPanel = string.format("%2.1f", inf / 6.88)
+ end
elseif swValue == 37 then
- -- brakes temp if available
- inf = GetCarInfo("braketempfrontleft")
- if inf ~= nil then
- if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
- fPanel = string.format("%3.0f", inf)
- end
+ -- brakes temp if available
+ inf = GetCarInfo("braketempfrontleft")
+ if inf ~= nil then
+ if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
+ fPanel = string.format("%3.0f", inf)
+ end
elseif swValue == 38 then
- inf = GetCarInfo("braketempfrontright")
- if inf ~= nil then
- if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
- fPanel = string.format("%3.0f", inf)
- end
+ inf = GetCarInfo("braketempfrontright")
+ if inf ~= nil then
+ if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
+ fPanel = string.format("%3.0f", inf)
+ end
elseif swValue == 39 then
- inf = GetCarInfo("braketemprearleft")
- if inf ~= nil then
- if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
- fPanel = string.format("%3.0f", inf)
- end
+ inf = GetCarInfo("braketemprearleft")
+ if inf ~= nil then
+ if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
+ fPanel = string.format("%3.0f", inf)
+ end
elseif swValue == 40 then
- inf = GetCarInfo("braketemprearright")
- if inf ~= nil then
- if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
- fPanel = string.format("%3.0f", inf)
- end
+ inf = GetCarInfo("braketemprearright")
+ if inf ~= nil then
+ if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
+ fPanel = string.format("%3.0f", inf)
+ end
elseif swValue == 41 then
- -- PIT
- fPanel = "PIt"
+ -- PIT
+ fPanel = "PIt"
elseif swValue == 42 then
- -- sc
- local sc = GetContextInfo("safetycare")
- if sc == 1 then
- fPanel = " SC"
- else
- fPanel = " "
- end
+ -- sc
+ local sc = GetContextInfo("safetycare")
+ if sc == 1 then
+ fPanel = " SC"
+ else
+ fPanel = " "
+ end
+ elseif swValue == 43 then
+ timeFlag = true
+ -- current sector
+ local sector = GetCarInfo("sector")
+ if sector == 1 then
+ lpt = GetTimeInfo("sector1")
+ elseif sector == 2 then
+ lpt = GetTimeInfo("sector2")
+ else
+ -- sector 3
+ local s1 = GetTimeInfo("sector1")
+ local s2 = GetTimeInfo("sector2")
+ local lt = GetTimeInfo("laptime")
+ lpt = lt - (s1 + s2)
+ end
+ mFanatecText = DisplayFormatTime(lpt,mRefreshLapTimeRate,2,0,3)
+ SetFanatecDigits( mFanatecText )
+ return 1
+ elseif swValue == 44 then
+ timeFlag = true
+ -- best sector 1
+ lpt = GetTimeInfo("bestsector1")
+ mFanatecText = DisplayFormatTime(lpt,mRefreshLapTimeRate,2,0,3)
+ SetFanatecDigits( mFanatecText )
+ return 1
+ elseif swValue == 45 then
+ timeFlag = true
+ -- best sector 2
+ lpt = GetTimeInfo("bestsector2")
+ mFanatecText = DisplayFormatTime(lpt,mRefreshLapTimeRate,2,0,3)
+ SetFanatecDigits( mFanatecText )
+ return 1
+ elseif swValue == 46 then
+ timeFlag = true
+ -- last sector 1
+ lpt = GetTimeInfo("lastsector1")
+ mFanatecText = DisplayFormatTime(lpt,mRefreshLapTimeRate,2,0,3)
+ SetFanatecDigits( mFanatecText )
+ return 1
+ elseif swValue == 47 then
+ timeFlag = true
+ -- last sector 2
+ lpt = GetTimeInfo("lastsector2")
+ mFanatecText = DisplayFormatTime(lpt,mRefreshLapTimeRate,2,0,3)
+ SetFanatecDigits( mFanatecText )
+ return 1
else
- fPanel = " "
+ fPanel = " "
end
-- the function below has been replaced with generic time display function in global.lua
-- if timeFlag and lpt ~= nil then
- -- -- explod time
- -- hr, mn, sc, hd, ms = timeDispatcher(lpt)
-
-
- -- print("lpt:" .. lpt .. " mn:" .. mn .. " sc:" .. sc .. " hd:" .. hd .. " ms:" .. ms .."\n" )
-
- -- -- update display every mDeltaTimeDelay time
- -- -- current ticks > old backuped value
- -- if GetTicks() > mDeltaTimeOldTicks then
- -- -- store ticks + delay
- -- mDeltaTimeOldTicks = GetTicks() + ( 2 * mDeltaTimeDelay)
-
- -- if lpt == -1 or (mn + sc + ms) == 0.00 then
- -- mDeltaTimeBackup = "-.--"
-
- -- elseif mn > 0 or sc >= 10 then
-
- -- if dlt and mn <100 then
- -- -- display time and mn < 100
- -- if mn >=10 then
- -- -- mn > 10
- -- mDeltaTimeBackup = string.format( "%2d.%01d", mn, sc)
- -- else
- -- mDeltaTimeBackup = string.format( "%1d.%02d", mn, sc)
- -- end
- -- else
- -- -- delta > 9.99s or lap time > 100mn
- -- mDeltaTimeBackup = " . "
- -- end
-
- -- else
- -- -- delta
- -- if lpt < 0 then
- -- -- negative value
- -- mDeltaTimeBackup = string.format( "-%01d.%01d ", sc, round(hd))
- -- else
- -- mDeltaTimeBackup = string.format( "%01d.%02d", sc, round(hd))
- -- end
- -- end
- -- end
-
- -- fPanel = mDeltaTimeBackup
+ -- -- explod time
+ -- hr, mn, sc, hd, ms = timeDispatcher(lpt)
+
+
+ -- print("lpt:" .. lpt .. " mn:" .. mn .. " sc:" .. sc .. " hd:" .. hd .. " ms:" .. ms .."\n" )
+
+ -- -- update display every mDeltaTimeDelay time
+ -- -- current ticks > old backuped value
+ -- if GetTicks() > mDeltaTimeOldTicks then
+ -- -- store ticks + delay
+ -- mDeltaTimeOldTicks = GetTicks() + ( 2 * mDeltaTimeDelay)
+
+ -- if lpt == -1 or (mn + sc + ms) == 0.00 then
+ -- mDeltaTimeBackup = "-.--"
+
+ -- elseif mn > 0 or sc >= 10 then
+
+ -- if dlt and mn <100 then
+ -- -- display time and mn < 100
+ -- if mn >=10 then
+ -- -- mn > 10
+ -- mDeltaTimeBackup = string.format( "%2d.%01d", mn, sc)
+ -- else
+ -- mDeltaTimeBackup = string.format( "%1d.%02d", mn, sc)
+ -- end
+ -- else
+ -- -- delta > 9.99s or lap time > 100mn
+ -- mDeltaTimeBackup = " . "
+ -- end
+
+ -- else
+ -- -- delta
+ -- if lpt < 0 then
+ -- -- negative value
+ -- mDeltaTimeBackup = string.format( "-%01d.%01d ", sc, round(hd))
+ -- else
+ -- mDeltaTimeBackup = string.format( "%01d.%02d", sc, round(hd))
+ -- end
+ -- end
+ -- end
+
+ -- fPanel = mDeltaTimeBackup
-- end
if isSlowUpdate then
- -- request slow display update
- if GetTicks() > ( mDeltaTimeDelay + mDeltaTimeOldTicks ) then
- mDeltaTimeOldTicks = GetTicks()
- mFanatecText = fPanel
- end
+ -- request slow display update
+ if GetTicks() > ( mDeltaTimeDelay + mDeltaTimeOldTicks ) then
+ mDeltaTimeOldTicks = GetTicks()
+ mFanatecText = fPanel
+ end
else
- -- normal display update
- mFanatecText = fPanel
+ -- normal display update
+ mFanatecText = fPanel
end
-- send string to sli manager
diff --git a/scripts/functions_tools.lua b/scripts/functions_tools.lua
index 592e7bc..b83fe58 100644
--- a/scripts/functions_tools.lua
+++ b/scripts/functions_tools.lua
@@ -1,8 +1,8 @@
-- SLIMax Mgr Lua Script v1.4
-- PART OF SLIMAX Manager pkg
-- Copyright (c)2012-2013 by Zappadoc - All Rights Reserved.
--- CREDITS: first release - Zappadoc
--- updated - Desty 2013-04-26
+-- CREDITS: first release - Zappadoc
+-- updated - Desty 2013-04-26
-- ===============================
-- left and right functions tools
@@ -27,16 +27,16 @@ function AddFuncName(path, func)
idx = 0
idx = GetFuncIndex(path, func)
if idx < 0 then
- print("BAD ERROR occurred!")
- return idx --returns errorcode -1 or -2
+ print("BAD ERROR occurred!")
+ return idx --returns errorcode -1 or -2
elseif idx > 0 then
- return idx -- OK, return index
+ return idx -- OK, return index
end
idx = GetNewFuncIndex(path)
if idx < 1 then
- print("BAD ERROR occurred!")
- return -1
+ print("BAD ERROR occurred!")
+ return -1
end
file,err = io.open(path,"r")
@@ -48,18 +48,18 @@ function AddFuncName(path, func)
local t2 = {} --functionsTable
i= 1
for line in file:lines() do
- if line == nil then break end
- -- Seperate Index from function name
- a = string.find(line, '.', 1, true)
- if a then
- b = string.sub(line, a+1)
- c = string.sub(line, 1, a-1)
- d=(c + 0)
- -- check for EXACT MATCH of the function name
- if b == func then isOK = true end
- table.insert(t1, d)
- t2[d]= line
- end
+ if line == nil then break end
+ -- Seperate Index from function name
+ a = string.find(line, '.', 1, true)
+ if a then
+ b = string.sub(line, a+1)
+ c = string.sub(line, 1, a-1)
+ d=(c + 0)
+ -- check for EXACT MATCH of the function name
+ if b == func then isOK = true end
+ table.insert(t1, d)
+ t2[d]= line
+ end
end
table.insert(t1, idx)
t2[idx]= funcStr
@@ -67,22 +67,22 @@ function AddFuncName(path, func)
file:close()
if not isOK then
- -- write mode
- file, err = io.open(path,"w+")
- if err then return -2 end
-
- --sort IndexTable
- table.sort(t1)
-
- -- Write All functions in order of IndexTable
- for i = 1, #t1, 1 do
- a = t1[i]
- b = t2[a]
- --print(" a: "..a.." b: "..b)
- file:write(b)
- file:write("\n")
- end
- file:close()
+ -- write mode
+ file, err = io.open(path,"w+")
+ if err then return -2 end
+
+ --sort IndexTable
+ table.sort(t1)
+
+ -- Write All functions in order of IndexTable
+ for i = 1, #t1, 1 do
+ a = t1[i]
+ b = t2[a]
+ --print(" a: "..a.." b: "..b)
+ file:write(b)
+ file:write("\n")
+ end
+ file:close()
end
return idx
@@ -92,7 +92,7 @@ end
-- Remove a FunctionName
--- Returns 1 if success
+-- Returns 1 if success
-- Returns -1 if Error Reading File
-- Returns -2 if Error writing File
@@ -111,21 +111,21 @@ function RemoveFuncName(path, func)
t = { }
i=1
for line in file:lines() do
- if line == nil then break end
-
- -- Seperate Index from function name
- a = string.find(line, '.', 1, true)
- -- Empty Lines will be deleted
- if a then
- b = string.sub(line, a+1)
- c = string.sub(line, 1, a-1)
- d = (c + 0)
- -- check for an EXACT MATCH of the function name
- if b ~= func or d < 100 then
- t[i] = line
- i= i + 1
- end
- end
+ if line == nil then break end
+
+ -- Seperate Index from function name
+ a = string.find(line, '.', 1, true)
+ -- Empty Lines will be deleted
+ if a then
+ b = string.sub(line, a+1)
+ c = string.sub(line, 1, a-1)
+ d = (c + 0)
+ -- check for an EXACT MATCH of the function name
+ if b ~= func or d < 100 then
+ t[i] = line
+ i= i + 1
+ end
+ end
end
file:close()
@@ -159,18 +159,18 @@ function GetFuncIndex(path, func)
if err then return -1 end
for line in file:lines() do
- if line == nil then break end
- -- Seperate Index from function name
- a = string.find(line, '.', 1, true)
- if a then
- b = string.sub( line, a+1)
- -- check for an EXACT MATCH of the function name
- if b == func then
- c = string.sub( line,1, a-1)
- d = (c + 0)
- return d
- end
- end
+ if line == nil then break end
+ -- Seperate Index from function name
+ a = string.find(line, '.', 1, true)
+ if a then
+ b = string.sub( line, a+1)
+ -- check for an EXACT MATCH of the function name
+ if b == func then
+ c = string.sub( line,1, a-1)
+ d = (c + 0)
+ return d
+ end
+ end
end
return 0
@@ -196,18 +196,18 @@ function GetNewFuncIndex(path)
if err then return -1 end
for line in file:lines() do
- if line == nil then break end
- -- Seperate Index from function name
- a = string.find(line, '.', 1, true)
- if a then
- b = string.sub( line,1, a-1)
- -- string to num conversion
- c = (b + 0)
- -- store if it's greater
- if c > idx then
- table.insert(t, c)
- end
- end
+ if line == nil then break end
+ -- Seperate Index from function name
+ a = string.find(line, '.', 1, true)
+ if a then
+ b = string.sub( line,1, a-1)
+ -- string to num conversion
+ c = (b + 0)
+ -- store if it's greater
+ if c > idx then
+ table.insert(t, c)
+ end
+ end
end
file:close()
@@ -218,14 +218,14 @@ function GetNewFuncIndex(path)
idx = 0
local n = #t-1
for i = 1, n, 1 do
- if t[i] < (t[i+1]-1) then
- if idx == 0 then --added this Iteration
- idx = t[i]+1 --to start at the lowest gap
- end
- end
+ if t[i] < (t[i+1]-1) then
+ if idx == 0 then --added this Iteration
+ idx = t[i]+1 --to start at the lowest gap
+ end
+ end
end
if idx == 0 then
- idx = t[n+1]+1
+ idx = t[n+1]+1
end
return idx
diff --git a/scripts/gear.lua b/scripts/gear.lua
index 7015eef..4e6778b 100644
--- a/scripts/gear.lua
+++ b/scripts/gear.lua
@@ -9,59 +9,59 @@ function Ignition(gear, isFanatec)
-- patch led function damage for ignition
-- check if sim is rFactor2
if GetContextInfo("simulation") == "rFactor2.exe" then
- if GetCarInfo("rpm") == 0 and GetCarInfo("rawspeed") == 0 then
- if GetCarInfo("ignition") == 0 then
- -- engine has been stopped
- -- engine has been stopped
- -- do nothing
-
-
- elseif GetCarInfo("ignition") == 1 then
- -- ignition ON after engine stop
- -- engine has been stopped, ignition ON
-
- SetDigitsAllowed(false)
- if isFanatec == true then
- SetFanatecDigits(" ")
- else
- SetLeftDigits (" ")
- SetRightDigits (" ")
- end
-
- SetGearDigit("_")
-
- -- init led
- toggleAllLed(0)
-
- -- blink damage led
- if mOLDIgnitionticks == nil or GetTicks() > mOLDIgnitionticks then
- mOLDIgnitionticks = GetTicks() + 1000
- initLedTable(mRPMLedTable, 1)
-
- SetWarnLed(GetLedIndex("damage"), 1)
-
- else
- initLedTable(mRPMLedTable, 0)
- SetWarnLed(GetLedIndex("damage"), 0)
- end
- SetRPMLed("mRPMLedTable")
- SLISendReport()
- return 1
-
- elseif GetCarInfo("ignition") == 2 and GetCarInfo("rpm") == 0 and GetCarInfo("rawspeed") == 0 then
- -- ignition ON and starter ON
- -- engine has been stopped, ignition ON + Starter ON
-
- SetGearDigit("-")
- SetDigitsAllowed(true)
- -- stop blinking
- initLedTable(mRPMLedTable, 1)
- SetWarnLed(GetLedIndex("damage"), 1)
- SetRPMLed("mRPMLedTable")
- SLISendReport()
- return 1
- end
- end
+ if GetCarInfo("rpm") == 0 and GetCarInfo("rawspeed") == 0 then
+ if GetCarInfo("ignition") == 0 then
+ -- engine has been stopped
+ -- engine has been stopped
+ -- do nothing
+
+
+ elseif GetCarInfo("ignition") == 1 then
+ -- ignition ON after engine stop
+ -- engine has been stopped, ignition ON
+
+ SetDigitsAllowed(false)
+ if isFanatec == true then
+ SetFanatecDigits(" ")
+ else
+ SetLeftDigits (" ")
+ SetRightDigits (" ")
+ end
+
+ SetGearDigit("_")
+
+ -- init led
+ toggleAllLed(0)
+
+ -- blink damage led
+ if mOLDIgnitionticks == nil or GetTicks() > mOLDIgnitionticks then
+ mOLDIgnitionticks = GetTicks() + 1000
+ initLedTable(mRPMLedTable, 1)
+
+ SetWarnLed(GetLedIndex("damage"), 1)
+
+ else
+ initLedTable(mRPMLedTable, 0)
+ SetWarnLed(GetLedIndex("damage"), 0)
+ end
+ SetRPMLed("mRPMLedTable")
+ SLISendReport()
+ return 1
+
+ elseif GetCarInfo("ignition") == 2 and GetCarInfo("rpm") == 0 and GetCarInfo("rawspeed") == 0 then
+ -- ignition ON and starter ON
+ -- engine has been stopped, ignition ON + Starter ON
+
+ SetGearDigit("-")
+ SetDigitsAllowed(true)
+ -- stop blinking
+ initLedTable(mRPMLedTable, 1)
+ SetWarnLed(GetLedIndex("damage"), 1)
+ SetRPMLed("mRPMLedTable")
+ SLISendReport()
+ return 1
+ end
+ end
end
return 2
end
@@ -104,22 +104,22 @@ function gearEvent(gear)
-- optimize display, call if changed
if oldGear ~= g then
- -- backup gear state
- oldGear = g
- -- set neutral, reverse or current gear
- if g == 0 then
- -- if neutral and using custom OSP record then add a dot to gear digit
- if ospcustom_on then n = n + 128 end
- SetGearDigit(string.char(n))
- elseif g < 0 then
- SetGearDigit(r)
- else
- -- if gear = 'E' give the hand to SLIMax Manager
- if g == 69 then
- return 0
- end
- SetGearDigit(string.char(g))
- end
+ -- backup gear state
+ oldGear = g
+ -- set neutral, reverse or current gear
+ if g == 0 then
+ -- if neutral and using custom OSP record then add a dot to gear digit
+ if ospcustom_on then n = n + 128 end
+ SetGearDigit(string.char(n))
+ elseif g < 0 then
+ SetGearDigit(r)
+ else
+ -- if gear = 'E' give the hand to SLIMax Manager
+ if g == 69 then
+ return 0
+ end
+ SetGearDigit(string.char(g))
+ end
end
return 1
@@ -156,20 +156,20 @@ function gearFanatecEvent(gear)
if oldGear == nil then oldGear = -1 end
if oldGear ~= g then
- local rumbbleGear = GetContextInfo("gearshock")
- local rumbbleGearDelay = GetContextInfo("gearshockdelay")
-
- -- gear schock effect restricted to 1 to 7
- if rumbbleGear and g > 0 then
- if g < oldGear then
- SetFanatecWheelMotor(0, 100, rumbbleGearDelay)
- elseif g > oldGear then
- SetFanatecWheelMotor(1, 100, rumbbleGearDelay)
- end
- end
-
- -- backup gear state
- oldGear = g
+ local rumbbleGear = GetContextInfo("gearshock")
+ local rumbbleGearDelay = GetContextInfo("gearshockdelay")
+
+ -- gear schock effect restricted to 1 to 7
+ if rumbbleGear and g > 0 then
+ if g < oldGear then
+ SetFanatecWheelMotor(0, 100, rumbbleGearDelay)
+ elseif g > oldGear then
+ SetFanatecWheelMotor(1, 100, rumbbleGearDelay)
+ end
+ end
+
+ -- backup gear state
+ oldGear = g
end
return 2
diff --git a/scripts/global.lua b/scripts/global.lua
index 6008f9f..867e73e 100644
--- a/scripts/global.lua
+++ b/scripts/global.lua
@@ -1,9 +1,9 @@
--- SLIMax Mgr Lua Script v3.8.1
+-- SLIMax Mgr Lua Script v3.9
-- PART OF SLIMAX Manager pkg
-- Copyright (c)2012-2013 by Zappadoc - All Rights Reserved.
--- last change by Zappadoc - 2013-10
+-- last change by Zappadoc - 2013-11
-mSMX_VERSION = 3.8
+mSMX_VERSION = 3.9
-- see slimax_script_readme.txt for implementation
@@ -11,6 +11,69 @@ mSMX_VERSION = 3.8
require "scripts/functions_tools"
-- ============================================================
+-- GLOBAL FLAGS
+-- set this flags to change the std behaviors of SLIMax Mgr
+-- ============================================================
+
+-- true to show the total delta splits sector 1 + sector 2
+-- false to show the delta of sector 2 only
+mDelta_total_split_sectors = true
+
+-- delta time delay
+mDeltaTimeBackup = 0
+mDeltaTimeOldTicks = 0
+mDeltaTimeAlternateOldTicks = 0
+-- change the delay below to increase or decrease the update of delta time
+mDeltaTimeDelay = 200
+-- change the delay below to increase or decrease the update of lap time
+mRefreshLapTimeRate = 50
+
+-- get feedback on display when you turn encoder or press button assigned to internal functions, see control.lua
+-- true if you want to display switch pos and value
+mSwitchFeedbackAllowed = false
+
+-- Fanatec Digits Status
+mFanatecDigitsFeedbackAllowed = true
+-- Fanatec speedlimiter method seleted
+mFanatecSpeedLimiterFeedbackAllowed = true
+-- Fanatec osp method seleted
+mFanatecOSPFeedbackAllowed = true
+-- Fanatec shiftlights method seleted
+mFanatecShiftlightsFeedbackAllowed = true
+
+-- Low Fuel status
+mLowFuelFeedbackAllowed = true
+
+-- Left and Right Digits status
+mLeftDigitsFeedbackAllowed = false
+mRightDigitsFeedbackAllowed = false
+
+-- display KPH or KMH
+mUnitFeedbackAllowed = true
+
+-- show the current OSP Factor
+mOSPFeedbackAllowed = true
+
+-- cool global brightness feedback
+mBrightnessFeedbackAllowed = true
+
+-- show the current value of maxgear option
+mMaxGearFeedbackAllowed = true
+
+-- activate or deactivate lap dump telemetry
+-- using button 9 by default
+mDumpLapAllowed = false
+mDumpLapButton = 9
+
+-- dump telemetry
+TelemetryTools("dumplastlap", false);
+
+-- mapping to keystroke demo script
+-- see the support forum for more info on key mapping
+mDemoMapToKeyAllowed = false
+mDemoMapToKeySwitch = 5
+
+-- ============================================================
-- GLOBAL VAR
-- ============================================================
-- SMXMessageBox Styles
@@ -70,56 +133,6 @@ mSRDlxRightText = ""
mSRF1LeftText = ""
mSRF1RightText = ""
--- get feedback on display when you turn encoder or press button assigned to internal functions, see control.lua
--- true if you want to display switch pos and value
-mSwitchFeedbackAllowed = true
-
--- mapping to keystroke demo script
--- see the support forum for more info on key mapping
-mDemoMapToKeyAllowed = false
-mDemoMapToKeySwitch = 5
-
--- Fanatec Digits Status
-mFanatecDigitsFeedbackAllowed = true
--- Fanatec speedlimiter method seleted
-mFanatecSpeedLimiterFeedbackAllowed = true
--- Fanatec osp method seleted
-mFanatecOSPFeedbackAllowed = true
--- Fanatec shiftlights method seleted
-mFanatecShiftlightsFeedbackAllowed = true
-
--- Low Fuel status
-mLowFuelFeedbackAllowed = true
-
--- Left and Right Digits status
-mLeftDigitsFeedbackAllowed = true
-mRightDigitsFeedbackAllowed = true
-
--- display KPH or KMH
-mUnitFeedbackAllowed = true
-
--- show the current OSP Factor
-mOSPFeedbackAllowed = true
-
--- cool global brightness feedback
-mBrightnessFeedbackAllowed = true
-
--- show the current value of maxgear option
-mMaxGearFeedbackAllowed = true
-
--- activate or deactivate lap dump telemetry
--- using button 9 by default
-mDumpLapAllowed = false
-mDumpLapButton = 9
-
--- delta time delay
-mDeltaTimeBackup = 0
-mDeltaTimeOldTicks = 0
-mDeltaTimeDelay = 100
-mRefreshLapTimeRate = 50
-
--- dump telemetry
-TelemetryTools("dumplastlap", false);
-- ============================================================
-- init globals flag
@@ -140,7 +153,7 @@ mRPMLedTable = {
RPM10=0,
RPM11=0,
RPM12=0,
- RPM13=0,
+ RPM13=0,
RPM14=0
}
@@ -149,6 +162,23 @@ mRPMLedTable = {
-- mDeviceType no longer avaialable use GetDeviceType(devID) see 2.3 API
+-- init globals
+if mOld_ls1 == nil then
+ mOld_bs1 = 0.00000
+ mOld_bs2 = 0.00000
+ mOld_bt = 0.00000
+ mDelta_lpt = 0.00000
+ mDelta_lptb = 0.00000
+ mOld_ls1 = 0.00000
+ mOld_ls2 = 0.00000
+ mOld_lt = 0.00000
+ mDelta_lpt = 0.00000
+ mDelta_lptb = 0.00000
+ mDelta_Sect1 = 0.0000
+ mDelta_Sect1b = 0.0000
+end
+
+
-- --------------------------------------------
-- KERS functions
-- --------------------------------------------
@@ -158,7 +188,7 @@ function GetKersPercent()
local kers_level = GetCarInfo("kers")
local k_percent = 0
if kers_level ~= nil and kers_level > 0 then
- k_percent = round((kers_level/1000) / 4 )
+ k_percent = round((kers_level/1000) / 4 )
end
return k_percent
end
@@ -187,10 +217,10 @@ end
-- set RPM threshold value in percentage ( SLIMax Manager 2.1 )
function SetRPMPercentValue(index, value)
if index <1 or index>15 then
- return
+ return
end
if value <0 or value >100 then
- return
+ return
end
RPM_PERCENT_VALUES[index] = value
@@ -199,10 +229,10 @@ end
-- set RPM threshold value ( SLIMax Manager 2.1 )
function SetRPMAbsoluteValue(index, value)
if index <1 or index>15 then
- return
+ return
end
if value <0 or value >20000 then
- return
+ return
end
RPM_ABSOLUTE_VALUES[index] = value
@@ -253,7 +283,7 @@ function GetSLIMaxInfo()
end
-- get cpu ticks
-function GetTicks()
+ function GetTicks()
local tcks = GetContextInfo("ticks")
if tcks == nil then tcks = 0 end
return tcks
@@ -262,9 +292,9 @@ end
-- reset table function
function initLedTable(ibl, value)
if ibl ~= nil then
- for k, v in pairs(ibl) do
- ibl[k] = value
- end
+ for k, v in pairs(ibl) do
+ ibl[k] = value
+ end
end
end
@@ -290,36 +320,15 @@ function round(num)
return i
end
--- The following function calculate hr, mn, sec, hd, ms
--- param: time in meter/sec
-function timeDispatcher( tt)
- if tms == nil then tms = 0 end
- local tms = math.abs(tt)
- local t_hr = 0
- local t_mn = 0
- local t_sc = 0
- local t_ms = 0
- local t_hd = 0
-
- if tms > 0 then
- t_hr, n = math.modf(tms/3600)
- t_mn, c = math.modf(n*60)
- t_sc, s = math.modf(c*60)
- t_hd, h = math.modf(s*100)
- t_ms, m = math.modf(s*1000)
- end
--- print( tt, t_hr, t_mn, t_sc, t_hd, t_ms)
- return t_hr, t_mn, t_sc, t_hd, t_ms
-end
-- return speed in KPH or MPH
function speed(spd, selector)
if spd == nil then spd = 0 end
if selector then
- -- MPH
- return ( spd * 2.237)
+ -- MPH
+ return ( spd * 2.237)
else
- return (spd * 3.6)
+ return (spd * 3.6)
end
end
@@ -352,10 +361,10 @@ end
function GetFuel(fl, selector)
if fl == nil then fl = 0 end
if selector then
- -- gallons
- return LtoG( fl)
+ -- gallons
+ return LtoG( fl)
else
- return fl
+ return fl
end
end
@@ -363,10 +372,10 @@ end
function GetTemp(tmp, selector)
if tmp == nil then tmp = 0 end
if selector then
- -- gallons
- return CtoF( tmp)
+ -- gallons
+ return CtoF( tmp)
else
- return tmp
+ return tmp
end
end
@@ -396,12 +405,12 @@ function GetCurrentGear()
local result = g
if g == 0 then
- -- if neutral and using custom OSP record then add a dot to gear digit
- if ospcustom_on then n = n + 128 end
- result = string.char(n)
+ -- if neutral and using custom OSP record then add a dot to gear digit
+ if ospcustom_on then n = n + 128 end
+ result = string.char(n)
elseif g < 0 then
- -- reverse
- result = r
+ -- reverse
+ result = r
end
return result
@@ -409,111 +418,320 @@ end
function isAppIRacing(sim)
if sim == "iRacingSim.exe" or sim == "iRacingSim64.exe" then
- return true
+ return true
end
return false
end
function isAppRFactor(sim)
if sim == "rFactor.exe" or sim == "rFactor2.exe" then
- return true
+ return true
end
return false
end
+-- force display text on left or/and right panel during delay in ms
+function LeftRightMessageText(delay, left_text, right_text)
+ -- disallow Mgr to display info on digits
+ SetDigitsAllowed(false)
+
+ -- set timeout
+ local oldTcks = GetTicks() + delay
+
+ -- loop until timeout
+ while(oldTcks > GetTicks()) do
+ SLISleep(1)
+ if left_text ~= "" then
+ SetLeftDigits(left_text)
+ end
+ if right_text ~= "" then
+ SetRightDigits(right_text)
+ end
+ SLISendReport(0)
+ end
+
+ -- cleanup device
+ UpdateDigits(" ", " ")
+ SLISendReport(0)
+
+ -- allow Mgr to display info on digits
+ SetDigitsAllowed(true)
+end
+
+
+-- The following function calculate hr, mn, sec, hd, ms
+-- param: time in meter/sec
+function timeDispatcher( tt)
+ if tms == nil then tms = 0 end
+ local tms = math.abs(tt)
+ local t_hr = 0
+ local t_mn = 0
+ local t_sc = 0
+ local t_ms = 0
+ local t_hd = 0
+
+ if tms > 0 then
+ t_hr, n = math.modf(tms/3600)
+ t_mn, c = math.modf(n*60)
+ t_sc, s = math.modf(c*60)
+ t_hd, h = math.modf(s*100)
+ t_ms, m = math.modf(s*1000)
+ end
+-- print( tt, t_hr, t_mn, t_sc, t_hd, t_ms)
+ return t_hr, t_mn, t_sc, t_hd, t_ms
+end
+
function DisplayFormatTime(lptime, delay, dec, deltaflag, numDigits)
local ticks = GetTicks()
if dft_old_time == nil or (ticks - dft_old_time) > delay then
- -- global to backup ticks (ms)
- dft_old_time = ticks
-
- local hr = 0
- local mn = 0
- local sc = 0
- local ms = 0
- local hd = 0
- local panel = ""
- local prefix = " "
-
- if lptime < 0 then
- prefix = "-"
- end
- -- explod time
- hr, mn, sc, hd, ms = timeDispatcher(lptime)
-
- if deltaflag == 1 then
- --display delta time
- if lptime == -1 or (mn + sc + ms) == 0.0 then
- if numDigits == 3 then
- Panel = "-.--"
- else
- Panel = " -.-- "
- end
- elseif mn > 0 then
- if numDigits == 3 then
- if mn < 100 then
- Panel = string.format( "%s%02d.", prefix, mn)
- else
- Panel = " ."
- end
-
- else
- Panel = string.format( " %s%1d.%02d ", prefix, mn, sc)
- end
- else
-
- if numDigits == 3 then
- if sc < 10 then
- if prefix == "-" then
- Panel = string.format( "%s%1d.%01d ", prefix, sc, hd)
- else
- Panel = string.format( "%1d.%02d ", sc, hd)
- end
- else
- Panel = " . "
- end
- else
- if Ndig == 2 then
- Panel = string.format( " %s%1d.%02d ", prefix, sc, hd)
- else
- Panel = string.format( " %s%1d.%03d", prefix, sc, ms)
- end
- end
-
- end
-
- elseif deltaflag == 0 then
- --display laptime
- if lptime == -1 or (mn + sc + ms) == 0.0 then
- if numDigits == 3 then
- Panel = "-.--"
- else
- Panel = "-:--.---"
- end
-
- elseif mn < 10 then
- if numDigits == 3 then
- Panel = string.format( "%1d.%02d", mn, sc)
- else
- Panel = string.format( "%1d:%02d.%03d", mn, sc, ms)
- end
- elseif hr > 0 then
- if numDigits == 3 then
- Panel = " . "
- else
- Panel = string.format( " %02d.%02d ", hr, mn)
- end
- else
- if numDigits == 3 then
- Panel = string.format( " %02d.", mn)
- else
- Panel = string.format( " %02d.%02d.%01d", mn, sc, ms)
- end
- end
- end
+ -- global to backup ticks (ms)
+ dft_old_time = ticks
+
+ local hr = 0
+ local mn = 0
+ local sc = 0
+ local ms = 0
+ local hd = 0
+ local panel = ""
+ local prefix = " "
+
+ if lptime < 0 then
+ prefix = "-"
+ end
+ -- explod time
+ hr, mn, sc, hd, ms = timeDispatcher(lptime)
+
+ if deltaflag == 1 then
+ --display delta time
+ if lptime == -1 or (mn + sc + ms) == 0.0 then
+ if numDigits == 3 then
+ Panel = "-.--"
+ else
+ Panel = " -.-- "
+ end
+ elseif mn > 0 then
+ if numDigits == 3 then
+ if mn < 100 then
+ Panel = string.format( "%s%02d.", prefix, mn)
+ else
+ Panel = " ."
+ end
+
+ else
+ Panel = string.format( " %s%1d.%02d ", prefix, mn, sc)
+ end
+ else
+
+ if numDigits == 3 then
+ if sc < 10 then
+ if prefix == "-" then
+ Panel = string.format( "%s%1d.%01d ", prefix, sc, hd)
+ else
+ Panel = string.format( "%1d.%02d ", sc, hd)
+ end
+ else
+ Panel = " . "
+ end
+ else
+ if Ndig == 2 then
+ Panel = string.format( " %s%1d.%02d ", prefix, sc, hd)
+ else
+ Panel = string.format( " %s%1d.%03d", prefix, sc, ms)
+ end
+ end
+
+ end
+
+ elseif deltaflag == 0 then
+ --display laptime
+ if lptime == -1 or (mn + sc + ms) == 0.0 then
+ if numDigits == 3 then
+ Panel = "-.--"
+ else
+ Panel = "-:--.---"
+ end
+
+ elseif mn < 10 then
+ if numDigits == 3 then
+ Panel = string.format( "%1d.%02d", mn, sc)
+ else
+ Panel = string.format( "%1d:%02d.%03d", mn, sc, ms)
+ end
+ elseif hr > 0 then
+ if numDigits == 3 then
+ Panel = " . "
+ else
+ Panel = string.format( " %02d.%02d ", hr, mn)
+ end
+ else
+ if numDigits == 3 then
+ Panel = string.format( " %02d.", mn)
+ else
+ Panel = string.format( " %02d.%02d.%01d", mn, sc, ms)
+ end
+ end
+ end
end
return Panel
end
+
+
+-- return delta time vs last time + sector diff
+function GetDeltaLastTime(isRF)
+
+ local lpt = 0.0
+
+ local sector = GetCarInfo("sector")
+
+ if mDiffSectorDelay == nil or mDiffOldSector == nil or mDiffOldSector ~= sector then
+ -- 8s delay, increase it if needed
+ mDiffSectorDelay = GetTicks() + 8000
+ mDiffOldSector = sector
+
+ if sector == 1 then
+ -- diff lap time 3
+ local lt = GetTimeInfo("lastlaptime")
+
+ if lt > 0 and mOld_lt > 0 then
+ -- diff
+ mDelta_lpt = lt - mOld_lt
+ end
+ -- backup lt
+ mOld_lt = lt
+ -- save bt for delta vs best function
+ mOld_bt = GetTimeInfo("bestlaptime")
+
+
+ elseif sector == 2 then
+ -- diff sector 1
+ local ls1 = GetTimeInfo("lastsector1")
+ if isRF then
+ ls1 = GetTimeInfo("sector1")
+ end
+
+ if ls1 > 0 and mOld_ls1 > 0 then
+ mDelta_lpt = ls1 - mOld_ls1
+ mDelta_Sect1 = mDelta_lpt
+ end
+
+ -- backup
+ mOld_ls1 = ls1
+ -- save bt for delta vs best function
+ mOld_bs = GetTimeInfo("bestsector1")
+
+ else
+ -- diff sector 2
+ local ls2 = GetTimeInfo("lastsector2")
+ if isRF then
+ ls2 = GetTimeInfo("sector2")
+ end
+
+
+ if ls2 > 0 and mOld_ls2 > 0 then
+ if mDelta_total_split_sectors then
+ mDelta_lpt = mDelta_Sect1 + (ls2 - mOld_ls2)
+ else
+ mDelta_lpt = ls2 - mOld_ls2
+ end
+ end
+ -- backup value
+ mOld_ls2 = ls2
+ -- save bt for delta vs best function below
+ mOld_bs2 = GetTimeInfo("bestsector2")
+
+ end
+ end
+
+ -- display delta by default
+ lpt = GetTimeInfo("realdifflast")
+
+ if mDiffSectorDelay > GetTicks() then
+ lpt = mDelta_lpt
+ end
+
+ return lpt
+end
+
+-- return delta time vs best time + sector diff
+function GetDeltaBestTime(isRF)
+ local lpt = 0.0
+
+ -- get sector
+ local sector = GetCarInfo("sector")
+
+ -- set delay
+ if mDiffSectorDelay == nil or mDiffOldSector == nil or mDiffOldSector ~= sector then
+ -- 8s delay, increase it if needed
+ mDiffSectorDelay = GetTicks() + 8000
+ mDiffOldSector = sector
+
+ -- display sector diff during delay
+ if sector == 1 then
+
+ -- diff last lap time vs best
+ local bt = GetTimeInfo("lastlaptime")
+
+ -- save lt for delta vs last function above
+ mOld_lt = bt
+
+ -- compare
+ if bt > 0 and mOld_bt > 0 then
+ -- delta
+ mDelta_lptb = bt - mOld_bt
+ end
+ -- backup
+ mOld_bt = GetTimeInfo("bestlaptime")
+
+
+ elseif sector == 2 then
+ -- diff sector 1
+ local bs1 = GetTimeInfo("lastsector1")
+ if isRF then
+ bs1 = GetTimeInfo("sector1")
+ end
+ -- save lt for delta vs last function
+ mOld_ls1 = bs1
+
+ -- compare
+ if bs1 > 0 and mOld_bs1 > 0 then
+ mDelta_lptb = bs1 - mOld_bs1
+ mDelta_Sect1b = mDelta_lptb
+ end
+
+ mOld_bs1 = GetTimeInfo("bestsector1")
+
+ else
+ -- diff sector 2
+ local bs2 = GetTimeInfo("lastsector2")
+ if isRF then
+ bs2 = GetTimeInfo("sector2")
+ end
+ -- save lt for delta vs last function
+ mOld_ls2 = bs2
+
+ -- compare with old value
+ if bs2 > 0 and mOld_bs2 > 0 then
+ if mDelta_total_split_sectors then
+ mDelta_lptb = mDelta_Sect1b + (bs2 - mOld_bs2)
+ else
+ mDelta_lptb = bs2 - mOld_bs2
+ end
+ end
+ -- backup
+ mOld_bs2 = GetTimeInfo("bestsector2")
+ end
+ end
+
+ -- display delta by default
+ lpt = GetTimeInfo("realdiffbest")
+
+ if mDiffSectorDelay > GetTicks() then
+ lpt = mDelta_lptb
+ end
+
+ return lpt
+end
+
--==============================================
require "scripts/slidevice"
diff --git a/scripts/osp.lua b/scripts/osp.lua
index 0b6ded3..6172b2d 100644
--- a/scripts/osp.lua
+++ b/scripts/osp.lua
@@ -5,14 +5,14 @@
function SetOSPFeedback(state)
if mOSPLED1 > 6 then
- SetExtLed( (mOSPLED1 - 6), state)
+ SetExtLed( (mOSPLED1 - 6), state)
else
- SetWarnLed(mOSPLED1, state)
+ SetWarnLed(mOSPLED1, state)
end
if mOSPLED2 > 6 then
- SetExtLed( (mOSPLED2 - 6), state)
+ SetExtLed( (mOSPLED2 - 6), state)
else
- SetWarnLed(mOSPLED2, state)
+ SetWarnLed(mOSPLED2, state)
end
end
@@ -38,9 +38,9 @@ function ospMethodEvent(idx)
-- check if globals initialized
if isGlobalInitialized == 0 then
- isGlobalInitialized = 1
- -- init
- InitGlobals()
+ isGlobalInitialized = 1
+ -- init
+ InitGlobals()
end
-- get global prefs
GetSLIMaxInfo()
@@ -75,14 +75,14 @@ function ospMethodEvent(idx)
-- skip if neutral or ==maxgear
if gear <=0 or gear>=maxGear then
- -- do nothing
- return 1
+ -- do nothing
+ return 1
end
-- skip if first gear not allowed
if not mOSPWithFirstGear and gear == 1 then
- -- do nothing
- return 1
+ -- do nothing
+ return 1
end
-- print("OSP1: " .. mOSPLED1 .. " OSP2: " .. mOSPLED2 .."\n")
@@ -91,68 +91,68 @@ function ospMethodEvent(idx)
-- rpm > osplimit so activate shiftpoints leds
if rpm > gOSPLimit then
- -- no blinking allowed
- if mNoBlink then
- -- set both leds
- SetOSPFeedback(1)
-
- else
-
- if GetTicks() > mOldOSPTickCount then
- mOSPBlink = mOSPBlink + 1
- end
-
- if mOSPMethod <= 3 then
- -- methods 1 to 3
- if mOSPBlink >= mOSPBlinkTime then
- mOSPBlink = 0
- end
-
- if mOSPBlink <= (mOSPBlinkTime / 2) then
- if mOSPMethod ~= 3 then
- -- if not method 3
- SetOSPFeedback(1)
- end
- if (mOSPMethod == 1) or (mOSPMethod == 3) then
- -- add blue leds blinking if method 1 or 3
- for i = 9,12 do
- led = led.format("RPM%d",i)
- mRPMLedTable[led] = 1
- end
- SetRPMLed("mRPMLedTable")
- end
- end
-
- if mOSPBlink > (mOSPBlinkTime / 2) then
- SetOSPFeedback(0)
-
- if (mOSPMethod == 1) or (mOSPMethod == 3) then
- -- add blue leds blinking if method 1 or 3
- for i = 9,12 do
- led = led.format("RPM%d",i)
- mRPMLedTable[led] = 0
- end
- SetRPMLed("mRPMLedTable")
- end
- end
- end
-
- if mOSPMethod == 2 then
- -- add blue leds not blinking if method 2
- for i = 9,12 do
- led = led.format("RPM%d",i)
- mRPMLedTable[led] = 1
- end
- SetRPMLed("mRPMLedTable")
- end
- end
+ -- no blinking allowed
+ if mNoBlink then
+ -- set both leds
+ SetOSPFeedback(1)
+
+ else
+
+ if GetTicks() > mOldOSPTickCount then
+ mOSPBlink = mOSPBlink + 1
+ end
+
+ if mOSPMethod <= 3 then
+ -- methods 1 to 3
+ if mOSPBlink >= mOSPBlinkTime then
+ mOSPBlink = 0
+ end
+
+ if mOSPBlink <= (mOSPBlinkTime / 2) then
+ if mOSPMethod ~= 3 then
+ -- if not method 3
+ SetOSPFeedback(1)
+ end
+ if (mOSPMethod == 1) or (mOSPMethod == 3) then
+ -- add blue leds blinking if method 1 or 3
+ for i = 9,12 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 1
+ end
+ SetRPMLed("mRPMLedTable")
+ end
+ end
+
+ if mOSPBlink > (mOSPBlinkTime / 2) then
+ SetOSPFeedback(0)
+
+ if (mOSPMethod == 1) or (mOSPMethod == 3) then
+ -- add blue leds blinking if method 1 or 3
+ for i = 9,12 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 0
+ end
+ SetRPMLed("mRPMLedTable")
+ end
+ end
+ end
+
+ if mOSPMethod == 2 then
+ -- add blue leds not blinking if method 2
+ for i = 9,12 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 1
+ end
+ SetRPMLed("mRPMLedTable")
+ end
+ end
else
- -- bypass (give control to manager)
- return 1
+ -- bypass (give control to manager)
+ return 1
end
-- timebase
if GetTicks() > mOldOSPTickCount then
- mOldOSPTickCount = GetTicks() + 10
+ mOldOSPTickCount = GetTicks() + 10
end
return 1
@@ -181,9 +181,9 @@ function ospG27MethodEvent(idx)
-- check if globals initialized
if isGlobalInitialized == 0 then
- isGlobalInitialized = 1
- -- init
- InitGlobals()
+ isGlobalInitialized = 1
+ -- init
+ InitGlobals()
end
-- get global prefs
GetSLIMaxInfo()
@@ -210,8 +210,8 @@ function ospG27MethodEvent(idx)
-- skip if neutral or ==maxgear
if gear <=0 or gear>=maxGear then
- -- do nothing
- return 1
+ -- do nothing
+ return 1
end
-- print("MAXGear: " .. gear.."/"..maxGear.." OSP: " .. mOSPG27Method .. " rpm: " .. rpm .. " - " .. gOSPLimit .. "\n")
@@ -219,76 +219,76 @@ function ospG27MethodEvent(idx)
-- skip if first gear not allowed
if not mOSPWithFirstGear and gear == 1 then
- -- do nothing
- return 1
+ -- do nothing
+ return 1
end
-- rpm > osplimit so activate shiftpoints leds
if rpm > gOSPLimit then
- mG27Leds = 0
-
- -- no blinking allowed
- if mNoBlink then
- -- set all leds
- mG27Leds = 0x1F;
-
- else
- if GetTicks() > mOldOSPTickCount then
- mOSPBlink = mOSPBlink + 1
- end
-
- if mOSPG27Method <= 1 or mOSPG27Method > 3 then
- -- methods 1 all blinking
- if mOSPBlink >= mOSPBlinkTime then
- mOSPBlink = 0
- end
-
- if mOSPBlink <= (mOSPBlinkTime / 2) then
- mG27Leds = 0x1F;
- end
-
- if mOSPBlink > (mOSPBlinkTime / 2) then
- mG27Leds = 0;
- end
- elseif mOSPG27Method == 2 then
- -- methods side blinking
- if mOSPBlink >= mOSPBlinkTime then
- mOSPBlink = 0
- end
-
- if mOSPBlink <= (mOSPBlinkTime / 2) then
- mG27Leds = 0x3;
- end
-
- if mOSPBlink > (mOSPBlinkTime / 2) then
- mG27Leds = 0;
- end
-
- elseif mOSPG27Method == 3 then
- -- methods 3 center blinking
- if mOSPBlink >= mOSPBlinkTime then
- mOSPBlink = 0
- end
-
- if mOSPBlink <= (mOSPBlinkTime / 2) then
- mG27Leds = 0x18;
- end
-
- if mOSPBlink > (mOSPBlinkTime / 2) then
- mG27Leds = 0;
- end
- end
- end
- SetG27Led(mG27Leds)
+ mG27Leds = 0
+
+ -- no blinking allowed
+ if mNoBlink then
+ -- set all leds
+ mG27Leds = 0x1F;
+
else
- -- bypass (give control to manager)
- return 1
+ if GetTicks() > mOldOSPTickCount then
+ mOSPBlink = mOSPBlink + 1
+ end
+
+ if mOSPG27Method <= 1 or mOSPG27Method > 3 then
+ -- methods 1 all blinking
+ if mOSPBlink >= mOSPBlinkTime then
+ mOSPBlink = 0
+ end
+
+ if mOSPBlink <= (mOSPBlinkTime / 2) then
+ mG27Leds = 0x1F;
+ end
+
+ if mOSPBlink > (mOSPBlinkTime / 2) then
+ mG27Leds = 0;
+ end
+ elseif mOSPG27Method == 2 then
+ -- methods side blinking
+ if mOSPBlink >= mOSPBlinkTime then
+ mOSPBlink = 0
+ end
+
+ if mOSPBlink <= (mOSPBlinkTime / 2) then
+ mG27Leds = 0x3;
+ end
+
+ if mOSPBlink > (mOSPBlinkTime / 2) then
+ mG27Leds = 0;
+ end
+
+ elseif mOSPG27Method == 3 then
+ -- methods 3 center blinking
+ if mOSPBlink >= mOSPBlinkTime then
+ mOSPBlink = 0
+ end
+
+ if mOSPBlink <= (mOSPBlinkTime / 2) then
+ mG27Leds = 0x18;
+ end
+
+ if mOSPBlink > (mOSPBlinkTime / 2) then
+ mG27Leds = 0;
+ end
+ end
+ end
+ SetG27Led(mG27Leds)
+ else
+ -- bypass (give control to manager)
+ return 1
end
-- timebase
if GetTicks() > mOldOSPTickCount then
- mOldOSPTickCount = GetTicks() + 10
+ mOldOSPTickCount = GetTicks() + 10
end
return 1
@@ -316,9 +316,9 @@ function ospFanatecMethodEvent(idx)
-- check if globals initialized
if isGlobalInitialized == 0 then
- isGlobalInitialized = 1
- -- init
- InitGlobals()
+ isGlobalInitialized = 1
+ -- init
+ InitGlobals()
end
-- get global prefs
GetSLIMaxInfo()
@@ -345,123 +345,123 @@ function ospFanatecMethodEvent(idx)
-- skip if neutral or ==maxgear
if gear <=0 or gear>=maxGear then
- -- do nothing
- return 1
+ -- do nothing
+ return 1
end
-- skip if first gear not allowed
if not mOSPWithFirstGear and gear == 1 then
- -- do nothing
- return 1
+ -- do nothing
+ return 1
end
-- rpm > osplimit so activate shiftpoints leds
if rpm > gOSPLimit then
- -- no blinking allowed
- if mNoBlink then
- -- no led
- else
-
- if GetTicks() > mOldOSPTickCount then
- mOSPBlink = mOSPBlink + 1
- end
-
- -- methods 1 to 4
- if mOSPBlink >= mOSPBlinkTime then
- mOSPBlink = 0
- end
-
- if mOSPBlink <= (mOSPBlinkTime / 2) then
- if (mOSPFanatecMethod <= 0) or mOSPFanatecMethod > 4 then
- -- blue leds blinking if method 0, ON
- for i = 6,8 do
- led = led.format("RPM%d",i)
- mRPMLedTable[led] = 1
- end
-
- elseif mOSPFanatecMethod == 1 then
- -- all leds blinking if method 1, ON
- for i = 0,8 do
- led = led.format("RPM%d",i)
- mRPMLedTable[led] = 1
- end
-
- elseif mOSPFanatecMethod == 2 then
- initLedTable(mRPMLedTable, 0)
- -- side leds blinking if method 2, ON
- mRPMLedTable["RPM0"] = 1
- mRPMLedTable["RPM1"] = 1
- mRPMLedTable["RPM7"] = 1
- mRPMLedTable["RPM8"] = 1
-
- elseif mOSPFanatecMethod == 3 then
- initLedTable(mRPMLedTable, 0)
- -- center leds blinking if method 3, ON
- mRPMLedTable["RPM3"] = 1
- mRPMLedTable["RPM4"] = 1
- mRPMLedTable["RPM5"] = 1
-
- elseif mOSPFanatecMethod == 4 then
- initLedTable(mRPMLedTable, 0)
- -- side fixed if method 4, ON
- mRPMLedTable["RPM0"] = 1
- mRPMLedTable["RPM1"] = 1
- mRPMLedTable["RPM7"] = 1
- mRPMLedTable["RPM8"] = 1
- end
- SetRPMLed("mRPMLedTable")
- end
-
- if mOSPBlink > (mOSPBlinkTime / 2) then
- if (mOSPFanatecMethod <= 0) or mOSPFanatecMethod > 4 then
- -- blue leds blinking if method 0 , OFF
- for i = 6,8 do
- led = led.format("RPM%d",i)
- mRPMLedTable[led] = 0
- end
-
- elseif mOSPFanatecMethod == 1 then
- -- all leds blinking if method 1, OFF
- for i = 0,8 do
- led = led.format("RPM%d",i)
- mRPMLedTable[led] = 0
- end
-
- elseif mOSPFanatecMethod == 2 then
- initLedTable(mRPMLedTable, 0)
- -- side leds blinking if method 2, OFF
- mRPMLedTable["RPM0"] = 0
- mRPMLedTable["RPM1"] = 0
- mRPMLedTable["RPM7"] = 0
- mRPMLedTable["RPM8"] = 0
-
- elseif mOSPFanatecMethod == 3 then
- initLedTable(mRPMLedTable, 0)
- -- center leds blinking if method 3, OFF
- mRPMLedTable["RPM3"] = 0
- mRPMLedTable["RPM4"] = 0
- mRPMLedTable["RPM5"] = 0
-
- elseif mOSPFanatecMethod == 4 then
- initLedTable(mRPMLedTable, 0)
- -- side fixed if method 4, ON
- mRPMLedTable["RPM0"] = 1
- mRPMLedTable["RPM1"] = 1
- mRPMLedTable["RPM7"] = 1
- mRPMLedTable["RPM8"] = 1
- end
- SetRPMLed("mRPMLedTable")
- end
- end
+ -- no blinking allowed
+ if mNoBlink then
+ -- no led
+ else
+
+ if GetTicks() > mOldOSPTickCount then
+ mOSPBlink = mOSPBlink + 1
+ end
+
+ -- methods 1 to 4
+ if mOSPBlink >= mOSPBlinkTime then
+ mOSPBlink = 0
+ end
+
+ if mOSPBlink <= (mOSPBlinkTime / 2) then
+ if (mOSPFanatecMethod <= 0) or mOSPFanatecMethod > 4 then
+ -- blue leds blinking if method 0, ON
+ for i = 6,8 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 1
+ end
+
+ elseif mOSPFanatecMethod == 1 then
+ -- all leds blinking if method 1, ON
+ for i = 0,8 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 1
+ end
+
+ elseif mOSPFanatecMethod == 2 then
+ initLedTable(mRPMLedTable, 0)
+ -- side leds blinking if method 2, ON
+ mRPMLedTable["RPM0"] = 1
+ mRPMLedTable["RPM1"] = 1
+ mRPMLedTable["RPM7"] = 1
+ mRPMLedTable["RPM8"] = 1
+
+ elseif mOSPFanatecMethod == 3 then
+ initLedTable(mRPMLedTable, 0)
+ -- center leds blinking if method 3, ON
+ mRPMLedTable["RPM3"] = 1
+ mRPMLedTable["RPM4"] = 1
+ mRPMLedTable["RPM5"] = 1
+
+ elseif mOSPFanatecMethod == 4 then
+ initLedTable(mRPMLedTable, 0)
+ -- side fixed if method 4, ON
+ mRPMLedTable["RPM0"] = 1
+ mRPMLedTable["RPM1"] = 1
+ mRPMLedTable["RPM7"] = 1
+ mRPMLedTable["RPM8"] = 1
+ end
+ SetRPMLed("mRPMLedTable")
+ end
+
+ if mOSPBlink > (mOSPBlinkTime / 2) then
+ if (mOSPFanatecMethod <= 0) or mOSPFanatecMethod > 4 then
+ -- blue leds blinking if method 0 , OFF
+ for i = 6,8 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 0
+ end
+
+ elseif mOSPFanatecMethod == 1 then
+ -- all leds blinking if method 1, OFF
+ for i = 0,8 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 0
+ end
+
+ elseif mOSPFanatecMethod == 2 then
+ initLedTable(mRPMLedTable, 0)
+ -- side leds blinking if method 2, OFF
+ mRPMLedTable["RPM0"] = 0
+ mRPMLedTable["RPM1"] = 0
+ mRPMLedTable["RPM7"] = 0
+ mRPMLedTable["RPM8"] = 0
+
+ elseif mOSPFanatecMethod == 3 then
+ initLedTable(mRPMLedTable, 0)
+ -- center leds blinking if method 3, OFF
+ mRPMLedTable["RPM3"] = 0
+ mRPMLedTable["RPM4"] = 0
+ mRPMLedTable["RPM5"] = 0
+
+ elseif mOSPFanatecMethod == 4 then
+ initLedTable(mRPMLedTable, 0)
+ -- side fixed if method 4, ON
+ mRPMLedTable["RPM0"] = 1
+ mRPMLedTable["RPM1"] = 1
+ mRPMLedTable["RPM7"] = 1
+ mRPMLedTable["RPM8"] = 1
+ end
+ SetRPMLed("mRPMLedTable")
+ end
+ end
else
- -- bypass (give control to manager)
- return 1
+ -- bypass (give control to manager)
+ return 1
end
-- timebase
if GetTicks() > mOldOSPTickCount then
- mOldOSPTickCount = GetTicks() + 10
+ mOldOSPTickCount = GetTicks() + 10
end
return 1
@@ -491,9 +491,9 @@ function ospSRDlxMethodEvent(idx)
-- check if globals initialized
if isGlobalInitialized == 0 then
- isGlobalInitialized = 1
- -- init
- InitGlobals()
+ isGlobalInitialized = 1
+ -- init
+ InitGlobals()
end
-- get global prefs
GetSLIMaxInfo()
@@ -528,14 +528,14 @@ function ospSRDlxMethodEvent(idx)
-- skip if neutral or ==maxgear
if gear <=0 or gear>=maxGear then
- -- do nothing
- return 1
+ -- do nothing
+ return 1
end
-- skip if first gear not allowed
if not mOSPWithFirstGear and gear == 1 then
- -- do nothing
- return 1
+ -- do nothing
+ return 1
end
-- print("OSP1: " .. mOSPLED1 .. " OSP2: " .. mOSPLED2 .."\n")
@@ -544,68 +544,68 @@ function ospSRDlxMethodEvent(idx)
-- rpm > osplimit so activate shiftpoints leds
if rpm > gOSPLimit then
- -- no blinking allowed
- if mNoBlink then
- -- set both leds
- SetOSPFeedback(1)
-
- else
-
- if GetTicks() > mOldOSPTickCount then
- mOSPBlink = mOSPBlink + 1
- end
-
- if mOSPSRDlxMethod <= 3 then
- -- methods 1 to 3
- if mOSPBlink >= mOSPBlinkTime then
- mOSPBlink = 0
- end
-
- if mOSPBlink <= (mOSPBlinkTime / 2) then
- if mOSPSRDlxMethod ~= 3 then
- -- if not method 3
- SetOSPFeedback(1)
- end
- if (mOSPSRDlxMethod == 1) or (mOSPSRDlxMethod == 3) then
- -- add blue leds blinking if method 1 or 3
- for i = 7,9 do
- led = led.format("RPM%d",i)
- mRPMLedTable[led] = 1
- end
- SetRPMLed("mRPMLedTable")
- end
- end
-
- if mOSPBlink > (mOSPBlinkTime / 2) then
- SetOSPFeedback(0)
-
- if (mOSPSRDlxMethod == 1) or (mOSPSRDlxMethod == 3) then
- -- add blue leds blinking if method 1 or 3
- for i = 7,9 do
- led = led.format("RPM%d",i)
- mRPMLedTable[led] = 0
- end
- SetRPMLed("mRPMLedTable")
- end
- end
- end
-
- if mOSPSRDlxMethod == 2 then
- -- add blue leds not blinking if method 2
- for i = 7,9 do
- led = led.format("RPM%d",i)
- mRPMLedTable[led] = 1
- end
- SetRPMLed("mRPMLedTable")
- end
- end
+ -- no blinking allowed
+ if mNoBlink then
+ -- set both leds
+ SetOSPFeedback(1)
+
else
- -- bypass (give control to manager)
- return 1
+
+ if GetTicks() > mOldOSPTickCount then
+ mOSPBlink = mOSPBlink + 1
+ end
+
+ if mOSPSRDlxMethod <= 3 then
+ -- methods 1 to 3
+ if mOSPBlink >= mOSPBlinkTime then
+ mOSPBlink = 0
+ end
+
+ if mOSPBlink <= (mOSPBlinkTime / 2) then
+ if mOSPSRDlxMethod ~= 3 then
+ -- if not method 3
+ SetOSPFeedback(1)
+ end
+ if (mOSPSRDlxMethod == 1) or (mOSPSRDlxMethod == 3) then
+ -- add blue leds blinking if method 1 or 3
+ for i = 7,9 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 1
+ end
+ SetRPMLed("mRPMLedTable")
+ end
+ end
+
+ if mOSPBlink > (mOSPBlinkTime / 2) then
+ SetOSPFeedback(0)
+
+ if (mOSPSRDlxMethod == 1) or (mOSPSRDlxMethod == 3) then
+ -- add blue leds blinking if method 1 or 3
+ for i = 7,9 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 0
+ end
+ SetRPMLed("mRPMLedTable")
+ end
+ end
+ end
+
+ if mOSPSRDlxMethod == 2 then
+ -- add blue leds not blinking if method 2
+ for i = 7,9 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 1
+ end
+ SetRPMLed("mRPMLedTable")
+ end
+ end
+ else
+ -- bypass (give control to manager)
+ return 1
end
-- timebase
if GetTicks() > mOldOSPTickCount then
- mOldOSPTickCount = GetTicks() + 10
+ mOldOSPTickCount = GetTicks() + 10
end
return 1
@@ -636,9 +636,9 @@ function ospSRF1MethodEvent(idx)
-- check if globals initialized
if isGlobalInitialized == 0 then
- isGlobalInitialized = 1
- -- init
- InitGlobals()
+ isGlobalInitialized = 1
+ -- init
+ InitGlobals()
end
-- get global prefs
GetSLIMaxInfo()
@@ -673,14 +673,14 @@ function ospSRF1MethodEvent(idx)
-- skip if neutral or ==maxgear
if gear <=0 or gear>=maxGear then
- -- do nothing
- return 1
+ -- do nothing
+ return 1
end
-- skip if first gear not allowed
if not mOSPWithFirstGear and gear == 1 then
- -- do nothing
- return 1
+ -- do nothing
+ return 1
end
-- print("OSP1: " .. mOSPLED1 .. " OSP2: " .. mOSPLED2 .."\n")
@@ -689,68 +689,68 @@ function ospSRF1MethodEvent(idx)
-- rpm > osplimit so activate shiftpoints leds
if rpm > gOSPLimit then
- -- no blinking allowed
- if mNoBlink then
- -- set both leds
- SetOSPFeedback(1)
-
- else
-
- if GetTicks() > mOldOSPTickCount then
- mOSPBlink = mOSPBlink + 1
- end
-
- if mOSPSRF1Method <= 3 then
- -- methods 1 to 3
- if mOSPBlink >= mOSPBlinkTime then
- mOSPBlink = 0
- end
-
- if mOSPBlink <= (mOSPBlinkTime / 2) then
- if mOSPSRF1Method ~= 3 then
- -- if not method 3
- SetOSPFeedback(1)
- end
- if (mOSPSRF1Method == 1) or (mOSPSRF1Method == 3) then
- -- add blue leds blinking if method 1 or 3
- for i = 10,14 do
- led = led.format("RPM%d",i)
- mRPMLedTable[led] = 1
- end
- SetRPMLed("mRPMLedTable")
- end
- end
-
- if mOSPBlink > (mOSPBlinkTime / 2) then
- SetOSPFeedback(0)
-
- if (mOSPSRF1Method == 1) or (mOSPSRF1Method == 3) then
- -- add blue leds blinking if method 1 or 3
- for i = 10,14 do
- led = led.format("RPM%d",i)
- mRPMLedTable[led] = 0
- end
- SetRPMLed("mRPMLedTable")
- end
- end
- end
-
- if mOSPSRF1Method == 2 then
- -- add blue leds not blinking if method 2
- for i = 10,14 do
- led = led.format("RPM%d",i)
- mRPMLedTable[led] = 1
- end
- SetRPMLed("mRPMLedTable")
- end
- end
+ -- no blinking allowed
+ if mNoBlink then
+ -- set both leds
+ SetOSPFeedback(1)
+
else
- -- bypass (give control to manager)
- return 1
+
+ if GetTicks() > mOldOSPTickCount then
+ mOSPBlink = mOSPBlink + 1
+ end
+
+ if mOSPSRF1Method <= 3 then
+ -- methods 1 to 3
+ if mOSPBlink >= mOSPBlinkTime then
+ mOSPBlink = 0
+ end
+
+ if mOSPBlink <= (mOSPBlinkTime / 2) then
+ if mOSPSRF1Method ~= 3 then
+ -- if not method 3
+ SetOSPFeedback(1)
+ end
+ if (mOSPSRF1Method == 1) or (mOSPSRF1Method == 3) then
+ -- add blue leds blinking if method 1 or 3
+ for i = 10,14 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 1
+ end
+ SetRPMLed("mRPMLedTable")
+ end
+ end
+
+ if mOSPBlink > (mOSPBlinkTime / 2) then
+ SetOSPFeedback(0)
+
+ if (mOSPSRF1Method == 1) or (mOSPSRF1Method == 3) then
+ -- add blue leds blinking if method 1 or 3
+ for i = 10,14 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 0
+ end
+ SetRPMLed("mRPMLedTable")
+ end
+ end
+ end
+
+ if mOSPSRF1Method == 2 then
+ -- add blue leds not blinking if method 2
+ for i = 10,14 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 1
+ end
+ SetRPMLed("mRPMLedTable")
+ end
+ end
+ else
+ -- bypass (give control to manager)
+ return 1
end
-- timebase
if GetTicks() > mOldOSPTickCount then
- mOldOSPTickCount = GetTicks() + 10
+ mOldOSPTickCount = GetTicks() + 10
end
return 1
diff --git a/scripts/shiftlights.lua b/scripts/shiftlights.lua
index 795b68b..cc263b4 100644
--- a/scripts/shiftlights.lua
+++ b/scripts/shiftlights.lua
@@ -1,7 +1,7 @@
--- SLIMax Mgr Lua Script v3.3.1
+-- SLIMax Mgr Lua Script v3.3.2
-- Copyright (c)2012-2013 by Zappadoc - All Rights Reserved.
-- this script builds all shiftlights methods
--- last change by Zappadoc - 2013-10
+-- last change by Zappadoc - 2013-11
-- ==============================================================================
-- utilities functions and methods
@@ -40,18 +40,18 @@ end
function ProgressiveSLI(rpm, redzone, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13 )
local rz = redzone / 13
-- print("progessive")
- if rpm > (rz*p1) then mRPMLedTable.RPM0 = 1 end
- if rpm > (rz*p2) then mRPMLedTable.RPM1 = 1 end
+ if rpm > (rz*p1) then mRPMLedTable.RPM0 = 1 end
+ if rpm > (rz*p2) then mRPMLedTable.RPM1 = 1 end
if rpm > (rz*p3) then mRPMLedTable.RPM2 = 1 end
- if rpm > (rz*p4) then mRPMLedTable.RPM3 = 1 end
+ if rpm > (rz*p4) then mRPMLedTable.RPM3 = 1 end
- if rpm > (rz*p5) then mRPMLedTable.RPM4 = 1 end
- if rpm > (rz*p6) then mRPMLedTable.RPM5 = 1 end
+ if rpm > (rz*p5) then mRPMLedTable.RPM4 = 1 end
+ if rpm > (rz*p6) then mRPMLedTable.RPM5 = 1 end
if rpm > (rz*p7) then mRPMLedTable.RPM6 = 1 end
- if rpm > (rz*p8) then mRPMLedTable.RPM7 = 1 end
+ if rpm > (rz*p8) then mRPMLedTable.RPM7 = 1 end
if rpm > (rz*p9) then mRPMLedTable.RPM8 = 1 end
- if rpm > (rz*p10) then mRPMLedTable.RPM9 = 1 end
+ if rpm > (rz*p10) then mRPMLedTable.RPM9 = 1 end
if rpm > (rz*p11) then mRPMLedTable.RPM10 = 1 end
if rpm > (rz*p12) then mRPMLedTable.RPM11 = 1 end
if rpm > (rz*p13) then mRPMLedTable.RPM12 = 1 end
@@ -62,23 +62,23 @@ function AlternateSLI(rpm, redzone, step1, step2, step3)
local rz = redzone / 13
if rpm > (rz*step1) then
- mRPMLedTable.RPM0 = 1 -- G
- mRPMLedTable.RPM1 = 1 -- G
- mRPMLedTable.RPM2 = 1 -- G
- mRPMLedTable.RPM3 = 1 -- G
+ mRPMLedTable.RPM0 = 1 -- G
+ mRPMLedTable.RPM1 = 1 -- G
+ mRPMLedTable.RPM2 = 1 -- G
+ mRPMLedTable.RPM3 = 1 -- G
end
if rpm > (rz*step2) then
- mRPMLedTable.RPM4 = 1 -- R
- mRPMLedTable.RPM5 = 1 -- R
- mRPMLedTable.RPM6 = 1 -- R
- mRPMLedTable.RPM7 = 1 -- R
- mRPMLedTable.RPM8 = 1 -- R
+ mRPMLedTable.RPM4 = 1 -- R
+ mRPMLedTable.RPM5 = 1 -- R
+ mRPMLedTable.RPM6 = 1 -- R
+ mRPMLedTable.RPM7 = 1 -- R
+ mRPMLedTable.RPM8 = 1 -- R
end
if rpm > (rz*step3) then
- mRPMLedTable.RPM9 = 1 -- B
- mRPMLedTable.RPM10 = 1 -- B
- mRPMLedTable.RPM11 = 1 -- B
- mRPMLedTable.RPM12 = 1 -- B
+ mRPMLedTable.RPM9 = 1 -- B
+ mRPMLedTable.RPM10 = 1 -- B
+ mRPMLedTable.RPM11 = 1 -- B
+ mRPMLedTable.RPM12 = 1 -- B
end
end
@@ -119,18 +119,18 @@ end
-- progressive method but with rpm value for eah led
function ProgressiveFixedSLI(rpm, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13)
-- progressive method with thresholds as parameters
- if rpm > p1 then mRPMLedTable.RPM0 = 1 end
- if rpm > p2 then mRPMLedTable.RPM1 = 1 end
- if rpm > p3 then mRPMLedTable.RPM2 = 1 end
- if rpm > p4 then mRPMLedTable.RPM3 = 1 end
-
- if rpm > p5 then mRPMLedTable.RPM4 = 1 end
- if rpm > p6 then mRPMLedTable.RPM5 = 1 end
- if rpm > p7 then mRPMLedTable.RPM6 = 1 end
- if rpm > p8 then mRPMLedTable.RPM7 = 1 end
- if rpm > p9 then mRPMLedTable.RPM8 = 1 end
-
- if rpm > p10 then mRPMLedTable.RPM9 = 1 end
+ if rpm > p1 then mRPMLedTable.RPM0 = 1 end
+ if rpm > p2 then mRPMLedTable.RPM1 = 1 end
+ if rpm > p3 then mRPMLedTable.RPM2 = 1 end
+ if rpm > p4 then mRPMLedTable.RPM3 = 1 end
+
+ if rpm > p5 then mRPMLedTable.RPM4 = 1 end
+ if rpm > p6 then mRPMLedTable.RPM5 = 1 end
+ if rpm > p7 then mRPMLedTable.RPM6 = 1 end
+ if rpm > p8 then mRPMLedTable.RPM7 = 1 end
+ if rpm > p9 then mRPMLedTable.RPM8 = 1 end
+
+ if rpm > p10 then mRPMLedTable.RPM9 = 1 end
if rpm > p11 then mRPMLedTable.RPM10 = 1 end
if rpm > p12 then mRPMLedTable.RPM11 = 1 end
if rpm > p13 then mRPMLedTable.RPM12 = 1 end
@@ -227,15 +227,15 @@ end
-- progressive method for Fanatec
function ProgressiveFanatec(rpm, redzone, p1, p2, p3, p4, p5, p6, p7, p8, p9)
local rz = redzone / 9.0
- if rpm > (rz*p1) then mRPMLedTable.RPM0 = 1 end
- if rpm > (rz*p2) then mRPMLedTable.RPM1 = 1 end
+ if rpm > (rz*p1) then mRPMLedTable.RPM0 = 1 end
+ if rpm > (rz*p2) then mRPMLedTable.RPM1 = 1 end
if rpm > (rz*p3) then mRPMLedTable.RPM2 = 1 end
- if rpm > (rz*p4) then mRPMLedTable.RPM3 = 1 end
+ if rpm > (rz*p4) then mRPMLedTable.RPM3 = 1 end
- if rpm > (rz*p5) then mRPMLedTable.RPM4 = 1 end
- if rpm > (rz*p6) then mRPMLedTable.RPM5 = 1 end
+ if rpm > (rz*p5) then mRPMLedTable.RPM4 = 1 end
+ if rpm > (rz*p6) then mRPMLedTable.RPM5 = 1 end
if rpm > (rz*p7) then mRPMLedTable.RPM6 = 1 end
- if rpm > (rz*p8) then mRPMLedTable.RPM7 = 1 end
+ if rpm > (rz*p8) then mRPMLedTable.RPM7 = 1 end
if rpm > (rz*p9) then mRPMLedTable.RPM8 = 1 end
end
@@ -255,16 +255,16 @@ end
-- fixed rpm method for Fanatec (NOT RECOMMENDED)
function RpmFanatec(rpm, p1, p2, p3, p4, p5, p6, p7, p8, p9 )
- if rpm > p1 then mRPMLedTable.RPM0 = 1 end
- if rpm > p2 then mRPMLedTable.RPM1 = 1 end
- if rpm > p3 then mRPMLedTable.RPM2 = 1 end
- if rpm > p4 then mRPMLedTable.RPM3 = 1 end
-
- if rpm > p5 then mRPMLedTable.RPM4 = 1 end
- if rpm > p6 then mRPMLedTable.RPM5 = 1 end
- if rpm > p7 then mRPMLedTable.RPM6 = 1 end
- if rpm > p8 then mRPMLedTable.RPM7 = 1 end
- if rpm > p9 then mRPMLedTable.RPM8 = 1 end
+ if rpm > p1 then mRPMLedTable.RPM0 = 1 end
+ if rpm > p2 then mRPMLedTable.RPM1 = 1 end
+ if rpm > p3 then mRPMLedTable.RPM2 = 1 end
+ if rpm > p4 then mRPMLedTable.RPM3 = 1 end
+
+ if rpm > p5 then mRPMLedTable.RPM4 = 1 end
+ if rpm > p6 then mRPMLedTable.RPM5 = 1 end
+ if rpm > p7 then mRPMLedTable.RPM6 = 1 end
+ if rpm > p8 then mRPMLedTable.RPM7 = 1 end
+ if rpm > p9 then mRPMLedTable.RPM8 = 1 end
end
-- alternate yellow, red and blue method
@@ -272,19 +272,19 @@ function AlternateFanatec(rpm, redzone, step1, step2, step3)
local rz = redzone / 9.0
if rpm > (rz*step1) then
- mRPMLedTable.RPM0 = 1 -- y
- mRPMLedTable.RPM1 = 1 -- y
- mRPMLedTable.RPM2 = 1 -- y
+ mRPMLedTable.RPM0 = 1 -- y
+ mRPMLedTable.RPM1 = 1 -- y
+ mRPMLedTable.RPM2 = 1 -- y
end
if rpm > (rz*step2) then
- mRPMLedTable.RPM3 = 1 -- r
- mRPMLedTable.RPM4 = 1 -- r
- mRPMLedTable.RPM5 = 1 -- r
+ mRPMLedTable.RPM3 = 1 -- r
+ mRPMLedTable.RPM4 = 1 -- r
+ mRPMLedTable.RPM5 = 1 -- r
end
if rpm > (rz*step3) then
- mRPMLedTable.RPM6 = 1 -- b
- mRPMLedTable.RPM7 = 1 -- b
- mRPMLedTable.RPM8 = 1 -- b
+ mRPMLedTable.RPM6 = 1 -- b
+ mRPMLedTable.RPM7 = 1 -- b
+ mRPMLedTable.RPM8 = 1 -- b
end
end
@@ -316,14 +316,14 @@ end
-- progressive method for SIM RACE Deluxe
function ProgressiveSRDlx(rpm, redzone, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10)
local rz = redzone / 10.0
- if rpm > (rz*p1) then mRPMLedTable.RPM0 = 1 end
- if rpm > (rz*p2) then mRPMLedTable.RPM1 = 1 end
+ if rpm > (rz*p1) then mRPMLedTable.RPM0 = 1 end
+ if rpm > (rz*p2) then mRPMLedTable.RPM1 = 1 end
if rpm > (rz*p3) then mRPMLedTable.RPM2 = 1 end
- if rpm > (rz*p4) then mRPMLedTable.RPM3 = 1 end
- if rpm > (rz*p5) then mRPMLedTable.RPM4 = 1 end
- if rpm > (rz*p6) then mRPMLedTable.RPM5 = 1 end
+ if rpm > (rz*p4) then mRPMLedTable.RPM3 = 1 end
+ if rpm > (rz*p5) then mRPMLedTable.RPM4 = 1 end
+ if rpm > (rz*p6) then mRPMLedTable.RPM5 = 1 end
if rpm > (rz*p7) then mRPMLedTable.RPM6 = 1 end
- if rpm > (rz*p8) then mRPMLedTable.RPM7 = 1 end
+ if rpm > (rz*p8) then mRPMLedTable.RPM7 = 1 end
if rpm > (rz*p9) then mRPMLedTable.RPM8 = 1 end
if rpm > (rz*p9) then mRPMLedTable.RPM9 = 1 end
end
@@ -345,17 +345,17 @@ end
-- fixed rpm method for SIM RACE Deluxe (NOT RECOMMENDED)
function RpmSRDlx(rpm, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10 )
- if rpm > p1 then mRPMLedTable.RPM0 = 1 end
- if rpm > p2 then mRPMLedTable.RPM1 = 1 end
- if rpm > p3 then mRPMLedTable.RPM2 = 1 end
+ if rpm > p1 then mRPMLedTable.RPM0 = 1 end
+ if rpm > p2 then mRPMLedTable.RPM1 = 1 end
+ if rpm > p3 then mRPMLedTable.RPM2 = 1 end
- if rpm > p4 then mRPMLedTable.RPM3 = 1 end
- if rpm > p5 then mRPMLedTable.RPM4 = 1 end
- if rpm > p6 then mRPMLedTable.RPM5 = 1 end
- if rpm > p7 then mRPMLedTable.RPM6 = 1 end
+ if rpm > p4 then mRPMLedTable.RPM3 = 1 end
+ if rpm > p5 then mRPMLedTable.RPM4 = 1 end
+ if rpm > p6 then mRPMLedTable.RPM5 = 1 end
+ if rpm > p7 then mRPMLedTable.RPM6 = 1 end
- if rpm > p8 then mRPMLedTable.RPM7 = 1 end
- if rpm > p9 then mRPMLedTable.RPM8 = 1 end
+ if rpm > p8 then mRPMLedTable.RPM7 = 1 end
+ if rpm > p9 then mRPMLedTable.RPM8 = 1 end
if rpm > p10 then mRPMLedTable.RPM9 = 1 end
end
@@ -365,20 +365,20 @@ function AlternateSRDlx(rpm, redzone, step1, step2, step3)
local rz = redzone / 10.0
if rpm > (rz*step1) then
- mRPMLedTable.RPM0 = 1 -- y
- mRPMLedTable.RPM1 = 1 -- y
- mRPMLedTable.RPM2 = 1 -- y
+ mRPMLedTable.RPM0 = 1 -- y
+ mRPMLedTable.RPM1 = 1 -- y
+ mRPMLedTable.RPM2 = 1 -- y
end
if rpm > (rz*step2) then
- mRPMLedTable.RPM3 = 1 -- r
- mRPMLedTable.RPM4 = 1 -- r
- mRPMLedTable.RPM5 = 1 -- r
- mRPMLedTable.RPM6 = 1 -- r
+ mRPMLedTable.RPM3 = 1 -- r
+ mRPMLedTable.RPM4 = 1 -- r
+ mRPMLedTable.RPM5 = 1 -- r
+ mRPMLedTable.RPM6 = 1 -- r
end
if rpm > (rz*step3) then
- mRPMLedTable.RPM7 = 1 -- b
- mRPMLedTable.RPM8 = 1 -- b
- mRPMLedTable.RPM9 = 1 -- b
+ mRPMLedTable.RPM7 = 1 -- b
+ mRPMLedTable.RPM8 = 1 -- b
+ mRPMLedTable.RPM9 = 1 -- b
end
end
@@ -444,17 +444,17 @@ end
function ProgressiveSRF1(rpm, redzone, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15 )
local rz = redzone / 15
-- print("progessive")
- if rpm > (rz*p1) then mRPMLedTable.RPM0 = 1 end
- if rpm > (rz*p2) then mRPMLedTable.RPM1 = 1 end
+ if rpm > (rz*p1) then mRPMLedTable.RPM0 = 1 end
+ if rpm > (rz*p2) then mRPMLedTable.RPM1 = 1 end
if rpm > (rz*p3) then mRPMLedTable.RPM2 = 1 end
- if rpm > (rz*p4) then mRPMLedTable.RPM3 = 1 end
- if rpm > (rz*p5) then mRPMLedTable.RPM4 = 1 end
+ if rpm > (rz*p4) then mRPMLedTable.RPM3 = 1 end
+ if rpm > (rz*p5) then mRPMLedTable.RPM4 = 1 end
- if rpm > (rz*p6) then mRPMLedTable.RPM5 = 1 end
+ if rpm > (rz*p6) then mRPMLedTable.RPM5 = 1 end
if rpm > (rz*p7) then mRPMLedTable.RPM6 = 1 end
- if rpm > (rz*p8) then mRPMLedTable.RPM7 = 1 end
+ if rpm > (rz*p8) then mRPMLedTable.RPM7 = 1 end
if rpm > (rz*p9) then mRPMLedTable.RPM8 = 1 end
- if rpm > (rz*p10) then mRPMLedTable.RPM9 = 1 end
+ if rpm > (rz*p10) then mRPMLedTable.RPM9 = 1 end
if rpm > (rz*p11) then mRPMLedTable.RPM10 = 1 end
if rpm > (rz*p12) then mRPMLedTable.RPM11 = 1 end
@@ -469,25 +469,25 @@ function AlternateSRF1(rpm, redzone, step1, step2, step3)
local rz = redzone / 15
if rpm > (rz*step1) then
- mRPMLedTable.RPM0 = 1 -- G
- mRPMLedTable.RPM1 = 1 -- G
- mRPMLedTable.RPM2 = 1 -- G
- mRPMLedTable.RPM3 = 1 -- G
- mRPMLedTable.RPM4 = 1 -- R
+ mRPMLedTable.RPM0 = 1 -- G
+ mRPMLedTable.RPM1 = 1 -- G
+ mRPMLedTable.RPM2 = 1 -- G
+ mRPMLedTable.RPM3 = 1 -- G
+ mRPMLedTable.RPM4 = 1 -- R
end
if rpm > (rz*step2) then
- mRPMLedTable.RPM5 = 1 -- R
- mRPMLedTable.RPM6 = 1 -- R
- mRPMLedTable.RPM7 = 1 -- R
- mRPMLedTable.RPM8 = 1 -- R
- mRPMLedTable.RPM9 = 1 -- B
+ mRPMLedTable.RPM5 = 1 -- R
+ mRPMLedTable.RPM6 = 1 -- R
+ mRPMLedTable.RPM7 = 1 -- R
+ mRPMLedTable.RPM8 = 1 -- R
+ mRPMLedTable.RPM9 = 1 -- B
end
if rpm > (rz*step3) then
- mRPMLedTable.RPM10 = 1 -- B
- mRPMLedTable.RPM11 = 1 -- B
- mRPMLedTable.RPM12 = 1 -- B
- mRPMLedTable.RPM13 = 1 -- B
- mRPMLedTable.RPM14 = 1 -- B
+ mRPMLedTable.RPM10 = 1 -- B
+ mRPMLedTable.RPM11 = 1 -- B
+ mRPMLedTable.RPM12 = 1 -- B
+ mRPMLedTable.RPM13 = 1 -- B
+ mRPMLedTable.RPM14 = 1 -- B
end
end
@@ -532,18 +532,18 @@ end
-- progressive method but with rpm value for eah led
function ProgressiveFixedSRF1(rpm, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15 )
-- progressive method with thresholds as parameters
- if rpm > p1 then mRPMLedTable.RPM0 = 1 end
- if rpm > p2 then mRPMLedTable.RPM1 = 1 end
- if rpm > p3 then mRPMLedTable.RPM2 = 1 end
- if rpm > p4 then mRPMLedTable.RPM3 = 1 end
-
- if rpm > p5 then mRPMLedTable.RPM4 = 1 end
- if rpm > p6 then mRPMLedTable.RPM5 = 1 end
- if rpm > p7 then mRPMLedTable.RPM6 = 1 end
- if rpm > p8 then mRPMLedTable.RPM7 = 1 end
- if rpm > p9 then mRPMLedTable.RPM8 = 1 end
-
- if rpm > p10 then mRPMLedTable.RPM9 = 1 end
+ if rpm > p1 then mRPMLedTable.RPM0 = 1 end
+ if rpm > p2 then mRPMLedTable.RPM1 = 1 end
+ if rpm > p3 then mRPMLedTable.RPM2 = 1 end
+ if rpm > p4 then mRPMLedTable.RPM3 = 1 end
+
+ if rpm > p5 then mRPMLedTable.RPM4 = 1 end
+ if rpm > p6 then mRPMLedTable.RPM5 = 1 end
+ if rpm > p7 then mRPMLedTable.RPM6 = 1 end
+ if rpm > p8 then mRPMLedTable.RPM7 = 1 end
+ if rpm > p9 then mRPMLedTable.RPM8 = 1 end
+
+ if rpm > p10 then mRPMLedTable.RPM9 = 1 end
if rpm > p11 then mRPMLedTable.RPM10 = 1 end
if rpm > p12 then mRPMLedTable.RPM11 = 1 end
if rpm > p13 then mRPMLedTable.RPM12 = 1 end
@@ -580,68 +580,73 @@ function shiftLightsMethodEvent(idx)
rpm = GetCarInfo("rpm")
if rpm == nil then rpm = 0 end
+ -- init leds (see global.lua)
initLedTable(mRPMLedTable, 0)
if GetContextInfo("lastgearnorpm") and GetCarInfo("gear") == 7 then
- -- no shiftlights on last gear
- local tName = "mRPMLedTable"
- SetRPMLed(tName)
- return 1
+ -- no shiftlights on last gear
+ local tName = "mRPMLedTable"
+ SetRPMLed(tName)
+ return 1
end
if mShiftlightsMethodIndex == 0 then
- -- progressive method 0
- ProgressiveSLI(rpm, gRedZone, 7.5, 8, 8.5, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.5, 12.8, 12.98 )
+ -- progressive method 0
+ ProgressiveSLI(rpm, gRedZone, 7.5, 8, 8.5, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.5, 12.8, 12.98 )
elseif mShiftlightsMethodIndex == 1 then
- -- alternate method 1
- AlternateSLI(rpm, gRedZone, 11.0, 12.0, 12.9)
+ -- alternate method 1
+ AlternateSLI(rpm, gRedZone, 11.0, 12.0, 12.9)
elseif mShiftlightsMethodIndex == 2 then
- -- percentage method 2
- PercentageSLI(rpm, gRedZone, RPM_PERCENT_VALUES[1], RPM_PERCENT_VALUES[2], RPM_PERCENT_VALUES[3], RPM_PERCENT_VALUES[4], RPM_PERCENT_VALUES[5], RPM_PERCENT_VALUES[6], RPM_PERCENT_VALUES[7], RPM_PERCENT_VALUES[8], RPM_PERCENT_VALUES[9], RPM_PERCENT_VALUES[10], RPM_PERCENT_VALUES[11], RPM_PERCENT_VALUES[12], RPM_PERCENT_VALUES[13] )
+ -- percentage method 2
+ PercentageSLI(rpm, gRedZone, RPM_PERCENT_VALUES[1], RPM_PERCENT_VALUES[2], RPM_PERCENT_VALUES[3], RPM_PERCENT_VALUES[4], RPM_PERCENT_VALUES[5], RPM_PERCENT_VALUES[6], RPM_PERCENT_VALUES[7], RPM_PERCENT_VALUES[8], RPM_PERCENT_VALUES[9], RPM_PERCENT_VALUES[10], RPM_PERCENT_VALUES[11], RPM_PERCENT_VALUES[12], RPM_PERCENT_VALUES[13] )
elseif mShiftlightsMethodIndex == 3 then
- -- abs rpm method 3 (not recommended)
- RpmSLI(rpm, RPM_ABSOLUTE_VALUES[1], RPM_ABSOLUTE_VALUES[2], RPM_ABSOLUTE_VALUES[3], RPM_ABSOLUTE_VALUES[4], RPM_ABSOLUTE_VALUES[5], RPM_ABSOLUTE_VALUES[6], RPM_ABSOLUTE_VALUES[7], RPM_ABSOLUTE_VALUES[8], RPM_ABSOLUTE_VALUES[9], RPM_ABSOLUTE_VALUES[10], RPM_ABSOLUTE_VALUES[11], RPM_ABSOLUTE_VALUES[12], RPM_ABSOLUTE_VALUES[13] )
+ -- abs rpm method 3 (not recommended)
+ RpmSLI(rpm, RPM_ABSOLUTE_VALUES[1], RPM_ABSOLUTE_VALUES[2], RPM_ABSOLUTE_VALUES[3], RPM_ABSOLUTE_VALUES[4], RPM_ABSOLUTE_VALUES[5], RPM_ABSOLUTE_VALUES[6], RPM_ABSOLUTE_VALUES[7], RPM_ABSOLUTE_VALUES[8], RPM_ABSOLUTE_VALUES[9], RPM_ABSOLUTE_VALUES[10], RPM_ABSOLUTE_VALUES[11], RPM_ABSOLUTE_VALUES[12], RPM_ABSOLUTE_VALUES[13] )
elseif mShiftlightsMethodIndex == 4 then
- -- side to center method 4
- SideToCenterSLI(rpm, gRedZone, 94.5, 95, 96, 97 ,98 ,99 ,99.5 )
+ -- side to center method 4
+ SideToCenterSLI(rpm, gRedZone, 94.5, 95, 96, 97 ,98 ,99 ,99.5 )
elseif mShiftlightsMethodIndex == 5 then
- -- KERS + RPM
+ -- KERS + RPM
- -- get kers value
- local k_percent = GetKersPercent()
+ -- get kers value
+ local k_percent = GetKersPercent()
- -- without first 4 green leds
- AlternateSLI(rpm, gRedZone, 100, 11.6, 12.9)
+ -- without first 4 green leds
+ AlternateSLI(rpm, gRedZone, 100, 11.6, 12.9)
- -- KERS feedback on green leds
- -- print("KERS: " .. kers_level .. " - " .. k_percent .. "\n")
+ -- KERS feedback on green leds
+ -- print("KERS: " .. kers_level .. " - " .. k_percent .. "\n")
- if k_percent > 0 then mRPMLedTable.RPM0 = 1 end
- if k_percent >= 25 then mRPMLedTable.RPM1 = 1 end
- if k_percent >= 50 then mRPMLedTable.RPM2 = 1 end
- if k_percent >= 75 then mRPMLedTable.RPM3 = 1 end
+ if k_percent > 0 then mRPMLedTable.RPM0 = 1 end
+ if k_percent >= 25 then mRPMLedTable.RPM1 = 1 end
+ if k_percent >= 50 then mRPMLedTable.RPM2 = 1 end
+ if k_percent >= 75 then mRPMLedTable.RPM3 = 1 end
elseif mShiftlightsMethodIndex == 6 then
- -- Revers KERS + RPM
+ -- Revers KERS + RPM
+
+ -- get kers value
+ local k_percent = GetKersPercent()
- -- get kers value
- local k_percent = GetKersPercent()
+ -- without first 4 green leds
+ AlternateSLI(rpm, gRedZone, 0, 11.6, 12.9)
- -- without first 4 green leds
- AlternateSLI(rpm, gRedZone, 0, 11.6, 12.9)
+ -- KERS feedback on green leds
+ -- print("KERS: " .. kers_level .. " - " .. k_percent .. "\n")
- -- KERS feedback on green leds
- -- print("KERS: " .. kers_level .. " - " .. k_percent .. "\n")
+ if k_percent > 0 then mRPMLedTable.RPM3 = 0 end
+ if k_percent >= 25 then mRPMLedTable.RPM2 = 0 end
+ if k_percent >= 50 then mRPMLedTable.RPM1 = 0 end
+ if k_percent >= 75 then mRPMLedTable.RPM0 = 0 end
- if k_percent > 0 then mRPMLedTable.RPM3 = 0 end
- if k_percent >= 25 then mRPMLedTable.RPM2 = 0 end
- if k_percent >= 50 then mRPMLedTable.RPM1 = 0 end
- if k_percent >= 75 then mRPMLedTable.RPM0 = 0 end
+ elseif mShiftlightsMethodIndex == 7 then
+ -- semi-progressive method 7
+ PercentageSLI(rpm, gRedZone, 89,91,92,93,94,95,96,97,98,99,99,99,99)
else
return 1
@@ -681,25 +686,25 @@ function shiftLightsBU0710Event(idx)
mBU0710Leds = 0
if GetContextInfo("lastgearnorpm") and GetCarInfo("gear") == 7 then
- -- no shiftlights on last gear
- SetBU0710Led(mBU0710Leds)
- return 1
+ -- no shiftlights on last gear
+ SetBU0710Led(mBU0710Leds)
+ return 1
end
if (mShiftlightsBU0710MethodIndex <= 1) or (mShiftlightsBU0710MethodIndex >= 4) then
- -- progressive methods 1 or 4
- ProgressiveBU0710(rpm, gRedZone, 4.0, 6.0, 7.0, 7.5, 8.0, 8.5, 9.0, 9.3, 9.5, 9.7, 9.9 )
+ -- progressive methods 1 or 4
+ ProgressiveBU0710(rpm, gRedZone, 4.0, 6.0, 7.0, 7.5, 8.0, 8.5, 9.0, 9.3, 9.5, 9.7, 9.9 )
elseif (mShiftlightsBU0710MethodIndex == 2) then
- -- percentage method 2
- PercentageBU0710(rpm, gRedZone, 84, 88, 90, 92, 93, 94, 95, 96, 97, 98, 99 )
+ -- percentage method 2
+ PercentageBU0710(rpm, gRedZone, 84, 88, 90, 92, 93, 94, 95, 96, 97, 98, 99 )
elseif (mShiftlightsBU0710MethodIndex == 3) then
- -- abs method 3 (not recommended)
- RpmBU0710(rpm, 15823, 16354, 16410, 16675, 17252, 17545, 17823, 18354, 18510, 18655, 18675 )
+ -- abs method 3 (not recommended)
+ RpmBU0710(rpm, 15823, 16354, 16410, 16675, 17252, 17545, 17823, 18354, 18510, 18655, 18675 )
else
- return 1
+ return 1
end
SetBU0710Led(mBU0710Leds)
@@ -735,26 +740,26 @@ function shiftLightsG27LedsMethodEvent(idx)
mG27Leds = 0
if GetContextInfo("lastgearnorpm") and GetCarInfo("gear") == 7 then
- -- no shiftlights on last gear
- SetG27Led(mG27Leds)
- return 1
+ -- no shiftlights on last gear
+ SetG27Led(mG27Leds)
+ return 1
end
if mShiftlightsG27MethodIndex <= 0 or mShiftlightsG27MethodIndex >= 3 then
- -- progressive methods 1
- ProgressiveG27(rpm, gRedZone, 2.0, 2.5, 3.5, 4.5, 4.9 )
+ -- progressive methods 1
+ ProgressiveG27(rpm, gRedZone, 2.0, 2.5, 3.5, 4.5, 4.9 )
elseif mShiftlightsG27MethodIndex == 1 then
- -- percentage method 2
- --PercentageG27(rpm, gRedZone, 88, 92, 95, 97, 99 )
- PercentageG27(rpm, gRedZone, RPM_PERCENT_VALUES[1], RPM_PERCENT_VALUES[2], RPM_PERCENT_VALUES[3], RPM_PERCENT_VALUES[4], RPM_PERCENT_VALUES[5] )
+ -- percentage method 2
+ --PercentageG27(rpm, gRedZone, 88, 92, 95, 97, 99 )
+ PercentageG27(rpm, gRedZone, RPM_PERCENT_VALUES[1], RPM_PERCENT_VALUES[2], RPM_PERCENT_VALUES[3], RPM_PERCENT_VALUES[4], RPM_PERCENT_VALUES[5] )
elseif mShiftlightsG27MethodIndex == 2 then
- -- abs method 3 (not recommended)
- RpmG27(rpm, RPM_ABSOLUTE_VALUES[1], RPM_ABSOLUTE_VALUES[2], RPM_ABSOLUTE_VALUES[3], RPM_ABSOLUTE_VALUES[4], RPM_ABSOLUTE_VALUES[5] )
+ -- abs method 3 (not recommended)
+ RpmG27(rpm, RPM_ABSOLUTE_VALUES[1], RPM_ABSOLUTE_VALUES[2], RPM_ABSOLUTE_VALUES[3], RPM_ABSOLUTE_VALUES[4], RPM_ABSOLUTE_VALUES[5] )
else
- return 1
+ return 1
end
SetG27Led(mG27Leds)
@@ -790,68 +795,72 @@ function shiftLightsFanatecMethodEvent(idx)
initLedTable(mRPMLedTable, 0)
if GetContextInfo("lastgearnorpm") and GetCarInfo("gear") == 7 then
- -- no shiftlights on last gear
- local tName = "mRPMLedTable"
- SetRPMLed(tName)
- return 1
+ -- no shiftlights on last gear
+ local tName = "mRPMLedTable"
+ SetRPMLed(tName)
+ return 1
end
if (mShiftlightsFanatecMethodIndex < 1) or (mShiftlightsFanatecMethodIndex > 6) then
- -- progressive methods 0
- ProgressiveFanatec(rpm, gRedZone, 6.0, 6.5, 7.0, 7.5, 8.0, 8.3, 8.5, 8.7, 8.9 )
+ -- progressive methods 0
+ ProgressiveFanatec(rpm, gRedZone, 6.0, 6.5, 7.0, 7.5, 8.0, 8.3, 8.5, 8.7, 8.9 )
elseif mShiftlightsFanatecMethodIndex == 1 then
- -- alternate method 1
- AlternateFanatec(rpm, gRedZone, 7.0, 8.0, 8.9)
+ -- alternate method 1
+ AlternateFanatec(rpm, gRedZone, 7.0, 8.0, 8.9)
elseif (mShiftlightsFanatecMethodIndex == 2) then
- -- percentage method 2
- PercentageFanatec(rpm, gRedZone, RPM_PERCENT_VALUES[1], RPM_PERCENT_VALUES[2], RPM_PERCENT_VALUES[3], RPM_PERCENT_VALUES[4], RPM_PERCENT_VALUES[5], RPM_PERCENT_VALUES[6], RPM_PERCENT_VALUES[7], RPM_PERCENT_VALUES[8], RPM_PERCENT_VALUES[9] )
+ -- percentage method 2
+ PercentageFanatec(rpm, gRedZone, RPM_PERCENT_VALUES[1], RPM_PERCENT_VALUES[2], RPM_PERCENT_VALUES[3], RPM_PERCENT_VALUES[4], RPM_PERCENT_VALUES[5], RPM_PERCENT_VALUES[6], RPM_PERCENT_VALUES[7], RPM_PERCENT_VALUES[8], RPM_PERCENT_VALUES[9] )
elseif (mShiftlightsFanatecMethodIndex == 3) then
- -- abs method 3 (not recommended)
- RpmFanatec(rpm, RPM_ABSOLUTE_VALUES[1], RPM_ABSOLUTE_VALUES[2], RPM_ABSOLUTE_VALUES[3], RPM_ABSOLUTE_VALUES[4], RPM_ABSOLUTE_VALUES[5], RPM_ABSOLUTE_VALUES[6], RPM_ABSOLUTE_VALUES[7], RPM_ABSOLUTE_VALUES[8], RPM_ABSOLUTE_VALUES[9] )
+ -- abs method 3 (not recommended)
+ RpmFanatec(rpm, RPM_ABSOLUTE_VALUES[1], RPM_ABSOLUTE_VALUES[2], RPM_ABSOLUTE_VALUES[3], RPM_ABSOLUTE_VALUES[4], RPM_ABSOLUTE_VALUES[5], RPM_ABSOLUTE_VALUES[6], RPM_ABSOLUTE_VALUES[7], RPM_ABSOLUTE_VALUES[8], RPM_ABSOLUTE_VALUES[9] )
elseif mShiftlightsFanatecMethodIndex == 4 then
- -- side to center method 4
- SideToCenterFanatec(rpm, gRedZone, 96, 97 ,98 ,99 ,99.5 )
+ -- side to center method 4
+ SideToCenterFanatec(rpm, gRedZone, 96, 97 ,98 ,99 ,99.5 )
elseif mShiftlightsFanatecMethodIndex == 5 then
- -- KERS + RPM
+ -- KERS + RPM
- -- get kers value, see function in global.lua
- local k_percent = GetKersPercent()
+ -- get kers value, see function in global.lua
+ local k_percent = GetKersPercent()
- -- without first 4 green leds
- local kers_level = GetCarInfo("kers")
- AlternateFanatec(rpm, gRedZone, 100, 7.6, 8.9)
+ -- without first 4 green leds
+ local kers_level = GetCarInfo("kers")
+ AlternateFanatec(rpm, gRedZone, 100, 7.6, 8.9)
- -- KERS feedback on yellow leds
- -- print("IDX: ".. idx.." KERS: " .. kers_level .. " - " .. k_percent .. "\n")
+ -- KERS feedback on yellow leds
+ -- print("IDX: ".. idx.." KERS: " .. kers_level .. " - " .. k_percent .. "\n")
- if k_percent > 0 then mRPMLedTable.RPM0 = 1 end
- if k_percent >= 33 then mRPMLedTable.RPM1 = 1 end
- if k_percent >= 66 then mRPMLedTable.RPM2 = 1 end
+ if k_percent > 0 then mRPMLedTable.RPM0 = 1 end
+ if k_percent >= 33 then mRPMLedTable.RPM1 = 1 end
+ if k_percent >= 66 then mRPMLedTable.RPM2 = 1 end
elseif mShiftlightsFanatecMethodIndex == 6 then
- -- Revers KERS + RPM
+ -- Revers KERS + RPM
- -- get kers value, see function in global.lua
- local k_percent = GetKersPercent()
+ -- get kers value, see function in global.lua
+ local k_percent = GetKersPercent()
- -- without first 4 green leds
- AlternateFanatec(rpm, gRedZone, 0, 7.6, 8.9)
+ -- without first 4 green leds
+ AlternateFanatec(rpm, gRedZone, 0, 7.6, 8.9)
- -- KERS feedback on yellow leds
- --local kers_level = GetCarInfo("kers")
- --print("IDX: ".. idx.." KERS: " .. kers_level .. " - " .. k_percent .. "\n")
+ -- KERS feedback on yellow leds
+ --local kers_level = GetCarInfo("kers")
+ --print("IDX: ".. idx.." KERS: " .. kers_level .. " - " .. k_percent .. "\n")
if k_percent > 0 then mRPMLedTable.RPM2 = 0 end
if k_percent >= 33 then mRPMLedTable.RPM1 = 0 end
if k_percent >= 66 then mRPMLedTable.RPM0 = 0 end
+ elseif mShiftlightsFanatecMethodIndex == 7 then
+ -- semi-progressive method 7
+ PercentageFanatec(rpm, gRedZone, 89,91,93,94,95,98,99,99,99)
+
else
- return 1
+ return 1
end
local tName = "mRPMLedTable"
@@ -890,63 +899,67 @@ function shiftLightsSRDlxMethodEvent(idx)
initLedTable(mRPMLedTable, 0)
if GetContextInfo("lastgearnorpm") and GetCarInfo("gear") == 7 then
- -- no shiftlights on last gear
- local tName = "mRPMLedTable"
- SetRPMLed(tName)
- return 1
+ -- no shiftlights on last gear
+ local tName = "mRPMLedTable"
+ SetRPMLed(tName)
+ return 1
end
if mShiftlightsSRDlxMethodIndex == 0 then
- -- progressive method 0
- ProgressiveSRDlx(rpm, gRedZone, 5, 6.5, 7, 7.5, 8, 8.5, 9, 9.5, 9.8, 9.98 )
+ -- progressive method 0
+ ProgressiveSRDlx(rpm, gRedZone, 5, 6.5, 7, 7.5, 8, 8.5, 9, 9.5, 9.8, 9.98 )
elseif mShiftlightsSRDlxMethodIndex == 1 then
- -- alternate method 1
- AlternateSRDlx(rpm, gRedZone, 7.0, 8.0, 9.9)
+ -- alternate method 1
+ AlternateSRDlx(rpm, gRedZone, 7.0, 8.0, 9.9)
elseif mShiftlightsSRDlxMethodIndex == 2 then
- -- percentage method 2
- PercentageSRDlx(rpm, gRedZone, RPM_PERCENT_VALUES[1], RPM_PERCENT_VALUES[2], RPM_PERCENT_VALUES[3], RPM_PERCENT_VALUES[4], RPM_PERCENT_VALUES[5], RPM_PERCENT_VALUES[6], RPM_PERCENT_VALUES[7], RPM_PERCENT_VALUES[8], RPM_PERCENT_VALUES[9], RPM_PERCENT_VALUES[10] )
+ -- percentage method 2
+ PercentageSRDlx(rpm, gRedZone, RPM_PERCENT_VALUES[1], RPM_PERCENT_VALUES[2], RPM_PERCENT_VALUES[3], RPM_PERCENT_VALUES[4], RPM_PERCENT_VALUES[5], RPM_PERCENT_VALUES[6], RPM_PERCENT_VALUES[7], RPM_PERCENT_VALUES[8], RPM_PERCENT_VALUES[9], RPM_PERCENT_VALUES[10] )
elseif mShiftlightsSRDlxMethodIndex == 3 then
- -- abs rpm method 3 (not recommended)
- RpmSRDlx(rpm, RPM_ABSOLUTE_VALUES[1], RPM_ABSOLUTE_VALUES[2], RPM_ABSOLUTE_VALUES[3], RPM_ABSOLUTE_VALUES[4], RPM_ABSOLUTE_VALUES[5], RPM_ABSOLUTE_VALUES[6], RPM_ABSOLUTE_VALUES[7], RPM_ABSOLUTE_VALUES[8], RPM_ABSOLUTE_VALUES[9], RPM_ABSOLUTE_VALUES[10] )
+ -- abs rpm method 3 (not recommended)
+ RpmSRDlx(rpm, RPM_ABSOLUTE_VALUES[1], RPM_ABSOLUTE_VALUES[2], RPM_ABSOLUTE_VALUES[3], RPM_ABSOLUTE_VALUES[4], RPM_ABSOLUTE_VALUES[5], RPM_ABSOLUTE_VALUES[6], RPM_ABSOLUTE_VALUES[7], RPM_ABSOLUTE_VALUES[8], RPM_ABSOLUTE_VALUES[9], RPM_ABSOLUTE_VALUES[10] )
elseif mShiftlightsSRDlxMethodIndex == 4 then
- -- side to center method 4
- SideToCenterSRDlx(rpm, gRedZone, 96, 97 ,98 ,99 ,99.5 )
+ -- side to center method 4
+ SideToCenterSRDlx(rpm, gRedZone, 96, 97 ,98 ,99 ,99.5 )
elseif mShiftlightsSRDlxMethodIndex == 5 then
- -- KERS + RPM
+ -- KERS + RPM
- -- get kers value
- local k_percent = GetKersPercent()
+ -- get kers value
+ local k_percent = GetKersPercent()
- -- without first 4 green leds
- AlternateSRDlx(rpm, gRedZone, 100, 8.6, 9.9)
+ -- without first 4 green leds
+ AlternateSRDlx(rpm, gRedZone, 100, 8.6, 9.9)
- -- KERS feedback on green leds
- -- print("KERS: " .. kers_level .. " - " .. k_percent .. "\n")
+ -- KERS feedback on green leds
+ -- print("KERS: " .. kers_level .. " - " .. k_percent .. "\n")
- if k_percent > 0 then mRPMLedTable.RPM0 = 1 end
- if k_percent >= 33 then mRPMLedTable.RPM1 = 1 end
- if k_percent >= 66 then mRPMLedTable.RPM2 = 1 end
+ if k_percent > 0 then mRPMLedTable.RPM0 = 1 end
+ if k_percent >= 33 then mRPMLedTable.RPM1 = 1 end
+ if k_percent >= 66 then mRPMLedTable.RPM2 = 1 end
elseif mShiftlightsSRDlxMethodIndex == 6 then
- -- Revers KERS + RPM
+ -- Revers KERS + RPM
- -- get kers value
- local k_percent = GetKersPercent()
+ -- get kers value
+ local k_percent = GetKersPercent()
- -- without first 4 green leds
- AlternateSRDlx(rpm, gRedZone, 0, 8.6, 9.9)
+ -- without first 4 green leds
+ AlternateSRDlx(rpm, gRedZone, 0, 8.6, 9.9)
- -- KERS feedback on green leds
- -- print("KERS: " .. kers_level .. " - " .. k_percent .. "\n")
+ -- KERS feedback on green leds
+ -- print("KERS: " .. kers_level .. " - " .. k_percent .. "\n")
- if k_percent > 0 then mRPMLedTable.RPM2 = 0 end
- if k_percent >= 33 then mRPMLedTable.RPM1 = 0 end
- if k_percent >= 66 then mRPMLedTable.RPM0 = 0 end
+ if k_percent > 0 then mRPMLedTable.RPM2 = 0 end
+ if k_percent >= 33 then mRPMLedTable.RPM1 = 0 end
+ if k_percent >= 66 then mRPMLedTable.RPM0 = 0 end
+
+ elseif mShiftlightsSRDlxMethodIndex == 7 then
+ -- semi-progressive method 7
+ PercentageSRDlx(rpm, gRedZone, 89,91,93,94,95,97,98,99,99,99)
else
return 1
@@ -987,67 +1000,71 @@ function shiftLightsSRF1MethodEvent(idx)
initLedTable(mRPMLedTable, 0)
if GetContextInfo("lastgearnorpm") and GetCarInfo("gear") == 7 then
- -- no shiftlights on last gear
- local tName = "mRPMLedTable"
- SetRPMLed(tName)
- return 1
+ -- no shiftlights on last gear
+ local tName = "mRPMLedTable"
+ SetRPMLed(tName)
+ return 1
end
if mShiftlightsSRF1MethodIndex == 0 then
- -- progressive method 0
- ProgressiveSRF1(rpm, gRedZone, 7.5, 8, 8.5, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.5, 13, 13.5, 14.5, 14.99 )
+ -- progressive method 0
+ ProgressiveSRF1(rpm, gRedZone, 7.5, 8, 8.5, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.5, 13, 13.5, 14.5, 14.99 )
elseif mShiftlightsSRF1MethodIndex == 1 then
- -- alternate method 1
- AlternateSRF1(rpm, gRedZone, 12.0, 13.0, 14.9)
+ -- alternate method 1
+ AlternateSRF1(rpm, gRedZone, 12.0, 13.0, 14.9)
elseif mShiftlightsSRF1MethodIndex == 2 then
- -- percentage method 2
- PercentageSRF1(rpm, gRedZone, RPM_PERCENT_VALUES[1], RPM_PERCENT_VALUES[2], RPM_PERCENT_VALUES[3], RPM_PERCENT_VALUES[4], RPM_PERCENT_VALUES[5], RPM_PERCENT_VALUES[6], RPM_PERCENT_VALUES[7], RPM_PERCENT_VALUES[8], RPM_PERCENT_VALUES[9], RPM_PERCENT_VALUES[10], RPM_PERCENT_VALUES[11], RPM_PERCENT_VALUES[12], RPM_PERCENT_VALUES[13], RPM_PERCENT_VALUES[14], RPM_PERCENT_VALUES[15] )
+ -- percentage method 2
+ PercentageSRF1(rpm, gRedZone, RPM_PERCENT_VALUES[1], RPM_PERCENT_VALUES[2], RPM_PERCENT_VALUES[3], RPM_PERCENT_VALUES[4], RPM_PERCENT_VALUES[5], RPM_PERCENT_VALUES[6], RPM_PERCENT_VALUES[7], RPM_PERCENT_VALUES[8], RPM_PERCENT_VALUES[9], RPM_PERCENT_VALUES[10], RPM_PERCENT_VALUES[11], RPM_PERCENT_VALUES[12], RPM_PERCENT_VALUES[13], RPM_PERCENT_VALUES[14], RPM_PERCENT_VALUES[15] )
elseif mShiftlightsSRF1MethodIndex == 3 then
- -- abs rpm method 3 (not recommended)
- RpmSRF1(rpm, RPM_ABSOLUTE_VALUES[1], RPM_ABSOLUTE_VALUES[2], RPM_ABSOLUTE_VALUES[3], RPM_ABSOLUTE_VALUES[4], RPM_ABSOLUTE_VALUES[5], RPM_ABSOLUTE_VALUES[6], RPM_ABSOLUTE_VALUES[7], RPM_ABSOLUTE_VALUES[8], RPM_ABSOLUTE_VALUES[9], RPM_ABSOLUTE_VALUES[10], RPM_PERCENT_VALUES[11], RPM_PERCENT_VALUES[12], RPM_PERCENT_VALUES[13], RPM_PERCENT_VALUES[14], RPM_PERCENT_VALUES[15] )
+ -- abs rpm method 3 (not recommended)
+ RpmSRF1(rpm, RPM_ABSOLUTE_VALUES[1], RPM_ABSOLUTE_VALUES[2], RPM_ABSOLUTE_VALUES[3], RPM_ABSOLUTE_VALUES[4], RPM_ABSOLUTE_VALUES[5], RPM_ABSOLUTE_VALUES[6], RPM_ABSOLUTE_VALUES[7], RPM_ABSOLUTE_VALUES[8], RPM_ABSOLUTE_VALUES[9], RPM_ABSOLUTE_VALUES[10], RPM_PERCENT_VALUES[11], RPM_PERCENT_VALUES[12], RPM_PERCENT_VALUES[13], RPM_PERCENT_VALUES[14], RPM_PERCENT_VALUES[15] )
elseif mShiftlightsSRF1MethodIndex == 4 then
- -- side to center method 4
- SideToCenterSRF1(rpm, gRedZone, 94.5, 95, 96, 97 ,98 ,99 ,99.5 )
+ -- side to center method 4
+ SideToCenterSRF1(rpm, gRedZone, 94.5, 95, 96, 97 ,98 ,99 ,99.5 )
elseif mShiftlightsSRF1MethodIndex == 5 then
- -- KERS + RPM
+ -- KERS + RPM
- -- get kers value
- local k_percent = GetKersPercent()
+ -- get kers value
+ local k_percent = GetKersPercent()
- -- without first 4 green leds
- AlternateSRF1(rpm, gRedZone, 100, 13.6, 14.9)
+ -- without first 4 green leds
+ AlternateSRF1(rpm, gRedZone, 100, 13.6, 14.9)
- -- KERS feedback on green leds
- -- print("KERS: " .. kers_level .. " - " .. k_percent .. "\n")
+ -- KERS feedback on green leds
+ -- print("KERS: " .. kers_level .. " - " .. k_percent .. "\n")
- if k_percent > 0 then mRPMLedTable.RPM0 = 1 end
- if k_percent >= 20 then mRPMLedTable.RPM1 = 1 end
- if k_percent >= 40 then mRPMLedTable.RPM2 = 1 end
- if k_percent >= 60 then mRPMLedTable.RPM3 = 1 end
- if k_percent >= 80 then mRPMLedTable.RPM4 = 1 end
+ if k_percent > 0 then mRPMLedTable.RPM0 = 1 end
+ if k_percent >= 20 then mRPMLedTable.RPM1 = 1 end
+ if k_percent >= 40 then mRPMLedTable.RPM2 = 1 end
+ if k_percent >= 60 then mRPMLedTable.RPM3 = 1 end
+ if k_percent >= 80 then mRPMLedTable.RPM4 = 1 end
elseif mShiftlightsSRF1MethodIndex == 6 then
- -- Revers KERS + RPM
+ -- Revers KERS + RPM
- -- get kers value
- local k_percent = GetKersPercent()
+ -- get kers value
+ local k_percent = GetKersPercent()
- -- without first 4 green leds
- AlternateSRF1(rpm, gRedZone, 0, 13.6, 14.9)
+ -- without first 4 green leds
+ AlternateSRF1(rpm, gRedZone, 0, 13.6, 14.9)
- -- KERS feedback on green leds
- -- print("KERS: " .. kers_level .. " - " .. k_percent .. "\n")
+ -- KERS feedback on green leds
+ -- print("KERS: " .. kers_level .. " - " .. k_percent .. "\n")
- if k_percent > 0 then mRPMLedTable.RPM4 = 0 end
- if k_percent >= 20 then mRPMLedTable.RPM3 = 0 end
- if k_percent >= 40 then mRPMLedTable.RPM2 = 0 end
- if k_percent >= 60 then mRPMLedTable.RPM1 = 0 end
- if k_percent >= 80 then mRPMLedTable.RPM0 = 0 end
+ if k_percent > 0 then mRPMLedTable.RPM4 = 0 end
+ if k_percent >= 20 then mRPMLedTable.RPM3 = 0 end
+ if k_percent >= 40 then mRPMLedTable.RPM2 = 0 end
+ if k_percent >= 60 then mRPMLedTable.RPM1 = 0 end
+ if k_percent >= 80 then mRPMLedTable.RPM0 = 0 end
+
+ elseif mShiftlightsSRF1MethodIndex == 7 then
+ -- semi-progressive method 7
+ PercentageSRF1(rpm, gRedZone, 89,91,91,92,93,94,95,96,97,98,99,99,99,99,99)
else
return 1
@@ -1056,4 +1073,4 @@ function shiftLightsSRF1MethodEvent(idx)
local tName = "mRPMLedTable"
SetRPMLed(tName)
return 1
-end
+end \ No newline at end of file
diff --git a/scripts/simracedlx.lua b/scripts/simracedlx.lua
index 5f32cbe..e8305e8 100644
--- a/scripts/simracedlx.lua
+++ b/scripts/simracedlx.lua
@@ -1,8 +1,8 @@
--- SIMRACE DELUXE Lua Script v1.5
+-- SIMRACE DELUXE Lua Script v1.5.4
-- Copyright (c)2012-2013 by Zappadoc - All Rights Reserved.
-- this script builds all functions associated with
-- left and right panels of SIMRACE-DLX device
--- last change by Zappadoc - 2013-09
+-- last change by Zappadoc - 2013-11
-- ============================================================
-- Left and Right Panel functions
@@ -20,31 +20,31 @@ function srdlxDigitsEvent(swFunction, side)
-- call custom script
if side == 0 then
- local result = custom_srdlxLeftDigitsEvent(swValue)
- -- if result = 0 bypass the script below and return 0
- -- if result = 1 bypass the script below and return 1
- if result <= 1 then return result end
- -- if result >= 2 continue
-
- -- call global custom script
- result = global_custom_srdlxLeftDigitsEvent(swValue)
- -- if result = 0 bypass the script below and return 0
- -- if result = 1 bypass the script below and return 1
- if result <= 1 then return result end
- -- if result >= 2 continue
+ local result = custom_srdlxLeftDigitsEvent(swValue)
+ -- if result = 0 bypass the script below and return 0
+ -- if result = 1 bypass the script below and return 1
+ if result <= 1 then return result end
+ -- if result >= 2 continue
+
+ -- call global custom script
+ result = global_custom_srdlxLeftDigitsEvent(swValue)
+ -- if result = 0 bypass the script below and return 0
+ -- if result = 1 bypass the script below and return 1
+ if result <= 1 then return result end
+ -- if result >= 2 continue
else
- local result = custom_srdlxRightDigitsEvent(swValue)
- -- if result = 0 bypass the script below and return 0
- -- if result = 1 bypass the script below and return 1
- if result <= 1 then return result end
- -- if result >= 2 continue
-
- -- call global custom script
- result = global_custom_srdlxRightDigitsEvent(swValue)
- -- if result = 0 bypass the script below and return 0
- -- if result = 1 bypass the script below and return 1
- if result <= 1 then return result end
- -- if result >= 2 continue
+ local result = custom_srdlxRightDigitsEvent(swValue)
+ -- if result = 0 bypass the script below and return 0
+ -- if result = 1 bypass the script below and return 1
+ if result <= 1 then return result end
+ -- if result >= 2 continue
+
+ -- call global custom script
+ result = global_custom_srdlxRightDigitsEvent(swValue)
+ -- if result = 0 bypass the script below and return 0
+ -- if result = 1 bypass the script below and return 1
+ if result <= 1 then return result end
+ -- if result >= 2 continue
end
local hr = 0
@@ -55,7 +55,7 @@ function srdlxDigitsEvent(swFunction, side)
local lpt = 0.0
local diffTimeFlag = false
local timeFlag = false
- local systemflag = false
+ local systemFlag = false
local unit = false
local inf = ""
local spd = 0.0
@@ -71,8 +71,8 @@ function srdlxDigitsEvent(swFunction, side)
local dlt = false
dlt = GetContextInfo("displaylaptime")
if dlt == nil then dlt = false end
- if dlt and side == 1 then
- swValue = 11
+ if dlt and side == 1 and swValue ~= 47 and swValue ~= 48 then
+ swValue = 11
end
-- check if quick info button is down
@@ -80,16 +80,16 @@ function srdlxDigitsEvent(swFunction, side)
qi = GetContextInfo("quickinfobutton")
if qi == nil or qi == 0 then qi = false end
if qi then
- -- get index for left and right panel
- local qiInf = 1
- if side == 0 then
- qiInf = GetContextInfo("f1quickinfoleft")
- else
- qiInf = GetContextInfo("f1quickinforight")
- end
- if qiInf == nil then qiInf = 1 end
- -- force position to match QI preference
- swValue = qiInf
+ -- get index for left and right panel
+ local qiInf = 1
+ if side == 0 then
+ qiInf = GetContextInfo("f1quickinfoleft")
+ else
+ qiInf = GetContextInfo("f1quickinforight")
+ end
+ if qiInf == nil then qiInf = 1 end
+ -- force position to match QI preference
+ swValue = qiInf
end
-- check if PIT Feedback ON
@@ -97,15 +97,15 @@ function srdlxDigitsEvent(swFunction, side)
pf = GetContextInfo("pitfeedback")
if pf == nil or pf == 0 then pf = false end
if pf then
- -- force position to PIT/SPEED function if car pits
- local pit = GetCarInfo("inpits")
- if pit > 0 then
- if side == 0 then
- swValue = 45
- else
- swValue = 1
- end
- end
+ -- force position to PIT/SPEED function if car pits
+ local pit = GetCarInfo("inpits")
+ if pit > 0 then
+ if side == 0 then
+ swValue = 45
+ else
+ swValue = 1
+ end
+ end
end
-- get current simulation name
@@ -115,422 +115,523 @@ function srdlxDigitsEvent(swFunction, side)
-- check postion and compute left panel string
if swValue == 1 then
- -- speed only
- srdlxPanel = string.format("%3.0f ", spd )
+ -- speed only
+ srdlxPanel = string.format("%3.0f ", spd )
elseif swValue == 2 then
- -- fuel
- local fuel = GetCarInfo("fuel")
- if fuel ~= nil then
- fuel = GetFuel(fuel, unit)
- if fuel >= 100 then
- srdlxPanel = string.format("F%3d", round(fuel))
- elseif fuel >= 10 then
- srdlxPanel = string.format("F%02d ", round(fuel))
- else
- srdlxPanel = string.format("F%1.1f ", fuel)
- end
- end
+ -- fuel
+ local fuel = GetCarInfo("fuel")
+ if fuel ~= nil then
+ fuel = GetFuel(fuel, unit)
+ if fuel >= 100 then
+ srdlxPanel = string.format("F%3d", round(fuel))
+ elseif fuel >= 10 then
+ srdlxPanel = string.format("F%02d ", round(fuel))
+ else
+ srdlxPanel = string.format("F%1.1f ", fuel)
+ end
+ end
elseif swValue == 3 then
- -- position
- inf = GetContextInfo("position")
- if inf ~= nil then
- if inf >= 100 then
- srdlxPanel = string.format("P%3d", inf)
- else
- srdlxPanel = string.format("P%02d ", inf)
- end
- end
+ -- position
+ inf = GetContextInfo("position")
+ if inf ~= nil then
+ if inf >= 100 then
+ srdlxPanel = string.format("P%3d", inf)
+ else
+ srdlxPanel = string.format("P%02d ", inf)
+ end
+ end
elseif swValue == 4 then
- -- laps completed
- inf = GetContextInfo("laps")
- if inf ~= nil then
- -- if more then 99 laps
- if inf >= 100 then
- srdlxPanel = string.format("L%3d", inf)
- else
- srdlxPanel = string.format("L%02d ", inf)
- end
- end
+ -- laps completed
+ inf = GetContextInfo("laps")
+ if inf ~= nil then
+ -- if more then 99 laps
+ if inf >= 100 then
+ srdlxPanel = string.format("L%3d", inf)
+ else
+ srdlxPanel = string.format("L%02d ", inf)
+ end
+ end
elseif swValue == 5 then
- -- sector
- inf = GetCarInfo("sector")
- if inf ~= nil then
- -- check if sector > 9
- if inf >9 then
- srdlxPanel = string.format("S%02d ", inf)
- else
- srdlxPanel = string.format("S%01d ", inf)
- end
- end
+ -- sector
+ inf = GetCarInfo("sector")
+ if inf ~= nil then
+ -- check if sector > 9
+ if inf >9 then
+ srdlxPanel = string.format("S%02d ", inf)
+ else
+ srdlxPanel = string.format("S%01d ", inf)
+ end
+ end
elseif swValue == 6 then
- -- total laps if available
- local tl = GetContextInfo("lapscount")
- if tl < 1 then tl = 0 end
- -- if more then 99 laps
- if tl >= 100 or tl >= 100 then
- srdlxPanel = string.format("%03d ", tl)
- else
- srdlxPanel = string.format("t%02d ", tl)
- end
+ -- total laps if available
+ local tl = GetContextInfo("lapscount")
+ if tl < 1 then tl = 0 end
+ -- if more then 99 laps
+ if tl >= 100 or tl >= 100 then
+ srdlxPanel = string.format("%03d ", tl)
+ else
+ srdlxPanel = string.format("t%02d ", tl)
+ end
elseif swValue == 7 then
- -- water temp
- inf = GetCarInfo("watertemp")
- if inf ~= nil then
- inf = GetTemp(inf, unit)
- srdlxPanel = string.format("%2.1f ", inf)
- end
+ -- water temp
+ inf = GetCarInfo("watertemp")
+ if inf ~= nil then
+ inf = GetTemp(inf, unit)
+ srdlxPanel = string.format("%2.1f ", inf)
+ end
elseif swValue == 8 then
- -- oil temp
- inf = GetCarInfo("oiltemp")
- if inf ~= nil then
- inf = GetTemp(inf, unit)
- srdlxPanel = string.format("%2.1f ", inf)
- end
+ -- oil temp
+ inf = GetCarInfo("oiltemp")
+ if inf ~= nil then
+ inf = GetTemp(inf, unit)
+ srdlxPanel = string.format("%2.1f ", inf)
+ end
elseif swValue == 9 then
- -- best lap time
- timeFlag = true
- lpt = GetTimeInfo("laptime")
+ -- best lap time
+ timeFlag = true
+ lpt = GetTimeInfo("laptime")
elseif swValue == 10 then
- -- best lap time
- timeFlag = true
- lpt = GetTimeInfo("bestlaptime")
+ -- best lap time
+ timeFlag = true
+ lpt = GetTimeInfo("bestlaptime")
elseif swValue == 11 then
- -- last lap time
- timeFlag = true
- lpt = GetTimeInfo("lastlaptime")
+ -- last lap time
+ timeFlag = true
+ lpt = GetTimeInfo("lastlaptime")
elseif swValue >= 12 and swValue <= 18 and isAppIRacing(sim) then
- timeFlag = true
- diffTimeFlag = true
- -- iRacing partials
- local ts = GetContextInfo("partialcount")
- local sector = GetCarInfo("sector")
- if ts ~= nil and ts > 0 then
- if swValue == 12 then
- lpt = GetPartialTimeInfo("currentpartial", sector)
- elseif swValue == 13 then
- lpt = GetPartialTimeInfo("vsbestlap", sector)
- elseif swValue == 14 then
- lpt = GetPartialTimeInfo("vsoptimallap", sector)
- elseif swValue == 15 then
- lpt = GetPartialTimeInfo("vsoptimalsector", sector)
- elseif swValue == 16 then
- lpt = GetPartialTimeInfo("vssessionbestlap", sector)
- elseif swValue == 17 then
- lpt = GetPartialTimeInfo("vssessionoptimallap", sector)
- elseif swValue == 18 then
- lpt = GetPartialTimeInfo("vssessionoptimalsector", sector)
- end
- else
- lpt = 0.0
- end
+ timeFlag = true
+ diffTimeFlag = true
+ -- iRacing partials
+ local ts = GetContextInfo("partialcount")
+ local sector = GetCarInfo("sector")
+ if ts ~= nil and ts > 0 then
+ if swValue == 12 then
+ lpt = GetPartialTimeInfo("currentpartial", sector)
+ elseif swValue == 13 then
+ lpt = GetPartialTimeInfo("vsbestlap", sector)
+ elseif swValue == 14 then
+ lpt = GetPartialTimeInfo("vsoptimallap", sector)
+ elseif swValue == 15 then
+ lpt = GetPartialTimeInfo("vsoptimalsector", sector)
+ elseif swValue == 16 then
+ lpt = GetPartialTimeInfo("vssessionbestlap", sector)
+ elseif swValue == 17 then
+ lpt = GetPartialTimeInfo("vssessionoptimallap", sector)
+ elseif swValue == 18 then
+ lpt = GetPartialTimeInfo("vssessionoptimalsector", sector)
+ end
+ else
+ lpt = 0.0
+ end
elseif swValue == 19 then
- -- real time diff vs your best
- diffTimeFlag = true
- timeFlag = true
- lpt = GetTimeInfo("realdiffbest")
+ -- real time diff vs your best
+ diffTimeFlag = true
+ timeFlag = true
+ lpt = GetTimeInfo("realdiffbest")
elseif swValue == 20 then
- -- real time diff vs your last
- diffTimeFlag = true
- timeFlag = true
- lpt = GetTimeInfo("realdifflast")
+ -- real time diff vs your last
+ diffTimeFlag = true
+ timeFlag = true
+ lpt = GetTimeInfo("realdifflast")
elseif swValue == 21 then
- -- get an average consumption of fuel per lap and gives the remaining laps
- local remainintank = GetCarInfo("remainlapsintank")
- srdlxPanel = string.format("L%3.0f", math.floor(remainintank) )
+ -- get an average consumption of fuel per lap and gives the remaining laps
+ local remainintank = GetCarInfo("remainlapsintank")
+ srdlxPanel = string.format("L%3.0f", math.floor(remainintank) )
elseif swValue == 22 then
- -- rpm
- isSlowUpdate = true
- diffTimeFlag = true
- local rpm = GetCarInfo("rpm")
- local r = rpm / 10.0
- if r < 1000 then
- srdlxPanel = string.format("%3.1f", r)
- else
- srdlxPanel = string.format("%4d.", round(r))
- end
+ -- rpm
+ isSlowUpdate = true
+ --diffTimeFlag = true
+ local rpm = GetCarInfo("rpm")
+ local r = rpm / 10.0
+ if r < 1000 then
+ srdlxPanel = string.format("%3.1f", r)
+ else
+ srdlxPanel = string.format("%4d.", round(r))
+ end
elseif swValue == 23 then
- -- track size
- isSlowUpdate = true
- diffTimeFlag = true
- local trcksz = GetContextInfo("tracksize")
- local r = trcksz / 10
- if r < 1000 then
- srdlxPanel = string.format("%3.1f", r)
- else
- srdlxPanel = string.format("%4d.", round(r))
- end
+ -- track size
+ isSlowUpdate = true
+ --diffTimeFlag = true
+ local trcksz = GetContextInfo("tracksize")
+ local r = trcksz / 10
+ if r < 1000 then
+ srdlxPanel = string.format("%3.1f", r)
+ else
+ srdlxPanel = string.format("%4d.", round(r))
+ end
elseif swValue == 24 then
- -- distance percent
- local dist = GetContextInfo("lapdistance")
- -- track size
- local trcksz = GetContextInfo("tracksize")
- local p = round(dist / (trcksz / 100))
- srdlxPanel = string.format("%3d ", p )
+ -- distance percent
+ local dist = GetContextInfo("lapdistance")
+ -- track size
+ local trcksz = GetContextInfo("tracksize")
+ local p = round(dist / (trcksz / 100))
+ srdlxPanel = string.format("%3d ", p )
elseif swValue == 25 then
- -- kers
- local kers = GetCarInfo("kers")
- srdlxPanel = string.format("%3d ", round(kers/1000))
+ -- kers
+ local kers = GetCarInfo("kers")
+ srdlxPanel = string.format("%3d ", round(kers/1000))
elseif swValue == 26 then
- -- kers max
- local kmx = GetCarInfo("kersmax")
- srdlxPanel = string.format("%3d ", round(kmx/1000))
+ -- kers max
+ local kmx = GetCarInfo("kersmax")
+ srdlxPanel = string.format("%3d ", round(kmx/1000))
elseif swValue == 27 then
- -- drs
- local drs = GetCarInfo("drs")
- if drs == 1 then
- srdlxPanel = "ON "
- else
- srdlxPanel = "OFF"
- end
+ -- drs
+ local drs = GetCarInfo("drs")
+ if drs == 1 then
+ srdlxPanel = "ON "
+ else
+ srdlxPanel = "OFF"
+ end
elseif swValue == 28 then
- -- kers percent
- local kers = GetCarInfo("kers")
- srdlxPanel = string.format("%3d ", round((kers/1000)/4))
+ -- kers percent
+ local kers = GetCarInfo("kers")
+ srdlxPanel = string.format("%3d ", round((kers/1000)/4) )
elseif swValue == 29 then
- -- wheels temp if available
- inf = GetCarInfo("wheeltempfrontleft")
- if inf ~= nil then
- -- if rFactor convert Kelvin to Celsius (see global.lua)
- if isAppRFactor(sim) then inf = KtoC(inf) end
- srdlxPanel = string.format("%3.0f ", inf)
- end
+ -- wheels temp if available
+ inf = GetCarInfo("wheeltempfrontleft")
+ if inf ~= nil then
+ -- if rFactor convert Kelvin to Celsius (see global.lua)
+ if isAppRFactor(sim) then inf = KtoC(inf) end
+ srdlxPanel = string.format("%3.0f ", inf)
+ end
elseif swValue == 30 then
- inf = GetCarInfo("wheeltempfrontright")
- if inf ~= nil then
- if isAppRFactor(sim) then inf = KtoC(inf) end
- srdlxPanel = string.format("%3.0f ", inf)
- end
+ inf = GetCarInfo("wheeltempfrontright")
+ if inf ~= nil then
+ if isAppRFactor(sim) then inf = KtoC(inf) end
+ srdlxPanel = string.format("%3.0f ", inf)
+ end
elseif swValue == 31 then
- inf = GetCarInfo("wheeltemprearleft")
- if inf ~= nil then
- if isAppRFactor(sim) then inf = KtoC(inf) end
- srdlxPanel = string.format("%3.0f ", inf)
- end
+ inf = GetCarInfo("wheeltemprearleft")
+ if inf ~= nil then
+ if isAppRFactor(sim) then inf = KtoC(inf) end
+ srdlxPanel = string.format("%3.0f ", inf)
+ end
elseif swValue == 32 then
- inf = GetCarInfo("wheeltemprearright")
- if inf ~= nil then
- if isAppRFactor(sim) then inf = KtoC(inf) end
- srdlxPanel = string.format("%3.0f ", inf)
- end
+ inf = GetCarInfo("wheeltemprearright")
+ if inf ~= nil then
+ if isAppRFactor(sim) then inf = KtoC(inf) end
+ srdlxPanel = string.format("%3.0f ", inf)
+ end
elseif swValue == 33 then
- -- wheels pressure if available
- inf = GetCarInfo("wheelpressfrontleft")
- if inf ~= nil then
- -- convert to psi
- srdlxPanel = string.format("%2.1f ", inf / 6.88)
- end
+ -- wheels pressure if available
+ inf = GetCarInfo("wheelpressfrontleft")
+ if inf ~= nil then
+ -- convert to psi
+ srdlxPanel = string.format("%2.1f ", inf / 6.88)
+ end
elseif swValue == 34 then
- inf = GetCarInfo("wheelpressfrontright")
- if inf ~= nil then
- srdlxPanel = string.format("%2.1f ", inf / 6.88)
- end
+ inf = GetCarInfo("wheelpressfrontright")
+ if inf ~= nil then
+ srdlxPanel = string.format("%2.1f ", inf / 6.88)
+ end
elseif swValue == 35 then
- inf = GetCarInfo("wheelpressrearleft")
- if inf ~= nil then
- srdlxPanel = string.format("%2.1f ", inf / 6.88)
- end
+ inf = GetCarInfo("wheelpressrearleft")
+ if inf ~= nil then
+ srdlxPanel = string.format("%2.1f ", inf / 6.88)
+ end
elseif swValue == 36 then
- inf = GetCarInfo("wheelpressrearright")
- if inf ~= nil then
- srdlxPanel = string.format("%2.1f ", inf / 6.88)
- end
+ inf = GetCarInfo("wheelpressrearright")
+ if inf ~= nil then
+ srdlxPanel = string.format("%2.1f ", inf / 6.88)
+ end
elseif swValue == 37 then
- -- brakes temp if available
- inf = GetCarInfo("braketempfrontleft")
- if inf ~= nil then
- if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
- srdlxPanel = string.format("%3.0f ", inf)
- end
+ -- brakes temp if available
+ inf = GetCarInfo("braketempfrontleft")
+ if inf ~= nil then
+ if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
+ srdlxPanel = string.format("%3.0f ", inf)
+ end
elseif swValue == 38 then
- inf = GetCarInfo("braketempfrontright")
- if inf ~= nil then
- if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
- srdlxPanel = string.format("%3.0f ", inf)
- end
+ inf = GetCarInfo("braketempfrontright")
+ if inf ~= nil then
+ if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
+ srdlxPanel = string.format("%3.0f ", inf)
+ end
elseif swValue == 39 then
- inf = GetCarInfo("braketemprearleft")
- if inf ~= nil then
- if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
- srdlxPanel = string.format("%3.0f ", inf)
- end
+ inf = GetCarInfo("braketemprearleft")
+ if inf ~= nil then
+ if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
+ srdlxPanel = string.format("%3.0f ", inf)
+ end
elseif swValue == 40 then
- inf = GetCarInfo("braketemprearright")
- if inf ~= nil then
- if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
- srdlxPanel = string.format("%3.0f ", inf)
- end
+ inf = GetCarInfo("braketemprearright")
+ if inf ~= nil then
+ if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
+ srdlxPanel = string.format("%3.0f ", inf)
+ end
elseif swValue == 41 then
- -- time remaining if available
- lpt = GetTimeInfo("timeremaining")
- timeFlag = true
+ -- time remaining if available
+ lpt = GetTimeInfo("timeremaining")
+ timeFlag = true
elseif swValue == 42 then
- -- PC system time
- systemflag = true
- lpt = GetTimeInfo("systemtime")
- timeFlag = true
- diffTimeFlag = true
+ -- PC system time
+ systemFlag = true
+ lpt = GetTimeInfo("systemtime")
+ timeFlag = true
+ --diffTimeFlag = true
elseif swValue == 43 then
- -- time elapsed if available
- lpt = GetTimeInfo("timetotalelapsed")
- timeFlag = true
+ -- time elapsed if available
+ lpt = GetTimeInfo("timetotalelapsed")
+ timeFlag = true
elseif swValue == 44 then
- -- last sector 1, 2 and 3
- local sector = GetCarInfo("sector")
- timeFlag = true
- diffTimeFlag = true
- if sector == 1 then
- -- sector 3
- local ls1 = GetTimeInfo("lastsector1")
- local ls2 = GetTimeInfo("lastsector2")
- local lt = GetTimeInfo("lastlaptime")
- if ls1 > 0 and ls2 > 0 then
- lpt = lt - (ls1 + ls2)
- end
- elseif sector == 2 then
- local ls1 = GetTimeInfo("lastsector1")
- lpt = ls1
- else
- -- sector 3
- local ls2 = GetTimeInfo("lastsector2")
- lpt = ls2
- end
+ -- last sector 1, 2 and 3
+ local sector = GetCarInfo("sector")
+ timeFlag = true
+ --diffTimeFlag = true
+ if sector == 1 then
+ -- sector 3
+ local ls3 = GetTimeInfo("lastsector3")
+ lpt = ls3
+ elseif sector == 2 then
+ local ls1 = GetTimeInfo("lastsector1")
+ lpt = ls1
+ else
+ -- sector 3
+ local ls2 = GetTimeInfo("lastsector2")
+ lpt = ls2
+ end
elseif swValue == 45 then
- -- PIT
- srdlxPanel = "PIt "
+ -- PIT
+ srdlxPanel = "PIt "
elseif swValue == 46 then
- -- sc
- local sc = GetContextInfo("safetycare")
- if sc == 1 then
- srdlxPanel = "SCAR"
- else
- srdlxPanel = "OFF "
- end
+ -- sc
+ local sc = GetContextInfo("safetycare")
+ if sc == 1 then
+ srdlxPanel = "SCAR"
+ else
+ srdlxPanel = "OFF "
+ end
+
+ elseif swValue == 47 then
+ -- real time delta vs last + last sector diff 1, 2 and 3
+ timeFlag = true
+ diffTimeFlag = true
+
+ lpt = GetDeltaLastTime(false)
+
+ elseif swValue == 48 then
+ -- real time delta vs best + last sector diff 1, 2 and 3
+
+ timeFlag = true
+ diffTimeFlag = true
+ lpt = GetDeltaBestTime(false)
+
+ elseif swValue == 49 then
+ timeFlag = true
+ -- current sector
+ local sector = GetCarInfo("sector")
+ if sector == 1 then
+ lpt = GetTimeInfo("sector1")
+ elseif sector == 2 then
+ lpt = GetTimeInfo("sector2")
else
- srdlxPanel = " "
+ -- sector 3
+ lpt = GetTimeInfo("sector3")
end
+ elseif swValue == 50 then
+ timeFlag = true
+ -- best sector 1
+ lpt = GetTimeInfo("bestsector1")
+
+ elseif swValue == 51 then
+ timeFlag = true
+ -- best sector 2
+ lpt = GetTimeInfo("bestsector2")
+
+ elseif swValue == 52 then
+ timeFlag = true
+ -- last sector 1
+ lpt = GetTimeInfo("lastsector1")
+
+ elseif swValue == 53 then
+ timeFlag = true
+ -- last sector 2
+ lpt = GetTimeInfo("lastsector2")
+
+ elseif swValue == 54 then
+ timeFlag = true
+ -- last sector 3
+ lpt = GetTimeInfo("lastsector3")
+
+ elseif swValue == 55 then
+ timeFlag = true
+ -- last sector 3
+ lpt = GetTimeInfo("bestsector3")
+
+ elseif swValue == 56 then
+ timeFlag = true
+ -- current sector 1 (rFactor)
+ lpt = GetTimeInfo("sector1")
+
+ elseif swValue == 57 then
+ timeFlag = true
+ -- current sector 2 (rFactor)
+ lpt = GetTimeInfo("sector2")
+
+ elseif swValue == 58 then
+ timeFlag = true
+ -- current sector 3 (rFactor)
+ lpt = GetTimeInfo("sector3")
+
+ elseif swValue == 59 then
+ -- rFactor real time delta vs last + last sector diff 1, 2 and 3
+ timeFlag = true
+ diffTimeFlag = true
+
+ lpt = GetDeltaLastTime(true)
+
+ elseif swValue == 60 then
+ -- rFactor real time delta vs best + last sector diff 1, 2 and 3
+
+ -- set flags
+ timeFlag = true
+ diffTimeFlag = true
+
+ lpt = GetDeltaBestTime(true)
+
+ else
+ srdlxPanel = " "
+ end
+
+ -- check if diff time is ready
+ local diffOK = GetTimeInfo("realdifftimeready")
+ if diffTimeFlag and diffOK == false and dlt == false then
+ diffTimeFlag = false
+ timeFlag = false
+ srdlxPanel = "nrEF"
+ end
+
+ local c = ""
local refreshRate = mRefreshLapTimeRate
if diffTimeFlag then
- refreshRate = mDeltaTimeDelay
+ c = " "
+ refreshRate = mDeltaTimeDelay
end
if timeFlag and lpt ~= nil then
- -- set char of negative number
- local c = ""
- if lpt < 0 then c = "-" end
-
- -- explod time
- hr, mn, sc, hd, ms = timeDispatcher(lpt)
+ -- set char of negative number
+ if diffTimeFlag then
+ if lpt < 0 then c = "-" end
+ end
+ -- explod time
+ hr, mn, sc, hd, ms = timeDispatcher(lpt)
--print("lpt: " .. lpt .. " m: " .. mn .. " - s: " .. sc .. " - ms: " .. ms .."\n" )
- -- update display every mDeltaTimeDelay time
- if GetTicks() > (refreshRate + mDeltaTimeOldTicks ) then
- mDeltaTimeOldTicks = GetTicks()
-
- if lpt == -1 or (mn + sc + ms) == 0.0000 then
- mDeltaTimeBackup = "-.---"
-
- elseif systemflag then
- mDeltaTimeBackup = string.format( "%2d.%02d", mn, sc)
- -- > 9mn
- elseif mn > 9 then
- if c == "" then
- mDeltaTimeBackup = string.format( "%2d.%2d", mn, sc)
- else
- mDeltaTimeBackup = string.format( "%s%2d ", c, mn)
- end
-
- -- < 10mn
- elseif mn > 0 and mn < 10 then
- if c == "" then
- mDeltaTimeBackup = string.format( "%1d.%02d.%01d", mn, sc, hd)
- else
- mDeltaTimeBackup = string.format( "%s%1d.%02d", c, mn, sc)
- end
-
- else
- -- mn == 0 ; sc > 9
- if sc > 9 then
- if c == "" then
- mDeltaTimeBackup = string.format( "0.%2d.%1d", sc, hd)
- else
- mDeltaTimeBackup = string.format( "%s0.%2d.", c, sc)
- end
- else
- -- sc < 10
- if c == "" then
- mDeltaTimeBackup = string.format( "0.%01d.%02d", sc, hd)
- else
- mDeltaTimeBackup = string.format( "%s0.%01d.%01d", c, sc, hd)
- end
- end
- end
- end
-
- --print(srdlxPanel,mDeltaTimeBackup)
- srdlxPanel = mDeltaTimeBackup
- end
-
- if isSlowUpdate then
-
- if GetTicks() > ( refreshRate + mDeltaTimeOldTicks ) then
- mDeltaTimeOldTicks = GetTicks()
- if side == 0 then
- mSRDlxLeftText = srdlxPanel
- else
- mSRDlxRightText = srdlxPanel
- end
- -- print(GetTicks() .. mSRDlxRightText .."\n")
- end
+ -- update display every mDeltaTimeDelay time
+
+ --if GetTicks() > (refreshRate + mDeltaTimeOldTicks ) then
+ --mDeltaTimeOldTicks = GetTicks()
+
+ if lpt == -1 or (mn + sc + ms) == 0.0000 then
+ mDeltaTimeBackup = "-.---"
+
+ elseif systemFlag then
+ mDeltaTimeBackup = string.format( "%2d.%02d", mn, sc)
+
+ elseif mn > 9 then
+ -- > 9mn
+ if c == "" then
+ mDeltaTimeBackup = string.format( "%2d.%2d", mn, sc)
else
- if side == 0 then
- mSRDlxLeftText = srdlxPanel
- else
- mSRDlxRightText = srdlxPanel
- end
+ mDeltaTimeBackup = string.format( "%s%2d ", c, mn)
+ end
+
+ elseif mn > 0 and mn < 10 then
+ -- < 10mn
+ if c == "" then
+ mDeltaTimeBackup = string.format( "%1d.%02d.%01d", mn, sc, hd)
+ else
+ mDeltaTimeBackup = string.format( "%s%1d.%02d", c, mn, sc)
+ end
+
+ else
+ -- sc > 9
+ if sc > 9 then
+ if c == "" then
+ mDeltaTimeBackup = string.format( "0.%2d.%1d", sc, hd)
+ else
+ mDeltaTimeBackup = string.format( "%s%02d.%01d", c, sc, hd)
+ end
+
+ else
+ -- sc < 0
+ if c == "" then
+ mDeltaTimeBackup = string.format( "0.%01d.%02d", sc, hd)
+ else
+ mDeltaTimeBackup = string.format( "%s%01d.%02d", c, sc, hd)
+ end
+
+ end
+ end
+ --end
+
+ --print(srdlxPanel,mDeltaTimeBackup)
+ srdlxPanel = mDeltaTimeBackup
+ end
+
+ if isSlowUpdate or diffTimeFlag or timeFlag or systemFlag then
+ if side == 0 then
+ if GetTicks() > ( refreshRate + mDeltaTimeOldTicks ) then
+ mDeltaTimeOldTicks = GetTicks()
+ mSRDlxLeftText = srdlxPanel
+ end
+ else
+ if GetTicks() > ( refreshRate + mDeltaTimeAlternateOldTicks ) then
+ mDeltaTimeAlternateOldTicks = GetTicks()
+ mSRDlxRightText = srdlxPanel
+ end
+ end
+ -- print(GetTicks() .. mSRDlxRightText .."\n")
+ else
+ if side == 0 then
+ mSRDlxLeftText = srdlxPanel
+ else
+ mSRDlxRightText = srdlxPanel
+ end
end
-- print(mSRDlxLeftText, mSRDlxRightText, srdlxPanel)
-- send string to sli manager
if side == 0 then
- SetLeftDigits( mSRDlxLeftText )
+ SetLeftDigits( mSRDlxLeftText )
else
- SetRightDigits( mSRDlxRightText )
+ SetRightDigits( mSRDlxRightText )
end
return 1
diff --git a/scripts/simracef1.lua b/scripts/simracef1.lua
index 152b684..2907f4c 100644
--- a/scripts/simracef1.lua
+++ b/scripts/simracef1.lua
@@ -1,8 +1,9 @@
--- SIMRACE F1 Lua Script v1.1.3
+-- SIMRACE F1 Lua Script v1.1.3.5
-- Copyright (c)2012-2013 by Zappadoc - All Rights Reserved.
-- this script builds all functions associated with
-- left and right panels of SIMRACE-F1 device
--- last change by Zappadoc - 2013-10
+-- last change by Zappadoc - 2013-11
+
-- ============================================================
-- Left and Right Panel functions
@@ -20,31 +21,31 @@ function srf1DigitsEvent(swFunction, side)
-- call custom script
if side == 0 then
- local result = custom_srf1LeftDigitsEvent(swValue)
- -- if result = 0 bypass the script below and return 0
- -- if result = 1 bypass the script below and return 1
- if result <= 1 then return result end
- -- if result >= 2 continue
-
- -- call global custom script
- result = global_custom_srf1LeftDigitsEvent(swValue)
- -- if result = 0 bypass the script below and return 0
- -- if result = 1 bypass the script below and return 1
- if result <= 1 then return result end
- -- if result >= 2 continue
+ local result = custom_srf1LeftDigitsEvent(swValue)
+ -- if result = 0 bypass the script below and return 0
+ -- if result = 1 bypass the script below and return 1
+ if result <= 1 then return result end
+ -- if result >= 2 continue
+
+ -- call global custom script
+ result = global_custom_srf1LeftDigitsEvent(swValue)
+ -- if result = 0 bypass the script below and return 0
+ -- if result = 1 bypass the script below and return 1
+ if result <= 1 then return result end
+ -- if result >= 2 continue
else
- local result = custom_srf1RightDigitsEvent(swValue)
- -- if result = 0 bypass the script below and return 0
- -- if result = 1 bypass the script below and return 1
- if result <= 1 then return result end
- -- if result >= 2 continue
-
- -- call global custom script
- result = global_custom_srf1RightDigitsEvent(swValue)
- -- if result = 0 bypass the script below and return 0
- -- if result = 1 bypass the script below and return 1
- if result <= 1 then return result end
- -- if result >= 2 continue
+ local result = custom_srf1RightDigitsEvent(swValue)
+ -- if result = 0 bypass the script below and return 0
+ -- if result = 1 bypass the script below and return 1
+ if result <= 1 then return result end
+ -- if result >= 2 continue
+
+ -- call global custom script
+ result = global_custom_srf1RightDigitsEvent(swValue)
+ -- if result = 0 bypass the script below and return 0
+ -- if result = 1 bypass the script below and return 1
+ if result <= 1 then return result end
+ -- if result >= 2 continue
end
local hr = 0
@@ -55,7 +56,7 @@ function srf1DigitsEvent(swFunction, side)
local lpt = 0.0
local diffTimeFlag = false
local timeFlag = false
- local systemflag = false
+ local systemFlag = false
local unit = false
local inf = ""
local spd = 0.0
@@ -72,7 +73,7 @@ function srf1DigitsEvent(swFunction, side)
dlt = GetContextInfo("displaylaptime")
if dlt == nil then dlt = false end
if dlt and side == 1 and swValue ~= 47 and swValue ~= 48 then
- swValue = 11
+ swValue = 11
end
-- check if quick info button is down
@@ -80,16 +81,16 @@ function srf1DigitsEvent(swFunction, side)
qi = GetContextInfo("quickinfobutton")
if qi == nil or qi == 0 then qi = false end
if qi then
- -- get index for left and right panel
- local qiInf = 1
- if side == 0 then
- qiInf = GetContextInfo("quickinfoleft")
- else
- qiInf = GetContextInfo("quickinforight")
- end
- if qiInf == nil then qiInf = 1 end
- -- force position to match QI preference
- swValue = qiInf
+ -- get index for left and right panel
+ local qiInf = 1
+ if side == 0 then
+ qiInf = GetContextInfo("quickinfoleft")
+ else
+ qiInf = GetContextInfo("quickinforight")
+ end
+ if qiInf == nil then qiInf = 1 end
+ -- force position to match QI preference
+ swValue = qiInf
end
-- check if PIT Feedback ON
@@ -97,15 +98,15 @@ function srf1DigitsEvent(swFunction, side)
pf = GetContextInfo("pitfeedback")
if pf == nil or pf == 0 then pf = false end
if pf then
- -- force position to PIT/SPEED function if car pits
- local pit = GetCarInfo("inpits")
- if pit > 0 then
- if side == 0 then
- swValue = 45
- else
- swValue = 1
- end
- end
+ -- force position to PIT/SPEED function if car pits
+ local pit = GetCarInfo("inpits")
+ if pit > 0 then
+ if side == 0 then
+ swValue = 45
+ else
+ swValue = 1
+ end
+ end
end
-- get current simulation name
@@ -115,579 +116,529 @@ function srf1DigitsEvent(swFunction, side)
-- check postion and compute left panel string
if swValue == 1 then
- -- speed only
- srf1Panel = string.format("%3.0f ", spd )
+ -- speed only
+ srf1Panel = string.format("%3.0f ", spd )
elseif swValue == 2 then
- -- fuel
- local fuel = GetCarInfo("fuel")
- if fuel ~= nil then
- fuel = GetFuel(fuel, unit)
- if fuel >= 100 then
- srf1Panel = string.format("F%3d", round(fuel))
- elseif fuel >= 10 then
- srf1Panel = string.format("F%2d ", round(fuel))
- else
- srf1Panel = string.format("F%1.1f ", fuel)
- end
- end
+ -- fuel
+ local fuel = GetCarInfo("fuel")
+ if fuel ~= nil then
+ fuel = GetFuel(fuel, unit)
+ if fuel >= 100 then
+ srf1Panel = string.format("F%3d", round(fuel))
+ elseif fuel >= 10 then
+ srf1Panel = string.format("F%2d ", round(fuel))
+ else
+ srf1Panel = string.format("F%1.1f ", fuel)
+ end
+ end
elseif swValue == 3 then
- -- position
- inf = GetContextInfo("position")
- if inf ~= nil then
- if inf >= 100 then
- srf1Panel = string.format("P%3d", inf)
- elseif inf >= 10 then
- srf1Panel = string.format("P%2d ", inf)
- else
- srf1Panel = string.format("P%1d ", inf)
- end
- end
+ -- position
+ inf = GetContextInfo("position")
+ if inf ~= nil then
+ if inf >= 100 then
+ srf1Panel = string.format("P%3d", inf)
+ elseif inf >= 10 then
+ srf1Panel = string.format("P%2d ", inf)
+ else
+ srf1Panel = string.format("P%1d ", inf)
+ end
+ end
elseif swValue == 4 then
- -- laps completed
- inf = GetContextInfo("laps")
- if inf ~= nil then
- -- if more then 99 laps
- if inf >= 100 then
- srf1Panel = string.format("L%3d", inf)
- elseif inf >= 10 then
- srf1Panel = string.format("L%2d ", inf)
- else
- srf1Panel = string.format("L%1d ", inf)
- end
- end
+ -- laps completed
+ inf = GetContextInfo("laps")
+ if inf ~= nil then
+ -- if more then 99 laps
+ if inf >= 100 then
+ srf1Panel = string.format("L%3d", inf)
+ elseif inf >= 10 then
+ srf1Panel = string.format("L%2d ", inf)
+ else
+ srf1Panel = string.format("L%1d ", inf)
+ end
+ end
elseif swValue == 5 then
- -- sector
- inf = GetCarInfo("sector")
- if inf ~= nil then
- -- check if sector > 9
- if inf >9 then
- srf1Panel = string.format("S%2d ", inf)
- else
- srf1Panel = string.format("S%1d ", inf)
- end
- end
+ -- sector
+ inf = GetCarInfo("sector")
+ if inf ~= nil then
+ -- check if sector > 9
+ if inf >9 then
+ srf1Panel = string.format("S%2d ", inf)
+ else
+ srf1Panel = string.format("S%1d ", inf)
+ end
+ end
elseif swValue == 6 then
- -- total laps if available
- local tl = GetContextInfo("lapscount")
- if tl < 1 then tl = 0 end
- -- if more then 99 laps
- if tl >= 100 then
- srf1Panel = string.format("T%3d", tl)
- elseif tl >= 10 then
- srf1Panel = string.format("T%2d ", tl)
- else
- srf1Panel = string.format("T%1d ", tl)
- end
+ -- total laps if available
+ local tl = GetContextInfo("lapscount")
+ if tl < 1 then tl = 0 end
+ -- if more then 99 laps
+ if tl >= 100 then
+ srf1Panel = string.format("T%3d", tl)
+ elseif tl >= 10 then
+ srf1Panel = string.format("T%2d ", tl)
+ else
+ srf1Panel = string.format("T%1d ", tl)
+ end
elseif swValue == 7 then
- -- water temp
- inf = GetCarInfo("watertemp")
- if inf ~= nil then
- inf = GetTemp(inf, unit)
- srf1Panel = string.format("W%2.1f", inf)
- end
+ -- water temp
+ inf = GetCarInfo("watertemp")
+ if inf ~= nil then
+ inf = GetTemp(inf, unit)
+ srf1Panel = string.format("W%2.1f", inf)
+ end
elseif swValue == 8 then
- -- oil temp
- inf = GetCarInfo("oiltemp")
- if inf ~= nil then
- inf = GetTemp(inf, unit)
- srf1Panel = string.format("o%2.1f", inf)
- end
+ -- oil temp
+ inf = GetCarInfo("oiltemp")
+ if inf ~= nil then
+ inf = GetTemp(inf, unit)
+ srf1Panel = string.format("o%2.1f", inf)
+ end
elseif swValue == 9 then
- -- best lap time
- timeFlag = true
- lpt = GetTimeInfo("laptime")
+ -- best lap time
+ timeFlag = true
+ lpt = GetTimeInfo("laptime")
elseif swValue == 10 then
- -- best lap time
- timeFlag = true
- lpt = GetTimeInfo("bestlaptime")
+ -- best lap time
+ timeFlag = true
+ lpt = GetTimeInfo("bestlaptime")
elseif swValue == 11 then
- -- last lap time
- timeFlag = true
- lpt = GetTimeInfo("lastlaptime")
+ -- last lap time
+ timeFlag = true
+ lpt = GetTimeInfo("lastlaptime")
elseif swValue >= 12 and swValue <= 18 and isAppIRacing(sim) then
- timeFlag = true
- diffTimeFlag = true
- -- iRacing partials
- local ts = GetContextInfo("partialcount")
- local sector = GetCarInfo("sector")
- if ts ~= nil and ts > 0 then
- if swValue == 12 then
- lpt = GetPartialTimeInfo("currentpartial", sector)
- elseif swValue == 13 then
- lpt = GetPartialTimeInfo("vsbestlap", sector)
- elseif swValue == 14 then
- lpt = GetPartialTimeInfo("vsoptimallap", sector)
- elseif swValue == 15 then
- lpt = GetPartialTimeInfo("vsoptimalsector", sector)
- elseif swValue == 16 then
- lpt = GetPartialTimeInfo("vssessionbestlap", sector)
- elseif swValue == 17 then
- lpt = GetPartialTimeInfo("vssessionoptimallap", sector)
- elseif swValue == 18 then
- lpt = GetPartialTimeInfo("vssessionoptimalsector", sector)
- end
- else
- lpt = 0.0
- end
+ timeFlag = true
+ diffTimeFlag = true
+ -- iRacing partials
+ local ts = GetContextInfo("partialcount")
+ local sector = GetCarInfo("sector")
+ if ts ~= nil and ts > 0 then
+ if swValue == 12 then
+ lpt = GetPartialTimeInfo("currentpartial", sector)
+ elseif swValue == 13 then
+ lpt = GetPartialTimeInfo("vsbestlap", sector)
+ elseif swValue == 14 then
+ lpt = GetPartialTimeInfo("vsoptimallap", sector)
+ elseif swValue == 15 then
+ lpt = GetPartialTimeInfo("vsoptimalsector", sector)
+ elseif swValue == 16 then
+ lpt = GetPartialTimeInfo("vssessionbestlap", sector)
+ elseif swValue == 17 then
+ lpt = GetPartialTimeInfo("vssessionoptimallap", sector)
+ elseif swValue == 18 then
+ lpt = GetPartialTimeInfo("vssessionoptimalsector", sector)
+ end
+ else
+ lpt = 0.0
+ end
elseif swValue == 19 then
- -- real time diff vs your best
- diffTimeFlag = true
- timeFlag = true
- lpt = GetTimeInfo("realdiffbest")
+ -- real time diff vs your best
+ diffTimeFlag = true
+ timeFlag = true
+ lpt = GetTimeInfo("realdiffbest")
elseif swValue == 20 then
- -- real time diff vs your last
- diffTimeFlag = true
- timeFlag = true
- lpt = GetTimeInfo("realdifflast")
+ -- real time diff vs your last
+ diffTimeFlag = true
+ timeFlag = true
+ lpt = GetTimeInfo("realdifflast")
elseif swValue == 21 then
- -- get an average consumption of fuel per lap and gives the remaining laps
- local remainintank = GetCarInfo("remainlapsintank")
- srf1Panel = string.format("L%3.0f", math.floor(remainintank) )
+ -- get an average consumption of fuel per lap and gives the remaining laps
+ local remainintank = GetCarInfo("remainlapsintank")
+ srf1Panel = string.format("L%3.0f", math.floor(remainintank) )
elseif swValue == 22 then
- -- rpm
- isSlowUpdate = true
- --timeFlag = true
- local rpm = GetCarInfo("rpm")
- local r = rpm / 10.0
- if r < 1000 then
- srf1Panel = string.format("%3.1f", r)
- else
- srf1Panel = string.format("%4d.", round(r))
- end
+ -- rpm
+ isSlowUpdate = true
+ --timeFlag = true
+ local rpm = GetCarInfo("rpm")
+ local r = rpm / 10.0
+ if r < 1000 then
+ srf1Panel = string.format("%3.1f", r)
+ else
+ srf1Panel = string.format("%4d.", round(r))
+ end
elseif swValue == 23 then
- -- track size
- isSlowUpdate = true
- --timeFlag = true
- local trcksz = GetContextInfo("tracksize")
- local r = trcksz / 10
- if r < 1000 then
- srf1Panel = string.format("%3.1f", r)
- else
- srf1Panel = string.format("%4d.", round(r))
- end
+ -- track size
+ isSlowUpdate = true
+ --timeFlag = true
+ local trcksz = GetContextInfo("tracksize")
+ local r = trcksz / 10
+ if r < 1000 then
+ srf1Panel = string.format("%3.1f", r)
+ else
+ srf1Panel = string.format("%4d.", round(r))
+ end
elseif swValue == 24 then
- -- distance percent
- local dist = GetContextInfo("lapdistance")
- -- track size
- local trcksz = GetContextInfo("tracksize")
- local p = round(dist / (trcksz / 100))
- srf1Panel = string.format("D%3d", p )
+ -- distance percent
+ local dist = GetContextInfo("lapdistance")
+ -- track size
+ local trcksz = GetContextInfo("tracksize")
+ local p = round(dist / (trcksz / 100))
+ srf1Panel = string.format("D%3d", p )
elseif swValue == 25 then
- -- kers
- local kers = GetCarInfo("kers")
- srf1Panel = string.format("K%3d", round(kers/1000))
+ -- kers
+ local kers = GetCarInfo("kers")
+ srf1Panel = string.format("K%3d", round(kers/1000))
elseif swValue == 26 then
- -- kers max
- local kmx = GetCarInfo("kersmax")
- srf1Panel = string.format("K%3d", round(kmx/1000))
+ -- kers max
+ local kmx = GetCarInfo("kersmax")
+ srf1Panel = string.format("K%3d", round(kmx/1000))
elseif swValue == 27 then
- -- drs
- local drs = GetCarInfo("drs")
- if drs == 1 then
- srf1Panel = "ON "
- else
- srf1Panel = "OFF"
- end
+ -- drs
+ local drs = GetCarInfo("drs")
+ if drs == 1 then
+ srf1Panel = "ON "
+ else
+ srf1Panel = "OFF"
+ end
elseif swValue == 28 then
- -- kers percent
- local kers = GetCarInfo("kers")
- srf1Panel = string.format("K%3d", round((kers/1000)/4))
+ -- kers percent
+ local kers = GetCarInfo("kers")
+ srf1Panel = string.format("K%3d", round((kers/1000)/4) )
elseif swValue == 29 then
- -- wheels temp if available
- inf = GetCarInfo("wheeltempfrontleft")
- if inf ~= nil then
- -- if rFactor convert Kelvin to Celsius (see global.lua)
- if isAppRFactor(sim) then inf = KtoC(inf) end
- srf1Panel = string.format("%3.0f ", inf)
- end
+ -- wheels temp if available
+ inf = GetCarInfo("wheeltempfrontleft")
+ if inf ~= nil then
+ -- if rFactor convert Kelvin to Celsius (see global.lua)
+ if isAppRFactor(sim) then inf = KtoC(inf) end
+ srf1Panel = string.format("%3.0f ", inf)
+ end
elseif swValue == 30 then
- inf = GetCarInfo("wheeltempfrontright")
- if inf ~= nil then
- if isAppRFactor(sim) then inf = KtoC(inf) end
- srf1Panel = string.format("%3.0f ", inf)
- end
+ inf = GetCarInfo("wheeltempfrontright")
+ if inf ~= nil then
+ if isAppRFactor(sim) then inf = KtoC(inf) end
+ srf1Panel = string.format("%3.0f ", inf)
+ end
elseif swValue == 31 then
- inf = GetCarInfo("wheeltemprearleft")
- if inf ~= nil then
- if isAppRFactor(sim) then inf = KtoC(inf) end
- srf1Panel = string.format("%3.0f ", inf)
- end
+ inf = GetCarInfo("wheeltemprearleft")
+ if inf ~= nil then
+ if isAppRFactor(sim) then inf = KtoC(inf) end
+ srf1Panel = string.format("%3.0f ", inf)
+ end
elseif swValue == 32 then
- inf = GetCarInfo("wheeltemprearright")
- if inf ~= nil then
- if isAppRFactor(sim) then inf = KtoC(inf) end
- srf1Panel = string.format("%3.0f ", inf)
- end
+ inf = GetCarInfo("wheeltemprearright")
+ if inf ~= nil then
+ if isAppRFactor(sim) then inf = KtoC(inf) end
+ srf1Panel = string.format("%3.0f ", inf)
+ end
elseif swValue == 33 then
- -- wheels pressure if available
- inf = GetCarInfo("wheelpressfrontleft")
- if inf ~= nil then
- -- convert to psi
- srf1Panel = string.format("%2.1f ", inf / 6.88)
- end
+ -- wheels pressure if available
+ inf = GetCarInfo("wheelpressfrontleft")
+ if inf ~= nil then
+ -- convert to psi
+ srf1Panel = string.format("%2.1f ", inf / 6.88)
+ end
elseif swValue == 34 then
- inf = GetCarInfo("wheelpressfrontright")
- if inf ~= nil then
- srf1Panel = string.format("%2.1f ", inf / 6.88)
- end
+ inf = GetCarInfo("wheelpressfrontright")
+ if inf ~= nil then
+ srf1Panel = string.format("%2.1f ", inf / 6.88)
+ end
elseif swValue == 35 then
- inf = GetCarInfo("wheelpressrearleft")
- if inf ~= nil then
- srf1Panel = string.format("%2.1f ", inf / 6.88)
- end
+ inf = GetCarInfo("wheelpressrearleft")
+ if inf ~= nil then
+ srf1Panel = string.format("%2.1f ", inf / 6.88)
+ end
elseif swValue == 36 then
- inf = GetCarInfo("wheelpressrearright")
- if inf ~= nil then
- srf1Panel = string.format("%2.1f ", inf / 6.88)
- end
+ inf = GetCarInfo("wheelpressrearright")
+ if inf ~= nil then
+ srf1Panel = string.format("%2.1f ", inf / 6.88)
+ end
elseif swValue == 37 then
- -- brakes temp if available
- inf = GetCarInfo("braketempfrontleft")
- if inf ~= nil then
- if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
- srf1Panel = string.format("%3.0f ", inf)
- end
+ -- brakes temp if available
+ inf = GetCarInfo("braketempfrontleft")
+ if inf ~= nil then
+ if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
+ srf1Panel = string.format("%3.0f ", inf)
+ end
elseif swValue == 38 then
- inf = GetCarInfo("braketempfrontright")
- if inf ~= nil then
- if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
- srf1Panel = string.format("%3.0f ", inf)
- end
+ inf = GetCarInfo("braketempfrontright")
+ if inf ~= nil then
+ if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
+ srf1Panel = string.format("%3.0f ", inf)
+ end
elseif swValue == 39 then
- inf = GetCarInfo("braketemprearleft")
- if inf ~= nil then
- if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
- srf1Panel = string.format("%3.0f ", inf)
- end
+ inf = GetCarInfo("braketemprearleft")
+ if inf ~= nil then
+ if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
+ srf1Panel = string.format("%3.0f ", inf)
+ end
elseif swValue == 40 then
- inf = GetCarInfo("braketemprearright")
- if inf ~= nil then
- if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
- srf1Panel = string.format("%3.0f ", inf)
- end
+ inf = GetCarInfo("braketemprearright")
+ if inf ~= nil then
+ if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
+ srf1Panel = string.format("%3.0f ", inf)
+ end
elseif swValue == 41 then
- -- time remaining if available
- lpt = GetTimeInfo("timeremaining")
- timeFlag = true
+ -- time remaining if available
+ lpt = GetTimeInfo("timeremaining")
+ timeFlag = true
elseif swValue == 42 then
- -- PC system time
- systemflag = true
- lpt = GetTimeInfo("systemtime")
- timeFlag = true
- --diffTimeFlag = true
+ -- PC system time
+ systemFlag = true
+ lpt = GetTimeInfo("systemtime")
+ timeFlag = true
+ --diffTimeFlag = true
elseif swValue == 43 then
- -- time elapsed if available
- lpt = GetTimeInfo("timetotalelapsed")
- timeFlag = true
+ -- time elapsed if available
+ lpt = GetTimeInfo("timetotalelapsed")
+ timeFlag = true
elseif swValue == 44 then
- -- last sector 1, 2 and 3
- local sector = GetCarInfo("sector")
- timeFlag = true
- --diffTimeFlag = true
- if sector == 1 then
- -- sector 3
- local ls1 = GetTimeInfo("lastsector1")
- local ls2 = GetTimeInfo("lastsector2")
- local lt = GetTimeInfo("lastlaptime")
- if ls1 > 0 and ls2 > 0 then
- lpt = lt - (ls1 + ls2)
- end
- elseif sector == 2 then
- local ls1 = GetTimeInfo("lastsector1")
- lpt = ls1
- else
- -- sector 3
- local ls2 = GetTimeInfo("lastsector2")
- lpt = ls2
- end
+ -- last sector 1, 2 and 3
+ local sector = GetCarInfo("sector")
+ timeFlag = true
+ if sector == 1 then
+ -- sector 3
+ local ls3 = GetTimeInfo("lastsector3")
+ lpt = ls3
+ elseif sector == 2 then
+ local ls1 = GetTimeInfo("lastsector1")
+ lpt = ls1
+ else
+ -- sector 3
+ local ls2 = GetTimeInfo("lastsector2")
+ lpt = ls2
+ end
elseif swValue == 45 then
- -- PIT
- srf1Panel = "PIT "
+ -- PIT
+ srf1Panel = "PIT "
elseif swValue == 46 then
- -- sc
- local sc = GetContextInfo("safetycare")
- if sc == 1 then
- srf1Panel = "SCAR"
- else
- srf1Panel = "OFF "
- end
+ -- sc
+ local sc = GetContextInfo("safetycare")
+ if sc == 1 then
+ srf1Panel = "SCAR"
+ else
+ srf1Panel = "OFF "
+ end
elseif swValue == 47 then
- -- real time delta vs last + last sector diff 1, 2 and 3
- local sector = GetCarInfo("sector")
- timeFlag = true
- diffTimeFlag = true
- if mDiffSectorDelay == nil or mDiffOldSector == nil or mDiffOldSector ~= sector then
- -- 8s delay, increase it if needed
- mDiffSectorDelay = GetTicks() + 8000
- mDiffOldSector = sector
- end
- -- init backup vars
- if mOld_lt == nil then
- mOld_ls1 = 0.00000
- mOld_ls2 = 0.00000
- mOld_lt = 0.00000
- mDelta_lpt = 0.00000
- mDelta_lptb = 0.00000
- end
-
- -- display delta by default
- lpt = GetTimeInfo("realdifflast")
-
- if mDiffSectorDelay > GetTicks() then
- -- display sector
- if sector == 1 then
- -- sector 3
- --local ls1 = GetTimeInfo("lastsector1")
- --local ls2 = GetTimeInfo("lastsector2")
- local lt = GetTimeInfo("lastlaptime")
-
- --i-- delta sector 3f ls1 > 0 and ls2 > 0 and lt > 0 and mOld_ls1 > 0 and mOld_ls2 > 0 and mOld_lt > 0 then
- -- delta sector 3
- --lpt = (lt - (ls1 + ls2)) - (mOld_lt - (mOld_ls1 + mOld_ls2))
- if lt > 0 and mOld_lt > 0 then
- if lt ~= mOld_lt then
- mDelta_lpt = lt - mOld_lt
- print(mDelta_lpt, lt, mOld_lt)
- end
- lpt = mDelta_lpt
- end
-
- mOld_lt = lt
-
-
- elseif sector == 2 then
- -- sector 1
- local ls1 = GetTimeInfo("lastsector1")
- if ls1 > 0 and mOld_ls1 > 0 then
- lpt = ls1 - mOld_ls1
- end
- mOld_ls2 = GetTimeInfo("lastsector2")
- print(lpt, ls1 , mOld_ls1, mOld_ls2)
-
- else
- -- sector 2
- local ls2 = GetTimeInfo("lastsector2")
- if ls2 > 0 and mOld_ls2 > 0 then
- lpt = ls2 - mOld_ls2
- end
- mOld_ls1 = GetTimeInfo("lastsector1")
- print(lpt, ls2 , mOld_ls1, mOld_ls2)
- end
- end
+ -- real time delta vs last + last sector diff 1, 2 and 3
+ timeFlag = true
+ diffTimeFlag = true
+
+ lpt = GetDeltaLastTime(false)
elseif swValue == 48 then
- -- real time delta vs best + last sector diff 1, 2 and 3
-
- -- get sector
- local sector = GetCarInfo("sector")
- -- set flags
- timeFlag = true
- diffTimeFlag = true
-
- -- set delay
- if mDiffSectorDelay == nil or mDiffOldSector == nil or mDiffOldSector ~= sector then
- -- 8s delay, increase it if needed
- mDiffSectorDelay = GetTicks() + 8000
- mDiffOldSector = sector
- end
-
- -- init backup vars
- if mOld_bt == nil then
- mOld_bs1 = 0.00000
- mOld_bs2 = 0.00000
- mOld_bt = 0.00000
- mDelta_lpt = 0.00000
- mDelta_lptb = 0.00000
- end
-
- -- display delta by default
- lpt = GetTimeInfo("realdiffbest")
-
- if mDiffSectorDelay > GetTicks() then
- -- display sector diff during delay
- if sector == 1 then
- -- sector 3
- --local bs1 = GetTimeInfo("bestsector1")
- --local bs2 = GetTimeInfo("bestsector2")
- local bt = GetTimeInfo("bestlaptime")
-
- --if bs1 > 0 and bs2 > 0 and bt > 0 and mOld_bs1 > 0 and mOld_bs2 > 0 and mOld_bt > 0 then
- -- delta sector 3
- -- lpt = (bt - (bs1 + bs2)) - (mOld_bt - (mOld_bs1 + mOld_bs2))
- if bt > 0 and mOld_bt > 0 then
- if bt ~= mOld_bt then
- mDelta_lptb = bt - mOld_bt
- print(mDelta_lpt, bt, mOld_bt)
- end
- lpt = mDelta_lptb
- end
-
- mOld_bt = bt
-
- elseif sector == 2 then
- -- sector 1
- local bs1 = GetTimeInfo("bestsector1")
- if bs1 > 0 and mOld_bs1 > 0 then
- lpt = bs1 - mOld_bs1
- end
- print(lpt, bs1 )
- mOld_bs2 = GetTimeInfo("bestsector2")
-
- else
- -- sector 2
- local bs2 = GetTimeInfo("bestsector2")
- if bs2 > 0 and mOld_bs2 > 0 then
- lpt = bs2 - mOld_bs2
- end
- print(lpt, bs2 )
- mOld_bs1 = GetTimeInfo("bestsector1")
- end
- end
+ -- real time delta vs best + last sector diff 1, 2 and 3
+
+ -- set flags
+ timeFlag = true
+ diffTimeFlag = true
+
+ lpt = GetDeltaBestTime(false)
+
+ elseif swValue == 49 then
+ timeFlag = true
+ -- current sector
+ local sector = GetCarInfo("sector")
+ if sector == 1 then
+ lpt = GetTimeInfo("sector1")
+ elseif sector == 2 then
+ lpt = GetTimeInfo("sector2")
+ else
+ -- sector 3
+ lpt = GetTimeInfo("sector3")
+ end
+
+ elseif swValue == 50 then
+ timeFlag = true
+ -- best sector 1
+ lpt = GetTimeInfo("bestsector1")
+
+ elseif swValue == 51 then
+ timeFlag = true
+ -- best sector 2
+ lpt = GetTimeInfo("bestsector2")
+
+ elseif swValue == 52 then
+ timeFlag = true
+ -- last sector 1
+ lpt = GetTimeInfo("lastsector1")
+
+ elseif swValue == 53 then
+ timeFlag = true
+ -- last sector 2
+ lpt = GetTimeInfo("lastsector2")
+
+ elseif swValue == 54 then
+ timeFlag = true
+ -- last sector 3
+ lpt = GetTimeInfo("lastsector3")
+
+ elseif swValue == 55 then
+ timeFlag = true
+ -- last sector 3
+ lpt = GetTimeInfo("bestsector3")
+
+ elseif swValue == 56 then
+ timeFlag = true
+ -- current sector 1 (rFactor)
+ lpt = GetTimeInfo("sector1")
+
+ elseif swValue == 57 then
+ timeFlag = true
+ -- current sector 2 (rFactor)
+ lpt = GetTimeInfo("sector2")
+
+ elseif swValue == 58 then
+ timeFlag = true
+ -- current sector 3 (rFactor)
+ lpt = GetTimeInfo("sector3")
+
+ elseif swValue == 59 then
+ -- rfactor real time delta vs last + last sector diff 1, 2 and 3
+ timeFlag = true
+ diffTimeFlag = true
+ lpt = GetDeltaLastTime(true)
+
+ elseif swValue == 60 then
+ -- rfactor real time delta vs best + last sector diff 1, 2 and 3
+
+ -- set flags
+ timeFlag = true
+ diffTimeFlag = true
+
+ lpt = GetDeltaBestTime(true)
else
- srf1Panel = " "
+ srf1Panel = " "
end
-- check if diff time is ready
local diffOK = GetTimeInfo("realdifftimeready")
- if diffTimeFlag and diffOK == false then
- diffTimeFlag = false
- timeFlag = false
- srf1Panel = "NPEF"
-
- mOld_ls1 = 0.00000
- mOld_ls2 = 0.00000
- mOld_lt = 0.00000
- mDelta_lpt = 0.00000
- mDelta_lptb = 0.00000
+ if diffTimeFlag and diffOK == false and dlt == false then
+ diffTimeFlag = false
+ timeFlag = false
+ srf1Panel = "NREF"
end
+
+
local c = ""
local refreshRate = mRefreshLapTimeRate
if diffTimeFlag then
- c = "+"
- refreshRate = mDeltaTimeDelay
+ c = "+"
+ refreshRate = mDeltaTimeDelay
end
if timeFlag and lpt ~= nil then
- -- set char of negative number
- if diffTimeFlag then
- if lpt < 0 then c = "-" end
- end
- -- explod time
- hr, mn, sc, hd, ms = timeDispatcher(lpt)
+ -- set char of negative number
+ if diffTimeFlag then
+ if lpt < 0 then c = "-" end
+ end
+ -- explod time
+ hr, mn, sc, hd, ms = timeDispatcher(lpt)
--print("lpt: " .. lpt .. " m: " .. mn .. " - s: " .. sc .. " - ms: " .. ms .."\n" )
- -- update display every mDeltaTimeDelay time
- if GetTicks() > (refreshRate + mDeltaTimeOldTicks ) then
- mDeltaTimeOldTicks = GetTicks()
-
- if lpt == -1 or (mn + sc + ms) == 0.0000 then
- mDeltaTimeBackup = "-.---"
-
- elseif systemflag then
- mDeltaTimeBackup = string.format( "%2d.%02d", mn, sc)
-
- elseif mn > 9 then
- -- > 9mn
- if c == "" then
- mDeltaTimeBackup = string.format( "%2d.%2d", mn, sc)
- else
- mDeltaTimeBackup = string.format( "%s%2d ", c, mn)
- end
-
- elseif mn > 0 and mn < 10 then
- -- < 10mn
- if c == "" then
- mDeltaTimeBackup = string.format( "%1d.%02d.%01d", mn, sc, hd)
- else
- mDeltaTimeBackup = string.format( "%s%1d.%02d", c, mn, sc)
- end
-
- else
- -- sc > 9
- if sc > 9 then
- if c == "" then
- mDeltaTimeBackup = string.format( "0.%2d.%1d", sc, hd)
- else
- mDeltaTimeBackup = string.format( "%s%02d.%01d", c, sc, hd)
- end
-
- else
- -- sc < 0
- if c == "" then
- mDeltaTimeBackup = string.format( "0.%01d.%02d", sc, hd)
- else
- mDeltaTimeBackup = string.format( "%s%01d.%02d", c, sc, hd)
- end
-
- end
- end
- end
-
- --print(srf1Panel,mDeltaTimeBackup)
- srf1Panel = mDeltaTimeBackup
- end
-
- if isSlowUpdate then
-
- if GetTicks() > ( refreshRate + mDeltaTimeOldTicks ) then
- mDeltaTimeOldTicks = GetTicks()
- if side == 0 then
- mSRF1LeftText = srf1Panel
- else
- mSRF1RightText = srf1Panel
- end
- -- print(GetTicks() .. mSRF1RightText .."\n")
- end
+ -- update display every mDeltaTimeDelay time
+
+ --if GetTicks() > (refreshRate + mDeltaTimeOldTicks ) then
+ --mDeltaTimeOldTicks = GetTicks()
+
+ if lpt == -1 or (mn + sc + ms) == 0.0000 then
+ mDeltaTimeBackup = "-.---"
+
+ elseif systemFlag then
+ mDeltaTimeBackup = string.format( "%2d.%02d", mn, sc)
+
+ elseif mn > 9 then
+ -- > 9mn
+ if c == "" then
+ mDeltaTimeBackup = string.format( "%2d.%2d", mn, sc)
+ else
+ mDeltaTimeBackup = string.format( "%s%2d ", c, mn)
+ end
+
+ elseif mn > 0 and mn < 10 then
+ -- < 10mn
+ if c == "" then
+ mDeltaTimeBackup = string.format( "%1d.%02d.%01d", mn, sc, hd)
+ else
+ mDeltaTimeBackup = string.format( "%s%1d.%02d", c, mn, sc)
+ end
+
+ else
+ -- sc > 9
+ if sc > 9 then
+ if c == "" then
+ mDeltaTimeBackup = string.format( "0.%2d.%1d", sc, hd)
+ else
+ mDeltaTimeBackup = string.format( "%s%02d.%01d", c, sc, hd)
+ end
+
+ else
+ -- sc < 0
+ if c == "" then
+ mDeltaTimeBackup = string.format( "0.%01d.%02d", sc, hd)
+ else
+ mDeltaTimeBackup = string.format( "%s%01d.%02d", c, sc, hd)
+ end
+
+ end
+ end
+ --end
+
+ --print(srf1Panel,mDeltaTimeBackup)
+ srf1Panel = mDeltaTimeBackup
+ end
+
+ if isSlowUpdate or diffTimeFlag or timeFlag or systemFlag then
+ if side == 0 then
+ if GetTicks() > ( refreshRate + mDeltaTimeOldTicks ) then
+ mDeltaTimeOldTicks = GetTicks()
+ mSRF1LeftText = srf1Panel
+ end
else
- if side == 0 then
- mSRF1LeftText = srf1Panel
- else
- mSRF1RightText = srf1Panel
- end
+ if GetTicks() > ( refreshRate + mDeltaTimeAlternateOldTicks ) then
+ mDeltaTimeAlternateOldTicks = GetTicks()
+ mSRF1RightText = srf1Panel
+ end
+ end
+ -- print(GetTicks() .. mSRF1RightText .."\n")
+ else
+ if side == 0 then
+ mSRF1LeftText = srf1Panel
+ else
+ mSRF1RightText = srf1Panel
+ end
end
-- print(mSRF1LeftText, mSRF1RightText, srf1Panel)
-- send string to sli manager
if side == 0 then
- SetLeftDigits( mSRF1LeftText )
+ SetLeftDigits( mSRF1LeftText )
else
- SetRightDigits( mSRF1RightText )
+ SetRightDigits( mSRF1RightText )
end
return 1
diff --git a/scripts/slidevice.lua b/scripts/slidevice.lua
index 35b72d0..a5ef3de 100644
--- a/scripts/slidevice.lua
+++ b/scripts/slidevice.lua
@@ -23,7 +23,6 @@ scr = GetCustomScripts("scriptname")
-- print ( scr )
if scr ~= nil and scr ~= "" then
mCustomScriptsFileName = scr
- print ( string.format("Loading custom script %s ...", scr) )
require(mCustomScriptsFileName)
custom_initEvent(scr)
end
diff --git a/scripts/slimax_script_readme.txt b/scripts/slimax_script_readme.txt
index f309203..6a22a4f 100644
--- a/scripts/slimax_script_readme.txt
+++ b/scripts/slimax_script_readme.txt
@@ -1,820 +1,837 @@
-SLIMax Manager III 3.3.1 Scripting Information - PART OF SLIMax Manager pkg
-Copyright (c)2011-2013 by EK & Zappadoc - All Rights Reserved.
-updated 2013-10 by Zappadoc
-
-** ALL INFORMATION BELOW ARE SUBJECT TO CHANGE WITHOUT NOTICE **
-
-=================================
-Script Engine based on Lua 5.1.4
-
-License for Lua 5.1.4 and later versions
-Copyright © 1994–2011 Lua.org, PUC-Rio.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-=================================
-Lua website
-http://www.lua.org/
-
-Reference manual (v5.1):
-http://www.lua.org/manual/5.1/
-
-
-====================================
-Events received from SLIMax Manager
-====================================
-
-function custom_initEvent(scriptFile)
-param = custom script file name
-Notes: this event is triggered at startup or when loading your custom script,
-this is the good opportunity to init your preferences and global vars
-
-All event functions below must return 1 if the event has been fully managed or
-2 to skip and give control to SLIMax Mgr
-
----------------------------------------------
-GLOBAL EVENTS (ALL DEVICES)
----------------------------------------------
-function controlsEvent(deviceType, ctrlType, ctrlPos, value, funcIndex, targetDevice) and custom_controlsEvent
-params = see the control.lua script
-Devices supported: global event
-Notes: Controls Event, Manage buttons and switches. (see controls.lua script)
-
----------------------------------------------
-function deviceReport(deviceType) and custom_deviceReport
-param = the current targeted device (BU0710, SLI-M, SLI-PRO, SIM RACE Deluxe, SIM RACE F1, Fanatec Wheels and Logitech G27 leds and emulators SLI-EMU and SRF1-EMU)
-Devices supported: global event
-Notes: This function is called periodically and outputs the previously processed data to the device when it returns
-back to the manager, if needed, patch any previous function here to
-display additional info or to change everything. (see devhook.lua script)
-
----------------------------------------------
-function enterSessionEvent(deviceType) and custom_enterSessionEvent
-param = current device (BU0710, SLI-M, SLI-PRO, SIM RACE Deluxe, SIM RACE F1, Fanatec Wheels and Logitech G27 leds and emulators SLI-EMU and SRF1-EMU)
-Notes: Triggered when the session starts
-(see enter_exit_session.lua script)
-
----------------------------------------------
-function exitSessionEvent(deviceType) and custom_exitSessionEvent
-param = current device (BU0710, SLI-M, SLI-PRO, SIM RACE Deluxe, SIM RACE F1, Fanatec Wheels and Logitech G27 leds and emulators SLI-EMU and SRF1-EMU)
-Devices supported: global event
-Notes: Triggered when the session ends
-(see enter_exit_session.lua script)
-
----------------------------------------------
-LOCAL EVENTS (SPECIFIC TO DEVICES)
----------------------------------------------
-function shiftLightsMethodEvent(idx) and custom_shiftLightsMethodEvent
-function shiftLightsBU0710Event(idx) and custom_shiftLightsBU0710Event
-function shiftLightsFanatecMethodEvent(idx) and custom_shiftLightsFanatecMethodEvent
-function shiftLightsG27LedsMethodEvent(idx) and custom_shiftLightsG27LedsMethodEvent
-function shiftLightsSRDlxMethodEvent(idx) and custom_shiftLightsSRDlxMethodEvent
-function shiftLightsSRF1MethodEvent(idx) and custom_shiftLightsSRF1MethodEvent
-param = current method index
-Devices supported: BU0710, SLI-M, SLI-PRO, SIM RACE Deluxe, SIM RACE F1, Fanatec Wheels and Logitech G27 leds and emulators SLI-EMU and SRF1-EMU
-Notes: shiftlights method event, computes all shiftlights methods
-(see shiftlights.lua script)
-
----------------------------------------------
-function ospMethodEvent(idx) and custom_ospMethodEvent
-function ospSRDlxMethodEvent(idx) and custom_ospSRDlxMethodEvent
-function ospSRF1MethodEvent(idx) and custom_ospSRF1MethodEvent
-function ospFanatecMethodEvent(idx) and custom_ospFanatecMethodEvent
-function ospG27LedsMethodEvent(idx) and custom_ospG27LedsMethodEvent
-param = current method index
-Devices supported: BU0710, SLI-M, SLI-PRO, SIM RACE Deluxe, SIM RACE F1, Fanatec Wheels and Logitech G27 leds and emulators SLI-EMU and SRF1-EMU
-Notes: OSP method event, computes all Optimal Shift-Points methods
-(see osp.lua script)
-
----------------------------------------------
-function spdLmtMethodEvent(idx) and custom_spdLmtMethodEvent
-function spdLmtSRDlxMethodEvent(idx) and custom_spdLmtSRDlxMethodEvent
-function spdLmtSRF1MethodEvent(idx) and custom_spdLmtSRF1MethodEvent
-function spdLmtFanatecMethodEvent(idx) and custom_spdLmtFanatecMethodEvent
-function spdLmtG27MethodEvent(idx) and custom_spdLmtG27MethodEvent
-param = current method index
-Devices supported: BU0710, SLI-M, SLI-PRO, SIM RACE Deluxe, SIM RACE F1, Fanatec Wheels and Logitech G27 leds and emulators SLI-EMU and SRF1-EMU
-Notes: speedlimiter method event, computes all speedlimiter methods
-(see speedlimiter.lua script)
-
----------------------------------------------
-function leftDigitsEvent(swPosition) and custom_leftDigitsEvent
-function rightDigitsEvent(swPosition) and custom_rightDigitsEvent
-function srdlxLeftDigitsEvent(swPosition) and custom_srdlxLeftDigitsEvent
-function srdlxRightDigitsEvent(swPosition) and custom_srdlxRightDigitsEvent
-function srf1LeftDigitsEvent(swPosition) and custom_srf1LeftDigitsEvent
-function srf1RightDigitsEvent(swPosition) and custom_srf1RightDigitsEvent
-function fanatecDigitsEvent(swPosition) and custom_fanatecDigitsEvent
-param = switch position
-Devices supported: SLI-PRO, SIM RACE Deluxe, SIM RACE F1 and Fanatec Wheels and emulators SLI-EMU and SRF1-EMU
-
-Notes: computes data to be displayed on digits panel of the device
-(see scripts: slipro.lua, simracedlx.lua, simracef1.lua and fanatec.lua)
-
----------------------------------------------
-function gearEvent(gear) and custom_gearEvent
-function gearFanatecEvent(gear) and custom_gearFanatecEvent
-Devices supported: SLI Boards series and Fanatec Wheels
-param = current seleted gear ( -1 = reverse, 0 = neutral, 1 ... 7)
-Notes: gear event, show the current selected gear on central digit
-(see gear.lua script)
-
----------------------------------------------
-function ledEvent(idx, ledFunction, state) and custom_ledEvent
-param = index of the led, std state of the led and corresponding function
-1=LowFuel
-2=TC
-3=ABS
-4=Green Flag
-5=Yellow flag
-6=Red Flag
-7=Over Heating
-8=Damage
-9=Pit request
-10=Power
-11=Rev Limit
-12=HeadLights
-13=Blue Flag
-14=DRS
-15=Safe Prefs
-
-Devices supported: SLI Boards series only
-Notes: patch std led behaviors (i.e. tc, abs, lowfuel,
- dammage, rev limit, drs, pit request, flags, ... )
-IMPORTANT: your script must be optimized as the function is
-called several time by second to report all activated leds
-(see led.lua script)
-
------------------------------------------------
-All functions starting with custom_ can created
-to change std behaviors and can be associated
-with your custom settings.
-(see COMBO SETUP in forum)
------------------------------------------------
-
-
-============================================
-functions to change SLIMax Manager information
-============================================
-
----------------------------------------------
-Fanatec additions:
----------------------------------------------
-SetFanatecDigitsAllowed(boolean)
-param boolean = true or false
-by default the 3 digits are showed but sometime we need to temporarily
-hide them to set our custom information, pass false to this function to hide digits
-and true to show them again
-
----------------------------------------------
-SetFanatecDigits(string)
-param string = 3 chars string + dots
-Set the alpha-numerical text (including the . delimiter) to the digits panel (see fanatec.lua script)
-
----------------------------------------------
-SetFanatecOneDigit(digit,a,b,c,d,e,f,g,dot)
-param digit = from 0 to 2
-param a,b,c,d,e,f,g = false or true
-param dot = false or true
-Set the 7 segments + dot of each digit
-
----------------------------------------------
-SetFanatecCspMotor(power,delay)
-param power: from 0 to 100
-param delay: from 0 to 1000 ms (1sec max)
-
-SetFanatecWheelMotor(motor,power,delay)
-param motor = 0 or 1 (left or right motor )
-param power: from 0 to 100
-param delay: from 0 to 1000 ms (1sec max)
-
-SetFanatecLed(string table) <<<<< DEPRECATED use SetRPMLed()
-param string = name of lua table (default mRPMLedTable)
-set RPM led of Fanatec rim ( see shiftlights.lua script)
-
-SetFanatecGear(gear) <<<<< DEPRECATED use SetGearDigits()
-param string = one char string (i.e. "r" or "n" or "1" ... )
-set the gear value in center of the Fanatec digits panel (see fanatec.lua script)
-
----------------------------------------------
-Logitech Additions:
----------------------------------------------
-SetG27Led(int)
-param integer = number, each bit represent one led from 0 to 0x1F
-set leds of G27 device ( see shiftlights.lua script)
-
----------------------------------------------
-SetBU0710Led(int)
-param integer = number from 0 to 10
-set leds of BU0710 device ( see shiftlights.lua script)
-
----------------------------------------------
-SetGeadDigit(string)
-param string = one char string (i.e. "r" or "n" or "1")
-set gear digit of current targeted SLI device ( see gear.lua script)
-
----------------------------------------------
-SetRPMLed(string)
-param string = name of lua table (default mRPMLedTable)
-set RPM led of current targeted SLI device, SLI-M or SLI-PRO or SIM RACE Deluxe ( see shiftlights.lua script)
-
----------------------------------------------
-SetWarnLed(idx, val)
-param integer = index of led from 1 to 6
-param integer = value 1 or 0
-set the 6 extra leds of current targeted SLI device (SLI-M or SLI-PRO or SIM RACE Deluxe)
-
----------------------------------------------
-SetExtLed(idx, val)
-param integer = index of led from 1 to 5
-param integer = value 1 or 0
-set the 5 external leds of current targeted SLI device (SLI-M or SLI-PRO or SIM RACE Deluxe)
-
----------------------------------------------
-SetOSPStatus(boolean)
-param boolean = true or false
-in Optimal ShiftPoints (OSP) Methods compute your own OSP curve and set
-the corresponding OSP state with this function (true or false - see osp.lua script)
-
----------------------------------------------
-========== SLI-PRO or SIM RACE Deluxe DIGITS PANELs ==========
-SetRightDigits(string)
-SetLeftDigits(string)
-param string = 6 chars string + delimiter
-set the alpha-numerical text (including the . and : delimiter) to the right
-and left digits (see slipro.lua or simracedlx.lua script)
-
----------------------------------------------
-SetDigitsAllowed(boolean)
-param boolean = true or false
-by default the 6 + 6 SLI-PRO digits or 4 x 4 SIM RACE Deluxe digits are showed but sometime we need to temporarily
-hide them to set our custom information, pass false to this function to hide digits
-and true to show them again
-
----------------------------------------------
-SetKeystroke(keycode, delay, modifier, modifier2)
-param string or integer = the key as a string (see the special keycode table below ) or Microsoft VKey code as integer
-param int = the delay from 50 to 1000 ms
-param modifier = SHIFT or CONTROL or ALT or ""
-param optional modifier2 = SHIFT or CONTROL or ALT or ""
-
-SPECIAL KEYCODE TABLE IN ADDITION TO A...Z CHARS:
- BACKSPACE
- DEL
- INSERT
- PRTSCREEN
- END
- HOME
- SCROLL
- PGDOWN
- PGUP
- PAUSE
- UP
- DOWN
- LEFT
- RIGHT
- F1
- F10
- F11
- F12
- F13
- F14
- F15
- F16
- F2
- F3
- F4
- F5
- F6
- F7
- F8
- F9
- NUMLOCK
- NUMPAD0
- NUMPAD1
- NUMPAD2
- NUMPAD3
- NUMPAD4
- NUMPAD5
- NUMPAD6
- NUMPAD7
- NUMPAD8
- NUMPAD9
- ENTER
- ESC
- TAB
- ARROWUP
- ARROWDOWN
- ARROWLEFT
- ARROWRIGHT
-
-Modifier:
-
-SHIFT
-CONTROL
-ALT
-
------------------------------------------------------------------------------------
-TelemetryTools(selector, value)
-Param "value" boolean activate or deactivate the function
-Param "selector" (string), this string contains the following value:
-"dumplastlap" if it's activated it creates a telemetry log after each lap
-
------------------------------------------------------------------------------------
-SLISleep(ms)
-
------------------------------------------------------------------------------------
-Force sending report (not recommended)
-SLISendReport()
-FanatecSendReport() <<<<< DEPRECATED use SLISendReport()
------------------------------------------------------------------------------------
-SetGlobalBrightness(int)
-
------------------------------------------------------------------------------------
-SetABSBrightLevel(int)
-
------------------------------------------------------------------------------------
-SetTCBrightLevel(int)
-
----------------------------------------------
-SetMaxGear(int)
-param integer = from 4 to 7
-Set the number of gears available
-
----------------------------------------------
-SetDeltaTimeDelay(int)
-param integer = from 0 to 5000
-set interval to update the display for easy reading of time
-the deltatime delay is in ms (1000 = 1s )
-
----------------------------------------------
-result = SetSMXGlobal(globalVarName, stringValue)
-param globalVarName = ref name to global
-param stringValue = value (if you want to store a number convert it to string)
-result return = -2 exceed capacity (20 global max); -1 Error; 0 create new record; 1 update new record
-
----------------------------------------------
-result, stringValue = GetSMXGlobal(globalVarName )
-param globalVarName = ref name to global
-return string in stringValue or empty
-result return = -1 Error; 0 not found; 1 ok
-
----------------------------------------------
-SMXMessageBox(text, title, buttons_style, icon_style)
-param text = message text
-param title (optional) = title of the dialog box
-param buttons_style (optional) = see global.lua or Microsoft MessageBox buttons flags
-param icon_style (optional) = see global.lua or Microsoft MessageBox icon flags
-
-=========================================
-functions to get SLI Manager Information
-=========================================
-
-GetContextInfo("selector")
-GetCarInfo("selector")
-GetTimeInfo("selector")
-GetPartialTimeInfo("selector", index)
-IsSLIFunction("selector", function_index)
-GetDeviceType(deviceID)
-
------------------------------------------------------------------------------------
-GetContextInfo("selector")
-returns contextual info (internal function)
-Param "selector" (string), this string contains the following value:
-
-IMPORTANT ** THESE VALUES ARE NOT AVAILABLE IN ALL SIMULATIONS ** IMPORTANT
-
-"devicelist" return the coma delimited list of current detected devices IDs (included game controllers)
-Reminder regarding device ID: if ID < 40 this is a shiftlight/Digits device; if >=40 this is a game controller
-
-Fanatec additions:
-"bypass" return the state of BYPASS preference (see advanced options panel)
-"fanatecdigitscount" return the number of digits default = 3
-"wheelmotorcount" return the number of wheel motors default = 2
-"cspmotorcount" return the number of Clubsport pedals motors default = 1
-"fanatecwheeltype" return the type of wheel
-"fanatecrimtype" return the type of rim ( BMW = 1; Formula = 2)
-"cspdetected" return true if CSP are present
-"gearshock" return state of GEARSHOCK effect preference (see advanced options panel)
-"gearshockdelay" return the value in ms of GEARSHOCKDELAY preference (see advanced options panel)
-"fanatecdigits" return the current position of digits panel
-"fanatecquickinfo" return the current selected quick-info function
-
-
-"shiftlightsmethod" return current selected method of targeted device
-"ospmethod" return current selected method of targeted device
-"speedlimitermethod" return current selected method of targeted device
-"pitfeedback" return true when car is on pit lane
-"ospcustom" return true if an OSP record to the current car has been found
-"neutral" return ascii code of neutral char (default 'n')
-"reverse" return ascii code of reverse char (default 'r')
-"sessiontype" see here: http://www.eksimracing.com/forum/index.php?topic=891.msg4560#msg4560
-"ticks" return system tick count (int)
-"speedmetric" return display unit true if imperial/MPH and false if metric/KMH
-"simulation" return current simulation name (string) if available
-"paused" return true if simulation is paused if available
-"pluginactive" return 1 if a plugin has been activated
-"pluginready" return true if plugin is ready to send data from simulation
-"devicetype" return current targeted SLI USB device (integer - see also GetDeviceType())
-"tracksize" return current track size (meter) if available
-"lapdistance" return the traveled distance of the car (meter) if available
-"trackame" return current track name if available
-"carname" return current car name if available
-"position" return current car position if available
-"laps" return laps completed (current lap) if available
-"lapscount" return total lap (race) if available
-"partialcount" or "sectorcount" number total of partial time
-"blinktime" blinking delay (default 32)
-"ospblinktime" blinking delay (default 8 )
-"spdlmtrpmledonlyflag" rpm leds only when speedlimiter active? (boolean)
-"noblinkflag" blinking allowed or not? (boolean)
-"limitercharflag" limiter char must be showed? (boolean)
-"ledspeedlimiterindex" return the current speedlimiter index (position) led (default 4 of value from 1 to 6)
-"displaylaptime" lap time need to be showed or not (boolean)
-"quickinfobutton" quick-info button is pressed or not (boolean)
-"quickinfoleft" quick-info left panel index (position) function (integer)
-"quickinforight" quick-info right panel index (position) function (integer)
-"osptracking" osp tracking button activated or not (boolean)
-"ospfactor" current osp factor (float)
-"ospwithfirstgear" osp at first gear allowed (boolean)
-"osplimitrpm" OSP rpm limit, result from my own OSP curve (integer)
-"ospled1" OSP led 1 index (position) (integer)
-"ospled2" OSP led 2 index (position) (integer)
-"yellowflag" return status of flags
-"greenflag"
-"redflag"
-"blueflag"
-"lastgearnorpm" return true if no shiftlights (RPM) on last gear
-"rightdigits" return current position of right panel (int)
-"leftdigits" return current position of left panel (int)
-"globalbrightness" return current global brightness value
-"lowfuel" return low fuel status
-"dumplastlap" return status of telemetry report (true = activated)
-"safetycar" return status of SC (true = ON TRACK ) if available
-
------------------------------------------------------------------------------------
-GetCarInfo("selector")
-returns car info (internal function)
-Param "selector" (string), this string contains the following value:
-
-IMPORTANT ** THESE VALUES ARE NOT AVAILABLE IN ALL SIMULATIONS ** IMPORTANT
-
-"ignition" return the ignition state in rFactor2, 0=off 1=ignition 2=ignition+starter
-"kers" return kers value
-"kers max" return max kers energy
-"drs" return ON or OFF status
-"brakebiais" return current brake biais status
-"rawspeed" return current car speed (meter/sec)
-"speed" return current car speed in kph or mph depending the current display unit (metric or imperial)
-"gear" return current car gear (-1 reverse; 0 = neutral; 1 = gear1,...)
-"maxgear" return the current gear max of engine
-"inpits" car is in pitlane? (integer) 0= on track; 1= pit stall area; 2= Approaching Pits (Pit Road)
-"rpm" return current car rpm (r/mn)
-"redzone" return current max engine rpm
-
-"fuel" return current fuel in tank
-"fuelmax" return the max capacity of fuel tank
-"fuelperlap" return the consumption of fuel during the previous lap, updated after each lap
-"averagefuelperlap" return the average of consumption of fuel during a lap
-"remainlapsintank" get an average consumption of fuel per lap and return the remaining laps
-"fuelatstart" return the fuel in tank at the beginning of each lap
-
-"watertemp" return water engine temp (celsius)
-"oiltemp" return oil engine temp (celsius)
-"sector" return current sector (integer)
-"abs" return abs level (integer)
-"tractioncontrol" return TC level (integer)
-"speedlimiter" return spd lmt status (integer)
-"headlights"
-"overheating"
-"detachedparts" return true if car is damaged
-
-"wheeltempfrontleft", return front left average temp (celsius)
-"wheeltempfrontright", return front right average temp (celsius)
-"wheeltemprearleft", return rear left average temp (celsius)
-"wheeltemprearright", return rear right average temp (celsius)
-
-"wheelpressfrontleft", return front left average pressure (kpa)
-"wheelpressfrontright", return front right average pressure (kpa)
-"wheelpressrearleft", return rear left average pressure (kpa)
-"wheelpressrearright", return rear right pressure (kpa)
-
-"braketempfrontleft", return front left temp (celsius)
-"braketempfrontright", return front right temp (celsius)
-"braketemprearleft", return rear left temp (celsius)
-"braketemprearright", return rear right temp (celsius)
-
------------------------------------------------------------------------------------
-GetTimeInfo("selector")
-returns time info (internal function)
-Param "selector" (string), this string contains the following value:
-return float value
-
-IMPORTANT ** THESE VALUES ARE NOT AVAILABLE IN ALL SIMULATIONS ** IMPORTANT
-
-"laptime" return current lap time if available
-"bestlaptime" return best lap time if available
-"lastlaptime" return last lap time if available
-"realdifftimeready" return true when telemetry data of at least one lap has been collected if available
-"realdiffbest" return real-time diff (delta) vs best if available
-"realdifflast" return real-time diff (delta) vs last if available
-"sector1" return current sector 1 if available
-"sector2" return current sector 2 if available
-"bestsector1" return best sector 1 if available
-"bestsector2" return best sector 2 if available
-"lastsector1" return last sector 1 if available
-"lastsector2" return last sector 2 if available
-"timeremaining" return session time remaining if available
-"systemtime" return current PC time if available
-
------------------------------------------------------------------------------------
-GetPartialTimeInfo("selector", index)
-returns partial time info
-(internal function)
-Param index (number) contains the targeted sector
-Param "selector" (string), contains the following value:
-return float value
-see GetContextInfo() to get the total number of partials
-
-IMPORTANT ** THESE VALUES ARE NOT AVAILABLE IN ALL SIMULATIONS ** IMPORTANT
-
-"currentpartial" return current partial time if available
-"vsbestlap" return best partial time of this sector if available
-"vsoptimallap" return optimal partial time of this sector if available
-"vssessionbestlap" return session best partial time of this sector
-"vsoptimalsector" return session optimal partial time of this sector
-"vssessionoptimallap" return diff from session optimal if available
-"vssessionoptimalsector" return diff from optimal if available
-
------------------------------------------------------------------------------------
-IsSLIFunction("selector", function_index)
-returns boolean
-(internal function)
-return boolean value, true if function name matches the function index
-Param index (number) contains the targeted function index returned by controlsEvent()
-Param "selector" (string), contains the following value:
-see controls.lua scripts for more info.
-
-"fanatecdigits"
-"brightness"
-"quickinfo"
-"speedmetric"
-"lastgearnorpm"
-"osptracking"
-"safeprefs"
-"laptimedelay"
-"blinktime"
-"lowfuel"
-"speedlimitermethod"
-"shiftlights"
-"ospmethod"
-"rightdigits"
-"leftdigits"
-"ospfactor"
-"drivingsetup"
-"maxgear"
-
------------------------------------------------------------------------------------
-GetDeviceType(deviceID)
-returns the corresponding name of device ID
-Param deviceID (integer)
-return string value
-
------------------------------------------------------------------------------------
-GetLedIndex("selector")
-returns the corresponding index of the led
-Param led function (string) see the list below
-return integer value
-
-"speedlimiter"
-"osp1"
-"osp2"
-"lowfuel"
-"tractioncontrol"
-"abs"
-"greenflag"
-"yellowflag"
-"redflag"
-"overheating"
-"damage"
-"pitrequest"
-"power"
-"revlimit"
-"headlights"
-"blueflag"
-"drs"
-"safeprefs"
-"drslegal"
-
-===============================
- Script Developpment
- globals and utilities
-===============================
-
-Script Warriors do not reinvent the wheel and keep your script clean, optimized and obviously reuse the standard behaviors if possible ... ;)
-
--------------
- GLOBALS
--------------
-- A great optimization of OSP and Shiftlights scripts with 2 new globals has been added.
-gOSPLimit = limit/treshold computed by SLIMax Manager, the default value is set in gear.lua script. This value can be overwritten in your custom script, this way it lets you run the std OSP function (osp.lua) but with your own OSP curve. each gear of each car can have its own values.
-
-gRedZone = the default value is set in gear.lua script. This value can be overwritten in your custom script, this way it let's you run the std Shiftlights function but with your own red zone value. each gear of each car can have its own values.
-
-mLeftSpdLmtText and mRightSpdLmtText contains the default text for left and right digits panel in speedlimiter method 4 and 5 and can be "patched" (replaced with your own text) in custom_spdLmtMethodEvent() function (see custom_scripts.lua file)
-
-mOSPMethod to overwrite the method value, useful in custom_ospMethodEvent() function to patch the current OSP method with another one
-mOSPBU0710Method same as above for BU0710
-mOSPG27Method same as above for G27
-mOSPFanatecMethod same as above for Fanatec
-mOSPSRDlxMethod same as above for SIM RACE Deluxe
-mOSPSRF1Method same as above for SIM RACE F1
-
-mSpdLimitMethod to overwrite the method value, useful in custom_spdLmtMethodEvent() function to patch the current PIT LIMITER method with another one
-mSpdLimitG27Method same as above for G27
-mSpdLimitFanatecMethod same as above for Fanatec
-mSpdLimitSRDlxMethod same as above for SIM RACE Deluxe
-mSpdLimitSRF1Method same as above for SIM RACE F1
-
-mShiftlightsMethodIndex to overwrite the method value, useful in custom_shiftlightsMethodEvent() function to patch the current shiftlights method with another one
-mShiftlightsBU0710MethodIndex same as above for BU0710
-mShiftlightsG27MethodIndex same as above for G27
-mShiftlightsFanatecMethodIndex same as above for Fanatec
-mShiftlightsSRDlxMethodIndex same as above for SIM RACE Deluxe
-mShiftlightsSRF1MethodIndex same as above for SIM RACE F1
-
-oldGear is useful in custom_gearFanatecEvent() function to patch the current gear value
-
------------------------
- SHIFTLIGHTS UTILITIES
------------------------
-shiftlights utilities functions in SLIMax Mananger script API
-(see shiftlights.lua for example and usage)
-
---------------------------------------------------------
-shiftlights utilities functions for Fanatec
---------------------------------------------------------
--- shiftlights method from side to center
-function SideToCenterFanatec(rpm, redzone, p1, p2, p3, p4 ,p5 )
-
--- progressive method
-function ProgressiveFanatec(rpm, redzone, p1, p2, p3, p4, p5, p6, p7, p8, p9 )
-
--- alternate yellow, red and blue method
-function AlternateFanatec(rpm, redzone, step1, step2, step3)
-
--- percentage method
-function percentageFanatec(rpm, redzone, p1, p2, p3, p4, p5, p6, p7, p8, p9 )
-
--- fixed rpm method, set rpm for each led (NOT RECOMMENDED)
-function RpmFanatec(rpm, p1, p2, p3, p4, p5, p6, p7, p8, p9 )
-
---------------------------------------------------------
-shiftlights utilities functions for SLI-M and SLI-PRO
---------------------------------------------------------
--- shiftlights method from side to center
-function SideToCenterSLI(rpm, redzone, p1, p2, p3, p4 ,p5 ,p6 ,p7)
-
--- progressive method
-function ProgressiveSLI(rpm, redzone, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13 )
-
--- alternate green, red and blue method
-function AlternateSLI(rpm, redzone, step1, step2, step3)
-
--- percentage method
-function percentageSLI(rpm, redzone, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13 )
-
--- fixed rpm method, set rpm for each led (NOT RECOMMENDED)
-function RpmSLI(rpm, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13 )
-
--- progressive method but with rpm value for eah led (NOT RECOMMENDED)
-function ProgressiveFixedSLI(rpm, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13)
-
---------------------------------------------------------
-shiftlights utilities functions for BU0710
---------------------------------------------------------
--- progressive method for BU0710
-function ProgressiveBU0710(rpm, redzone, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11 )
-
--- percentage method for BU0710
-function percentageBU0710(rpm, redzone, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11 )
-
--- fixed rpm method for BU0710 (NOT RECOMMENDED)
-function RpmSLI(rpm, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11 )
-
---------------------------------------------------------
-shiftlights utilities functions for Logitech G27
---------------------------------------------------------
--- progressive method for G27
-function ProgressiveG27(rpm, redzone, p1, p2, p3, p4, p5)
-
--- percentage method for G27
-function PercentageG27(rpm, redzone, p1, p2, p3, p4, p5)
-
--- fixed rpm method for G27 (NOT RECOMMENDED)
-function RpmG27(rpm, p1, p2, p3, p4, p5 )
-
---------------------------------------------------------
--- KERS functions
-function GetKersPercent()
-
---------------------------------------------------------
-LEFT and RIGHT Functions utilities for SLI-M and SLI-PRO
---------------------------------------------------------
-
--- add a function name to left and right functions list
--- typical usage FuncAddName(path, func):
--- on left list:
--- local err = FuncAddName("cfg/sli_left_functions.ecfg", "100.DSII KERS")
--- or right list:
--- local err = FuncAddName("cfg/sli_right_functions.ecfg", "100.DSII KERS")
--- return 1 if ok
--- local err = FuncAddName("cfg/fanatec_digits_functions.ecfg", "100.DSII KERS")
--- return 1 if ok
-
-
--- same as above for removing the function name
--- typical usage RemoveFuncName(path, func)
--- return 1 if ok
-
--- get the index of function
--- typical usage: local idx = FuncGetPrefixIndex("100.DSII KERS")
--- return value > 0 if ok
-
--- get next function index available
--- typical usage FuncGetNewIndex(path):
--- on left list:
--- 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 )
--- or fanatec list:
--- local num_available = FuncGetNewIndex("cfg/fanatec_digits_functions.ecfg")
--- return value >=100 (0 to 99 are reserved )
-
---------------------------------------------------------
-functions utilities in global.lua
---------------------------------------------------------
-
--- return KERS value in percent
-function GetKersPercent()
-
--- Init all globals
-function InitGlobals()
-
--- set RPM threshold value in percentage ( SLIMax Manager 2.1 )
-function SetRPMPercentValue(index, value)
-
--- set RPM threshold value ( SLIMax Manager 2.1 )
-function SetRPMAbsoluteValue(index, value)
-
--- get all global preferences set in general_default.sli
-function GetSLIMaxInfo()
-
--- get cpu ticks
-function GetTicks()
-
--- reset table function
-function initLedTable(ibl, value)
-
--- toggle all led state
-function toggleAllLed(val)
-
--- The following function rounds a number
--- lua doesn't return the same rounded value as C/C++
-function round(num)
-
--- The following function calculate hr, mn, sec, hd, ms
--- param: time in meter/sec
-function timeDispatcher( tt)
-
--- return speed in KPH or MPH
-function speed(spd, selector)
-
--- Fahrenheit to Celsius
-function FtoC(f)
-
--- Celsius to Fahrenheit
-function CtoF(c)
-
--- Kelvin to Celsius
-function KtoC(k)
-
--- liters to gallons
-function LtoG(liters)
-
--- gallons to liters
-function GtoL(gallons)
-
--- return fuel in liters or gallons
-function GetFuel(fl, selector)
-
--- return celcius or fahrenheit
-function GetTemp(tmp, selector)
-
--- set delta time delay in ms
-function SetDeltaTimeDelay(delay) \ No newline at end of file
+SLIMax Manager III 3.3.3 Scripting Information - PART OF SLIMax Manager pkg
+Copyright (c)2011-2013 by EK & Zappadoc - All Rights Reserved.
+updated 2013-11 by Zappadoc
+
+** ALL INFORMATION BELOW ARE SUBJECT TO CHANGE WITHOUT NOTICE **
+
+Go to scripting forum support to get the latest information about SLIMax Manager API:
+http://www.eksimracing.com/forum
+
+=================================
+Script Engine based on Lua 5.1.4
+
+License for Lua 5.1.4 and later versions
+Copyright © 1994–2011 Lua.org, PUC-Rio.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+=================================
+Lua website
+http://www.lua.org/
+
+Reference manual (v5.1):
+http://www.lua.org/manual/5.1/
+
+
+====================================
+Events received from SLIMax Manager
+====================================
+
+function custom_initEvent(scriptFile)
+param = custom script file name
+Notes: this event is triggered at startup or when loading your custom script,
+this is the good opportunity to init your preferences and global vars
+
+All event functions below must return 1 if the event has been fully managed or
+2 to skip and give control to SLIMax Mgr
+
+---------------------------------------------
+GLOBAL EVENTS (ALL DEVICES)
+---------------------------------------------
+function controlsEvent(deviceType, ctrlType, ctrlPos, value, funcIndex, targetDevice) and custom_controlsEvent
+params = see the control.lua script
+Devices supported: global event
+Notes: Controls Event, Manage buttons and switches. (see controls.lua script)
+
+---------------------------------------------
+function deviceReport(deviceType) and custom_deviceReport
+param = the current targeted device (BU0710, SLI-M, SLI-PRO, SIM RACE Deluxe, SIM RACE F1, Fanatec Wheels and Logitech G27 leds and emulators SLI-EMU and SRF1-EMU)
+Devices supported: global event
+Notes: This function is called periodically and outputs the previously processed data to the device when it returns
+back to the manager, if needed, patch any previous function here to
+display additional info or to change everything. (see devhook.lua script)
+
+---------------------------------------------
+function enterSessionEvent(deviceType) and custom_enterSessionEvent
+param = current device (BU0710, SLI-M, SLI-PRO, SIM RACE Deluxe, SIM RACE F1, Fanatec Wheels and Logitech G27 leds and emulators SLI-EMU and SRF1-EMU)
+Notes: Triggered when the session starts
+(see enter_exit_session.lua script)
+
+---------------------------------------------
+function exitSessionEvent(deviceType) and custom_exitSessionEvent
+param = current device (BU0710, SLI-M, SLI-PRO, SIM RACE Deluxe, SIM RACE F1, Fanatec Wheels and Logitech G27 leds and emulators SLI-EMU and SRF1-EMU)
+Devices supported: global event
+Notes: Triggered when the session ends
+(see enter_exit_session.lua script)
+
+---------------------------------------------
+LOCAL EVENTS (SPECIFIC TO DEVICES)
+---------------------------------------------
+function shiftLightsMethodEvent(idx) and custom_shiftLightsMethodEvent
+function shiftLightsBU0710Event(idx) and custom_shiftLightsBU0710Event
+function shiftLightsFanatecMethodEvent(idx) and custom_shiftLightsFanatecMethodEvent
+function shiftLightsG27LedsMethodEvent(idx) and custom_shiftLightsG27LedsMethodEvent
+function shiftLightsSRDlxMethodEvent(idx) and custom_shiftLightsSRDlxMethodEvent
+function shiftLightsSRF1MethodEvent(idx) and custom_shiftLightsSRF1MethodEvent
+param = current method index
+Devices supported: BU0710, SLI-M, SLI-PRO, SIM RACE Deluxe, SIM RACE F1, Fanatec Wheels and Logitech G27 leds and emulators SLI-EMU and SRF1-EMU
+Notes: shiftlights method event, computes all shiftlights methods
+(see shiftlights.lua script)
+
+---------------------------------------------
+function ospMethodEvent(idx) and custom_ospMethodEvent
+function ospSRDlxMethodEvent(idx) and custom_ospSRDlxMethodEvent
+function ospSRF1MethodEvent(idx) and custom_ospSRF1MethodEvent
+function ospFanatecMethodEvent(idx) and custom_ospFanatecMethodEvent
+function ospG27LedsMethodEvent(idx) and custom_ospG27LedsMethodEvent
+param = current method index
+Devices supported: BU0710, SLI-M, SLI-PRO, SIM RACE Deluxe, SIM RACE F1, Fanatec Wheels and Logitech G27 leds and emulators SLI-EMU and SRF1-EMU
+Notes: OSP method event, computes all Optimal Shift-Points methods
+(see osp.lua script)
+
+---------------------------------------------
+function spdLmtMethodEvent(idx) and custom_spdLmtMethodEvent
+function spdLmtSRDlxMethodEvent(idx) and custom_spdLmtSRDlxMethodEvent
+function spdLmtSRF1MethodEvent(idx) and custom_spdLmtSRF1MethodEvent
+function spdLmtFanatecMethodEvent(idx) and custom_spdLmtFanatecMethodEvent
+function spdLmtG27MethodEvent(idx) and custom_spdLmtG27MethodEvent
+param = current method index
+Devices supported: BU0710, SLI-M, SLI-PRO, SIM RACE Deluxe, SIM RACE F1, Fanatec Wheels and Logitech G27 leds and emulators SLI-EMU and SRF1-EMU
+Notes: speedlimiter method event, computes all speedlimiter methods
+(see speedlimiter.lua script)
+
+---------------------------------------------
+function leftDigitsEvent(swPosition) and custom_leftDigitsEvent
+function rightDigitsEvent(swPosition) and custom_rightDigitsEvent
+function srdlxLeftDigitsEvent(swPosition) and custom_srdlxLeftDigitsEvent
+function srdlxRightDigitsEvent(swPosition) and custom_srdlxRightDigitsEvent
+function srf1LeftDigitsEvent(swPosition) and custom_srf1LeftDigitsEvent
+function srf1RightDigitsEvent(swPosition) and custom_srf1RightDigitsEvent
+function fanatecDigitsEvent(swPosition) and custom_fanatecDigitsEvent
+param = switch position
+Devices supported: SLI-PRO, SIM RACE Deluxe, SIM RACE F1 and Fanatec Wheels and emulators SLI-EMU and SRF1-EMU
+
+Notes: computes data to be displayed on digits panel of the device
+(see scripts: slipro.lua, simracedlx.lua, simracef1.lua and fanatec.lua)
+
+---------------------------------------------
+function gearEvent(gear) and custom_gearEvent
+function gearFanatecEvent(gear) and custom_gearFanatecEvent
+Devices supported: SLI Boards series and Fanatec Wheels
+param = current seleted gear ( -1 = reverse, 0 = neutral, 1 ... 7)
+Notes: gear event, show the current selected gear on central digit
+(see gear.lua script)
+
+---------------------------------------------
+function ledEvent(idx, ledFunction, state) and custom_ledEvent
+param = index of the led, std state of the led and corresponding function
+1=LowFuel
+2=TC
+3=ABS
+4=Green Flag
+5=Yellow flag
+6=Red Flag
+7=Over Heating
+8=Damage
+9=Pit request
+10=Power
+11=Rev Limit
+12=HeadLights
+13=Blue Flag
+14=DRS
+15=Safe Prefs
+
+Devices supported: SLI Boards series only
+Notes: patch std led behaviors (i.e. tc, abs, lowfuel,
+ dammage, rev limit, drs, pit request, flags, ... )
+IMPORTANT: your script must be optimized as the function is
+called several time by second to report all activated leds
+(see led.lua script)
+
+-----------------------------------------------
+All functions starting with custom_ can created
+to change std behaviors and can be associated
+with your custom settings.
+(see COMBO SETUP in forum)
+-----------------------------------------------
+
+
+============================================
+functions to change SLIMax Manager information
+============================================
+
+---------------------------------------------
+Fanatec additions:
+---------------------------------------------
+SetFanatecDigitsAllowed(boolean)
+param boolean = true or false
+by default the 3 digits are showed but sometime we need to temporarily
+hide them to set our custom information, pass false to this function to hide digits
+and true to show them again
+
+---------------------------------------------
+SetFanatecDigits(string)
+param string = 3 chars string + dots
+Set the alpha-numerical text (including the . delimiter) to the digits panel (see fanatec.lua script)
+
+---------------------------------------------
+SetFanatecOneDigit(digit,a,b,c,d,e,f,g,dot)
+param digit = from 0 to 2
+param a,b,c,d,e,f,g = false or true
+param dot = false or true
+Set the 7 segments + dot of each digit
+
+---------------------------------------------
+SetFanatecCspMotor(power,delay)
+param power: from 0 to 100
+param delay: from 0 to 1000 ms (1sec max)
+
+SetFanatecWheelMotor(motor,power,delay)
+param motor = 0 or 1 (left or right motor )
+param power: from 0 to 100
+param delay: from 0 to 1000 ms (1sec max)
+
+SetFanatecLed(string table) <<<<< DEPRECATED use SetRPMLed()
+param string = name of lua table (default mRPMLedTable)
+set RPM led of Fanatec rim ( see shiftlights.lua script)
+
+SetFanatecGear(gear) <<<<< DEPRECATED use SetGearDigits()
+param string = one char string (i.e. "r" or "n" or "1" ... )
+set the gear value in center of the Fanatec digits panel (see fanatec.lua script)
+
+---------------------------------------------
+Logitech Additions:
+---------------------------------------------
+SetG27Led(int)
+param integer = number, each bit represent one led from 0 to 0x1F
+set leds of G27 device ( see shiftlights.lua script)
+
+---------------------------------------------
+SetBU0710Led(int)
+param integer = number from 0 to 10
+set leds of BU0710 device ( see shiftlights.lua script)
+
+---------------------------------------------
+SetGeadDigit(string)
+param string = one char string (i.e. "r" or "n" or "1")
+set gear digit of current targeted SLI device ( see gear.lua script)
+
+---------------------------------------------
+SetRPMLed(string)
+param string = name of lua table (default mRPMLedTable)
+set RPM led of current targeted SLI device, SLI-M or SLI-PRO or SIM RACE Deluxe ( see shiftlights.lua script)
+
+---------------------------------------------
+SetWarnLed(idx, val)
+param integer = index of led from 1 to 6
+param integer = value 1 or 0
+set the 6 extra leds of current targeted SLI device (SLI-M or SLI-PRO or SIM RACE Deluxe)
+
+---------------------------------------------
+SetExtLed(idx, val)
+param integer = index of led from 1 to 5
+param integer = value 1 or 0
+set the 5 external leds of current targeted SLI device (SLI-M or SLI-PRO or SIM RACE Deluxe)
+
+---------------------------------------------
+SetOSPStatus(boolean)
+param boolean = true or false
+in Optimal ShiftPoints (OSP) Methods compute your own OSP curve and set
+the corresponding OSP state with this function (true or false - see osp.lua script)
+
+---------------------------------------------
+========== SLI-PRO or SIM RACE Deluxe DIGITS PANELs ==========
+SetRightDigits(string)
+SetLeftDigits(string)
+param string = 6 chars string + delimiter
+set the alpha-numerical text (including the . and : delimiter) to the right
+and left digits (see slipro.lua or simracedlx.lua script)
+
+---------------------------------------------
+SetDigitsAllowed(boolean)
+param boolean = true or false
+by default the 6 + 6 SLI-PRO digits or 4 x 4 SIM RACE Deluxe digits are showed but sometime we need to temporarily
+hide them to set our custom information, pass false to this function to hide digits
+and true to show them again
+
+---------------------------------------------
+SetKeystroke(keycode, delay, modifier, modifier2)
+param string or integer = the key as a string (see the special keycode table below ) or Microsoft VKey code as integer
+param int = the delay from 50 to 1000 ms
+param modifier = SHIFT or CONTROL or ALT or ""
+param optional modifier2 = SHIFT or CONTROL or ALT or ""
+
+SPECIAL KEYCODE TABLE IN ADDITION TO A...Z CHARS:
+ BACKSPACE
+ DEL
+ INSERT
+ PRTSCREEN
+ END
+ HOME
+ SCROLL
+ PGDOWN
+ PGUP
+ PAUSE
+ UP
+ DOWN
+ LEFT
+ RIGHT
+ F1
+ F10
+ F11
+ F12
+ F13
+ F14
+ F15
+ F16
+ F2
+ F3
+ F4
+ F5
+ F6
+ F7
+ F8
+ F9
+ NUMLOCK
+ NUMPAD0
+ NUMPAD1
+ NUMPAD2
+ NUMPAD3
+ NUMPAD4
+ NUMPAD5
+ NUMPAD6
+ NUMPAD7
+ NUMPAD8
+ NUMPAD9
+ ENTER
+ ESC
+ TAB
+ ARROWUP
+ ARROWDOWN
+ ARROWLEFT
+ ARROWRIGHT
+
+Modifier:
+
+SHIFT
+CONTROL
+ALT
+
+-----------------------------------------------------------------------------------
+TelemetryTools(selector, value)
+Param "value" boolean activate or deactivate the function
+Param "selector" (string), this string contains the following value:
+"dumplastlap" if it's activated it creates a telemetry log after each lap
+
+-----------------------------------------------------------------------------------
+SLISleep(ms)
+
+-----------------------------------------------------------------------------------
+Force sending report (not recommended)
+SLISendReport()
+FanatecSendReport() <<<<< DEPRECATED use SLISendReport()
+-----------------------------------------------------------------------------------
+SetGlobalBrightness(int)
+
+-----------------------------------------------------------------------------------
+SetABSBrightLevel(int)
+
+-----------------------------------------------------------------------------------
+SetTCBrightLevel(int)
+
+---------------------------------------------
+SetMaxGear(int)
+param integer = from 4 to 7
+Set the number of gears available
+
+---------------------------------------------
+SetDeltaTimeDelay(int)
+param integer = from 0 to 5000
+set interval to update the display for easy reading of time
+the deltatime delay is in ms (1000 = 1s )
+
+---------------------------------------------
+result = SetSMXGlobal(globalVarName, stringValue)
+param globalVarName = ref name to global
+param stringValue = value (if you want to store a number convert it to string)
+result return = -2 exceed capacity (20 global max); -1 Error; 0 create new record; 1 update new record
+
+---------------------------------------------
+result, stringValue = GetSMXGlobal(globalVarName )
+param globalVarName = ref name to global
+return string in stringValue or empty
+result return = -1 Error; 0 not found; 1 ok
+
+---------------------------------------------
+SMXMessageBox(text, title, buttons_style, icon_style)
+param text = message text
+param title (optional) = title of the dialog box
+param buttons_style (optional) = see global.lua or Microsoft MessageBox buttons flags
+param icon_style (optional) = see global.lua or Microsoft MessageBox icon flags
+
+=========================================
+functions to get SLI Manager Information
+=========================================
+
+GetContextInfo("selector")
+GetCarInfo("selector")
+GetTimeInfo("selector")
+GetPartialTimeInfo("selector", index)
+IsSLIFunction("selector", function_index)
+GetDeviceType(deviceID)
+
+-----------------------------------------------------------------------------------
+GetContextInfo("selector")
+returns contextual info (internal function)
+Param "selector" (string), this string contains the following value:
+
+IMPORTANT ** THESE VALUES ARE NOT AVAILABLE IN ALL SIMULATIONS ** IMPORTANT
+
+"devicelist" return the coma delimited list of current detected devices IDs (included game controllers)
+Reminder regarding device ID: if ID < 40 this is a shiftlight/Digits device; if >=40 this is a game controller
+
+Fanatec additions:
+"bypass" return the state of BYPASS preference (see advanced options panel)
+"fanatecdigitscount" return the number of digits default = 3
+"wheelmotorcount" return the number of wheel motors default = 2
+"cspmotorcount" return the number of Clubsport pedals motors default = 1
+"fanatecwheeltype" return the type of wheel
+"fanatecrimtype" return the type of rim ( BMW = 1; Formula = 2)
+"cspdetected" return true if CSP are present
+"gearshock" return state of GEARSHOCK effect preference (see advanced options panel)
+"gearshockdelay" return the value in ms of GEARSHOCKDELAY preference (see advanced options panel)
+"fanatecdigits" return the current position of digits panel
+"fanatecquickinfo" return the current selected quick-info function
+
+
+"shiftlightsmethod" return current selected method of targeted device
+"ospmethod" return current selected method of targeted device
+"speedlimitermethod" return current selected method of targeted device
+"pitfeedback" return true when car is on pit lane
+"ospcustom" return true if an OSP record to the current car has been found
+"neutral" return ascii code of neutral char (default 'n')
+"reverse" return ascii code of reverse char (default 'r')
+"sessiontype" see here: http://www.eksimracing.com/forum/index.php?topic=891.msg4560#msg4560
+"ticks" return system tick count (int)
+"speedmetric" return display unit true if imperial/MPH and false if metric/KMH
+"simulation" return current simulation name (string) if available
+"paused" return true if simulation is paused if available
+"pluginactive" return 1 if a plugin has been activated
+"pluginready" return true if plugin is ready to send data from simulation
+"devicetype" return current targeted SLI USB device (integer - see also GetDeviceType())
+"tracksize" return current track size (meter) if available
+"lapdistance" return the traveled distance of the car (meter) if available
+"trackame" return current track name if available
+"carname" return current car name if available
+"position" return current car position if available
+"laps" return laps completed (current lap) if available
+"lapscount" return total lap (race) if available
+"partialcount" or "sectorcount" number total of partial time
+"blinktime" blinking delay (default 32)
+"ospblinktime" blinking delay (default 8 )
+"spdlmtrpmledonlyflag" rpm leds only when speedlimiter active? (boolean)
+"noblinkflag" blinking allowed or not? (boolean)
+"limitercharflag" limiter char must be showed? (boolean)
+"ledspeedlimiterindex" return the current speedlimiter index (position) led (default 4 of value from 1 to 6)
+"displaylaptime" lap time need to be showed or not (boolean)
+"quickinfobutton" quick-info button is pressed or not (boolean)
+"quickinfoleft" quick-info left panel index (position) function (integer)
+"quickinforight" quick-info right panel index (position) function (integer)
+"osptracking" osp tracking button activated or not (boolean)
+"ospfactor" current osp factor (float)
+"ospwithfirstgear" osp at first gear allowed (boolean)
+"osplimitrpm" OSP rpm limit, result from my own OSP curve (integer)
+"ospled1" OSP led 1 index (position) (integer)
+"ospled2" OSP led 2 index (position) (integer)
+"yellowflag" return status of flags
+"greenflag"
+"redflag"
+"blueflag"
+"lastgearnorpm" return true if no shiftlights (RPM) on last gear
+"rightdigits" return current position of right panel (int)
+"leftdigits" return current position of left panel (int)
+"globalbrightness" return current global brightness value
+"lowfuel" return low fuel status
+"dumplastlap" return status of telemetry report (true = activated)
+"safetycar" return status of SC (true = ON TRACK ) if available
+
+-----------------------------------------------------------------------------------
+GetCarInfo("selector")
+returns car info (internal function)
+Param "selector" (string), this string contains the following value:
+
+IMPORTANT ** THESE VALUES ARE NOT AVAILABLE IN ALL SIMULATIONS ** IMPORTANT
+
+"ignition" return the ignition state in rFactor2, 0=off 1=ignition 2=ignition+starter
+"kers" return kers value
+"kers max" return max kers energy
+"drs" return ON or OFF status
+"brakebiais" return current brake biais status
+"rawspeed" return current car speed (meter/sec)
+"speed" return current car speed in kph or mph depending the current display unit (metric or imperial)
+"gear" return current car gear (-1 reverse; 0 = neutral; 1 = gear1,...)
+"maxgear" return the current gear max of engine
+"inpits" car is in pitlane? (integer) 0= on track; 1= pit stall area; 2= Approaching Pits (Pit Road)
+"rpm" return current car rpm (r/mn)
+"redzone" return current max engine rpm
+
+"fuel" return current fuel in tank
+"fuelmax" return the max capacity of fuel tank
+"fuelperlap" return the consumption of fuel during the previous lap, updated after each lap
+"averagefuelperlap" return the average of consumption of fuel during a lap
+"remainlapsintank" get an average consumption of fuel per lap and return the remaining laps
+"fuelatstart" return the fuel in tank at the beginning of each lap
+
+"watertemp" return water engine temp (celsius)
+"oiltemp" return oil engine temp (celsius)
+"sector" return current sector (integer)
+"abs" return abs level (integer)
+"tractioncontrol" return TC level (integer)
+"speedlimiter" return spd lmt status (integer)
+"headlights"
+"overheating"
+"detachedparts" return true if car is damaged
+
+"wheeltempfrontleft", return front left average temp (celsius)
+"wheeltempfrontright", return front right average temp (celsius)
+"wheeltemprearleft", return rear left average temp (celsius)
+"wheeltemprearright", return rear right average temp (celsius)
+
+"wheelpressfrontleft", return front left average pressure (kpa)
+"wheelpressfrontright", return front right average pressure (kpa)
+"wheelpressrearleft", return rear left average pressure (kpa)
+"wheelpressrearright", return rear right pressure (kpa)
+
+"braketempfrontleft", return front left temp (celsius)
+"braketempfrontright", return front right temp (celsius)
+"braketemprearleft", return rear left temp (celsius)
+"braketemprearright", return rear right temp (celsius)
+
+-----------------------------------------------------------------------------------
+GetTimeInfo("selector")
+returns time info (internal function)
+Param "selector" (string), this string contains the following value:
+return float value
+
+IMPORTANT ** THESE VALUES ARE NOT AVAILABLE IN ALL SIMULATIONS ** IMPORTANT
+
+"laptime" return current lap time if available
+"bestlaptime" return best lap time if available
+"lastlaptime" return last lap time if available
+"realdifftimeready" return true when telemetry data of at least one lap has been collected if available
+"realdiffbest" return real-time diff (delta) vs best if available
+"realdifflast" return real-time diff (delta) vs last if available
+"sector1" return current sector 1 if available
+"sector2" return current sector 2 if available
+"sector3" return current sector 2 if available
+"bestsector1" return best sector 1 if available
+"bestsector2" return best sector 2 if available
+"bestsector3" return best sector 2 if available
+"lastsector1" return last sector 1 if available
+"lastsector2" return last sector 2 if available
+"lastsector3" return last sector 2 if available
+"timeremaining" return session time remaining if available
+"systemtime" return current PC time if available
+
+-----------------------------------------------------------------------------------
+GetPartialTimeInfo("selector", index)
+returns partial time info of iRacing Simulation
+(internal function)
+Param index (number) contains the targeted sector
+Param "selector" (string), contains the following value:
+return float value
+see GetContextInfo() to get the total number of partials
+
+IMPORTANT ** THESE VALUES ARE AVAILABLE ONLY IN IRACING SIMULATIONS ** IMPORTANT
+
+"currentpartial" return current partial time if available
+"vsbestlap" return best partial time of this sector if available
+"vsoptimallap" return optimal partial time of this sector if available
+"vssessionbestlap" return session best partial time of this sector
+"vsoptimalsector" return session optimal partial time of this sector
+"vssessionoptimallap" return diff from session optimal if available
+"vssessionoptimalsector" return diff from optimal if available
+
+-----------------------------------------------------------------------------------
+IsSLIFunction("selector", function_index)
+returns boolean
+(internal function)
+return boolean value, true if function name matches the function index
+Param index (number) contains the targeted function index returned by controlsEvent()
+Param "selector" (string), contains the following value:
+see controls.lua scripts for more info.
+
+"fanatecdigits"
+"brightness"
+"quickinfo"
+"speedmetric"
+"lastgearnorpm"
+"osptracking"
+"safeprefs"
+"laptimedelay"
+"blinktime"
+"lowfuel"
+"speedlimitermethod"
+"shiftlights"
+"ospmethod"
+"rightdigits"
+"leftdigits"
+"ospfactor"
+"drivingsetup"
+"maxgear"
+
+-----------------------------------------------------------------------------------
+GetDeviceType(deviceID)
+returns the corresponding name of device ID
+Param deviceID (integer)
+return string value
+
+-----------------------------------------------------------------------------------
+GetLedIndex("selector")
+returns the corresponding index of the led
+Param led function (string) see the list below
+return integer value
+
+"speedlimiter"
+"osp1"
+"osp2"
+"lowfuel"
+"tractioncontrol"
+"abs"
+"greenflag"
+"yellowflag"
+"redflag"
+"overheating"
+"damage"
+"pitrequest"
+"power"
+"revlimit"
+"headlights"
+"blueflag"
+"drs"
+"safeprefs"
+"drslegal"
+
+===============================
+ Script Developpment
+ globals and utilities
+===============================
+
+Script Warriors do not reinvent the wheel and keep your script clean, optimized and obviously reuse the standard behaviors if possible ... ;)
+
+-------------
+ GLOBALS
+-------------
+- A great optimization of OSP and Shiftlights scripts with 2 new globals has been added.
+gOSPLimit = limit/treshold computed by SLIMax Manager, the default value is set in gear.lua script. This value can be overwritten in your custom script, this way it lets you run the std OSP function (osp.lua) but with your own OSP curve. each gear of each car can have its own values.
+
+gRedZone = the default value is set in gear.lua script. This value can be overwritten in your custom script, this way it let's you run the std Shiftlights function but with your own red zone value. each gear of each car can have its own values.
+
+mLeftSpdLmtText and mRightSpdLmtText contains the default text for left and right digits panel in speedlimiter method 4 and 5 and can be "patched" (replaced with your own text) in custom_spdLmtMethodEvent() function (see custom_scripts.lua file)
+
+mOSPMethod to overwrite the method value, useful in custom_ospMethodEvent() function to patch the current OSP method with another one
+mOSPBU0710Method same as above for BU0710
+mOSPG27Method same as above for G27
+mOSPFanatecMethod same as above for Fanatec
+mOSPSRDlxMethod same as above for SIM RACE Deluxe
+mOSPSRF1Method same as above for SIM RACE F1
+
+mSpdLimitMethod to overwrite the method value, useful in custom_spdLmtMethodEvent() function to patch the current PIT LIMITER method with another one
+mSpdLimitG27Method same as above for G27
+mSpdLimitFanatecMethod same as above for Fanatec
+mSpdLimitSRDlxMethod same as above for SIM RACE Deluxe
+mSpdLimitSRF1Method same as above for SIM RACE F1
+
+mShiftlightsMethodIndex to overwrite the method value, useful in custom_shiftlightsMethodEvent() function to patch the current shiftlights method with another one
+mShiftlightsBU0710MethodIndex same as above for BU0710
+mShiftlightsG27MethodIndex same as above for G27
+mShiftlightsFanatecMethodIndex same as above for Fanatec
+mShiftlightsSRDlxMethodIndex same as above for SIM RACE Deluxe
+mShiftlightsSRF1MethodIndex same as above for SIM RACE F1
+
+oldGear is useful in custom_gearFanatecEvent() function to patch the current gear value
+
+-----------------------
+ SHIFTLIGHTS UTILITIES
+-----------------------
+shiftlights utilities functions in SLIMax Mananger script API
+(see shiftlights.lua for example and usage)
+
+--------------------------------------------------------
+shiftlights utilities functions for Fanatec
+--------------------------------------------------------
+-- shiftlights method from side to center
+function SideToCenterFanatec(rpm, redzone, p1, p2, p3, p4 ,p5 )
+
+-- progressive method
+function ProgressiveFanatec(rpm, redzone, p1, p2, p3, p4, p5, p6, p7, p8, p9 )
+
+-- alternate yellow, red and blue method
+function AlternateFanatec(rpm, redzone, step1, step2, step3)
+
+-- percentage method
+function percentageFanatec(rpm, redzone, p1, p2, p3, p4, p5, p6, p7, p8, p9 )
+
+-- fixed rpm method, set rpm for each led (NOT RECOMMENDED)
+function RpmFanatec(rpm, p1, p2, p3, p4, p5, p6, p7, p8, p9 )
+
+--------------------------------------------------------
+shiftlights utilities functions for SLI-M and SLI-PRO
+--------------------------------------------------------
+-- shiftlights method from side to center
+function SideToCenterSLI(rpm, redzone, p1, p2, p3, p4 ,p5 ,p6 ,p7)
+
+-- progressive method
+function ProgressiveSLI(rpm, redzone, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13 )
+
+-- alternate green, red and blue method
+function AlternateSLI(rpm, redzone, step1, step2, step3)
+
+-- percentage method
+function percentageSLI(rpm, redzone, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13 )
+
+-- fixed rpm method, set rpm for each led (NOT RECOMMENDED)
+function RpmSLI(rpm, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13 )
+
+-- progressive method but with rpm value for eah led (NOT RECOMMENDED)
+function ProgressiveFixedSLI(rpm, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13)
+
+--------------------------------------------------------
+shiftlights utilities functions for BU0710
+--------------------------------------------------------
+-- progressive method for BU0710
+function ProgressiveBU0710(rpm, redzone, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11 )
+
+-- percentage method for BU0710
+function percentageBU0710(rpm, redzone, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11 )
+
+-- fixed rpm method for BU0710 (NOT RECOMMENDED)
+function RpmSLI(rpm, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11 )
+
+--------------------------------------------------------
+shiftlights utilities functions for Logitech G27
+--------------------------------------------------------
+-- progressive method for G27
+function ProgressiveG27(rpm, redzone, p1, p2, p3, p4, p5)
+
+-- percentage method for G27
+function PercentageG27(rpm, redzone, p1, p2, p3, p4, p5)
+
+-- fixed rpm method for G27 (NOT RECOMMENDED)
+function RpmG27(rpm, p1, p2, p3, p4, p5 )
+
+--------------------------------------------------------
+-- KERS functions
+function GetKersPercent()
+
+--------------------------------------------------------
+LEFT and RIGHT Functions utilities for SLI-M and SLI-PRO
+--------------------------------------------------------
+
+-- add a function name to left and right functions list
+-- typical usage FuncAddName(path, func):
+-- on left list:
+-- local err = FuncAddName("cfg/sli_left_functions.ecfg", "100.DSII KERS")
+-- or right list:
+-- local err = FuncAddName("cfg/sli_right_functions.ecfg", "100.DSII KERS")
+-- return 1 if ok
+-- local err = FuncAddName("cfg/fanatec_digits_functions.ecfg", "100.DSII KERS")
+-- return 1 if ok
+
+
+-- same as above for removing the function name
+-- typical usage RemoveFuncName(path, func)
+-- return 1 if ok
+
+-- get the index of function
+-- typical usage: local idx = FuncGetPrefixIndex("100.DSII KERS")
+-- return value > 0 if ok
+
+-- get next function index available
+-- typical usage FuncGetNewIndex(path):
+-- on left list:
+-- 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 )
+-- or fanatec list:
+-- local num_available = FuncGetNewIndex("cfg/fanatec_digits_functions.ecfg")
+-- return value >=100 (0 to 99 are reserved )
+
+--------------------------------------------------------
+functions utilities in global.lua
+--------------------------------------------------------
+
+-- return KERS value in percent
+function GetKersPercent()
+
+-- Init all globals
+function InitGlobals()
+
+-- set RPM threshold value in percentage ( SLIMax Manager 2.1 )
+function SetRPMPercentValue(index, value)
+
+-- set RPM threshold value ( SLIMax Manager 2.1 )
+function SetRPMAbsoluteValue(index, value)
+
+-- get all global preferences set in general_default.sli
+function GetSLIMaxInfo()
+
+-- get cpu ticks
+function GetTicks()
+
+-- reset table function
+function initLedTable(ibl, value)
+
+-- toggle all led state
+function toggleAllLed(val)
+
+-- The following function rounds a number
+-- lua doesn't return the same rounded value as C/C++
+function round(num)
+
+-- The following function calculate hr, mn, sec, hd, ms
+-- param: time in meter/sec
+function timeDispatcher( tt)
+
+-- return speed in KPH or MPH
+function speed(spd, selector)
+
+-- Fahrenheit to Celsius
+function FtoC(f)
+
+-- Celsius to Fahrenheit
+function CtoF(c)
+
+-- Kelvin to Celsius
+function KtoC(k)
+
+-- liters to gallons
+function LtoG(liters)
+
+-- gallons to liters
+function GtoL(gallons)
+
+-- return fuel in liters or gallons
+function GetFuel(fl, selector)
+
+-- return celcius or fahrenheit
+function GetTemp(tmp, selector)
+
+-- set delta time delay in ms
+function SetDeltaTimeDelay(delay)
+
+-- force display text on left or/and right panel during delay in ms
+function LeftRightMessageText(delay, left_text, right_text)
+
+-- return delta time vs best time + sector diff
+-- isRF must be true for rFactor 1 and 2 and clones
+function GetDeltaBestTime(isRF)
+
+-- return delta time vs last time + sector diff
+-- isRF must be true for rFactor 1 and 2 and clones
+function GetDeltaLastTime(isRF)
diff --git a/scripts/slipro.lua b/scripts/slipro.lua
index 431f836..eaf94bd 100644
--- a/scripts/slipro.lua
+++ b/scripts/slipro.lua
@@ -1,8 +1,8 @@
--- SLIPRO Lua Script v3.3.2
+-- SLIPRO Lua Script v3.3.6
-- Copyright (c)2012-2013 by Zappadoc - All Rights Reserved.
-- this script builds all functions associated with
-- left and right panels of SLIPRO device
--- last change by Zappadoc - 2013-09
+-- last change by Zappadoc - 2013-11
-- ============================================================
-- Left and Right Panel functions
@@ -39,11 +39,11 @@ function leftDigitsEvent(swFunction)
qi = GetContextInfo("quickinfobutton")
if qi == nil or qi == 0 then qi = false end
if qi then
- -- get index for left panel
- local qiLeft = GetContextInfo("quickinfoleft")
- if qiLeft == nil then qiLeft = 1 end
- -- force position to match QI preference
- swValue = qiLeft
+ -- get index for left panel
+ local qiLeft = GetContextInfo("quickinfoleft")
+ if qiLeft == nil then qiLeft = 1 end
+ -- force position to match QI preference
+ swValue = qiLeft
end
-- check if PIT Feedback ON
@@ -51,11 +51,11 @@ function leftDigitsEvent(swFunction)
pf = GetContextInfo("pitfeedback")
if pf == nil or pf == 0 then pf = false end
if pf then
- -- force position to PIT/SPEED function if car pits
- local pit = GetCarInfo("inpits")
- if pit > 0 then
- swValue = 35
- end
+ -- force position to PIT/SPEED function if car pits
+ local pit = GetCarInfo("inpits")
+ if pit > 0 then
+ swValue = 35
+ end
end
-- get current simulation name
@@ -65,260 +65,260 @@ function leftDigitsEvent(swFunction)
-- check postion and compute left panel string
if swValue == 1 then
- -- speed only
- lPanel = string.format(" %3.0f ", spd )
+ -- speed only
+ lPanel = string.format(" %3.0f ", spd )
elseif swValue == 2 then
- -- fuel:speed
- local fuel = GetCarInfo("fuel")
- if fuel ~= nil then
- fuel = GetFuel(fuel, unit)
- if fuel >= 100 then
- lPanel = string.format("%03d:%3d", round(fuel), spd)
- elseif fuel >= 10 then
- lPanel = string.format("F%02d:%3d", round(fuel), spd)
- else
- lPanel = string.format("F%1.1f:%3d", fuel, spd)
- end
- end
+ -- fuel:speed
+ local fuel = GetCarInfo("fuel")
+ if fuel ~= nil then
+ fuel = GetFuel(fuel, unit)
+ if fuel >= 100 then
+ lPanel = string.format("%03d:%3d", round(fuel), spd)
+ elseif fuel >= 10 then
+ lPanel = string.format("F%02d:%3d", round(fuel), spd)
+ else
+ lPanel = string.format("F%1.1f:%3d", fuel, spd)
+ end
+ end
elseif swValue == 3 then
- -- position:speed
- inf = GetContextInfo("position")
- if inf ~= nil then
- if inf >= 100 then
- lPanel = string.format("%03d:%3.0f", inf, spd)
- else
- lPanel = string.format("P%02d:%3.0f", inf, spd)
- end
- end
+ -- position:speed
+ inf = GetContextInfo("position")
+ if inf ~= nil then
+ if inf >= 100 then
+ lPanel = string.format("%03d:%3.0f", inf, spd)
+ else
+ lPanel = string.format("P%02d:%3.0f", inf, spd)
+ end
+ end
elseif swValue == 4 then
- -- laps completed:speed
- inf = GetContextInfo("laps")
- if inf ~= nil then
- -- if more then 99 laps
- if inf >= 100 then
- lPanel = string.format("%03d:%3.0f", inf, spd)
- else
- lPanel = string.format("L%02d:%3.0f", inf, spd)
- end
- end
+ -- laps completed:speed
+ inf = GetContextInfo("laps")
+ if inf ~= nil then
+ -- if more then 99 laps
+ if inf >= 100 then
+ lPanel = string.format("%03d:%3.0f", inf, spd)
+ else
+ lPanel = string.format("L%02d:%3.0f", inf, spd)
+ end
+ end
elseif swValue == 5 then
- -- sector:speed
- inf = GetCarInfo("sector")
- if inf ~= nil then
- -- check if sector > 9
- if inf >9 then
- lPanel = string.format("S%02d:%3.0f", inf, spd)
- else
- lPanel = string.format("S%01d :%3.0f", inf, spd)
- end
- end
+ -- sector:speed
+ inf = GetCarInfo("sector")
+ if inf ~= nil then
+ -- check if sector > 9
+ if inf >9 then
+ lPanel = string.format("S%02d:%3.0f", inf, spd)
+ else
+ lPanel = string.format("S%01d :%3.0f", inf, spd)
+ end
+ end
elseif swValue == 6 then
- -- laps completed:total laps if available
- inf = GetContextInfo("laps")
- if inf ~= nil then
- local tl = GetContextInfo("lapscount")
- if tl < 1 then tl = 0 end
- -- if more then 99 laps
- if inf >= 100 or tl >= 100 then
- lPanel = string.format("%03d:%03d", inf, tl)
- else
- lPanel = string.format("L%02d:t%02d", inf, tl)
- end
- end
+ -- laps completed:total laps if available
+ inf = GetContextInfo("laps")
+ if inf ~= nil then
+ local tl = GetContextInfo("lapscount")
+ if tl < 1 then tl = 0 end
+ -- if more then 99 laps
+ if inf >= 100 or tl >= 100 then
+ lPanel = string.format("%03d:%03d", inf, tl)
+ else
+ lPanel = string.format("L%02d:t%02d", inf, tl)
+ end
+ end
elseif swValue == 7 then
- -- water temp
- inf = GetCarInfo("watertemp")
- if inf ~= nil then
- inf = GetTemp(inf, unit)
- lPanel = string.format("H2o:%2.1f", inf)
- end
+ -- water temp
+ inf = GetCarInfo("watertemp")
+ if inf ~= nil then
+ inf = GetTemp(inf, unit)
+ lPanel = string.format("H2o:%2.1f", inf)
+ end
elseif swValue == 8 then
- -- oil temp
- inf = GetCarInfo("oiltemp")
- if inf ~= nil then
- inf = GetTemp(inf, unit)
- lPanel = string.format("OIL:%2.1f", inf)
- end
+ -- oil temp
+ inf = GetCarInfo("oiltemp")
+ if inf ~= nil then
+ inf = GetTemp(inf, unit)
+ lPanel = string.format("OIL:%2.1f", inf)
+ end
elseif swValue == 9 then
- -- wheels temp if available
- inf = GetCarInfo("wheeltempfrontleft")
- if inf ~= nil then
- -- if rFactor convert Kelvin to Celsius (see global.lua)
- if isAppRFactor(sim) then inf = KtoC(inf) end
- lPanel = string.format("tFL:%3.0f", inf)
- end
+ -- wheels temp if available
+ inf = GetCarInfo("wheeltempfrontleft")
+ if inf ~= nil then
+ -- if rFactor convert Kelvin to Celsius (see global.lua)
+ if isAppRFactor(sim) then inf = KtoC(inf) end
+ lPanel = string.format("tFL:%3.0f", inf)
+ end
elseif swValue == 10 then
- inf = GetCarInfo("wheeltempfrontright")
- if inf ~= nil then
- if isAppRFactor(sim) then inf = KtoC(inf) end
- lPanel = string.format("tFr:%3.0f", inf)
- end
+ inf = GetCarInfo("wheeltempfrontright")
+ if inf ~= nil then
+ if isAppRFactor(sim) then inf = KtoC(inf) end
+ lPanel = string.format("tFr:%3.0f", inf)
+ end
elseif swValue == 11 then
- inf = GetCarInfo("wheeltemprearleft")
- if inf ~= nil then
- if isAppRFactor(sim) then inf = KtoC(inf) end
- lPanel = string.format("trL:%3.0f", inf)
- end
+ inf = GetCarInfo("wheeltemprearleft")
+ if inf ~= nil then
+ if isAppRFactor(sim) then inf = KtoC(inf) end
+ lPanel = string.format("trL:%3.0f", inf)
+ end
elseif swValue == 12 then
- inf = GetCarInfo("wheeltemprearright")
- if inf ~= nil then
- if isAppRFactor(sim) then inf = KtoC(inf) end
- lPanel = string.format("trr:%3.0f", inf)
- end
+ inf = GetCarInfo("wheeltemprearright")
+ if inf ~= nil then
+ if isAppRFactor(sim) then inf = KtoC(inf) end
+ lPanel = string.format("trr:%3.0f", inf)
+ end
elseif swValue == 13 then
- -- wheels pressure if available
- inf = GetCarInfo("wheelpressfrontleft")
- if inf ~= nil then
- -- convert to psi
- lPanel = string.format("PFL:%2.1f", inf / 6.88)
- end
+ -- wheels pressure if available
+ inf = GetCarInfo("wheelpressfrontleft")
+ if inf ~= nil then
+ -- convert to psi
+ lPanel = string.format("PFL:%2.1f", inf / 6.88)
+ end
elseif swValue == 14 then
- inf = GetCarInfo("wheelpressfrontright")
- if inf ~= nil then
- lPanel = string.format("PFr:%2.1f", inf / 6.88)
- end
+ inf = GetCarInfo("wheelpressfrontright")
+ if inf ~= nil then
+ lPanel = string.format("PFr:%2.1f", inf / 6.88)
+ end
elseif swValue == 15 then
- inf = GetCarInfo("wheelpressrearleft")
- if inf ~= nil then
- lPanel = string.format("PrL:%2.1f", inf / 6.88)
- end
+ inf = GetCarInfo("wheelpressrearleft")
+ if inf ~= nil then
+ lPanel = string.format("PrL:%2.1f", inf / 6.88)
+ end
elseif swValue == 16 then
- inf = GetCarInfo("wheelpressrearright")
- if inf ~= nil then
- lPanel = string.format("Prr:%2.1f", inf / 6.88)
- end
+ inf = GetCarInfo("wheelpressrearright")
+ if inf ~= nil then
+ lPanel = string.format("Prr:%2.1f", inf / 6.88)
+ end
elseif swValue == 17 then
- -- brakes temp if available
- inf = GetCarInfo("braketempfrontleft")
- if inf ~= nil then
- if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
- lPanel = string.format("BFL:%3.0f", inf)
- end
+ -- brakes temp if available
+ inf = GetCarInfo("braketempfrontleft")
+ if inf ~= nil then
+ if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
+ lPanel = string.format("BFL:%3.0f", inf)
+ end
elseif swValue == 18 then
- inf = GetCarInfo("braketempfrontright")
- if inf ~= nil then
- if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
- lPanel = string.format("BFr:%3.0f", inf)
- end
+ inf = GetCarInfo("braketempfrontright")
+ if inf ~= nil then
+ if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
+ lPanel = string.format("BFr:%3.0f", inf)
+ end
elseif swValue == 19 then
- inf = GetCarInfo("braketemprearleft")
- if inf ~= nil then
- if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
- lPanel = string.format("BrL:%3.0f", inf)
- end
+ inf = GetCarInfo("braketemprearleft")
+ if inf ~= nil then
+ if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
+ lPanel = string.format("BrL:%3.0f", inf)
+ end
elseif swValue == 20 then
- inf = GetCarInfo("braketemprearright")
- if inf ~= nil then
- if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
- lPanel = string.format("Brr:%3.0f", inf)
- end
+ inf = GetCarInfo("braketemprearright")
+ if inf ~= nil then
+ if isAppRFactor(sim) or sim == "GTR2.exe" then inf = KtoC(inf) end
+ lPanel = string.format("Brr:%3.0f", inf)
+ end
elseif swValue == 21 then
- -- position
- local pos = GetContextInfo("position")
- lPanel = string.format(" P%02d ", pos )
+ -- position
+ local pos = GetContextInfo("position")
+ lPanel = string.format(" P%02d ", pos )
elseif swValue == 22 then
- -- get an average consumption of fuel per lap and gives the remaining laps
- local remainintank = GetCarInfo("remainlapsintank")
- lPanel = string.format(" FL%3.0f", math.floor(remainintank) )
+ -- get an average consumption of fuel per lap and gives the remaining laps
+ local remainintank = GetCarInfo("remainlapsintank")
+ lPanel = string.format(" FL%3.0f", math.floor(remainintank) )
elseif swValue == 23 then
- -- rpm
- local rpm = GetCarInfo("rpm")
- lPanel = string.format("%5d ", rpm)
+ -- rpm
+ local rpm = GetCarInfo("rpm")
+ lPanel = string.format("%5d ", rpm)
elseif swValue == 24 then
- -- track size
- local trcksz = GetContextInfo("tracksize")
- lPanel = string.format("%5d ", trcksz)
+ -- track size
+ local trcksz = GetContextInfo("tracksize")
+ lPanel = string.format("%5d ", trcksz)
elseif swValue == 25 then
- -- 25.fuel
- local fuel = GetCarInfo("fuel")
- if fuel ~= nil then
- fuel = GetFuel(fuel, unit)
- if fuel >= 100 then
- lPanel = string.format(" F%03d ", round(fuel))
- elseif fuel >= 10 then
- lPanel = string.format(" F%02d ", round(fuel))
- else
- lPanel = string.format(" F%1.1f ", fuel)
- end
- end
+ -- 25.fuel
+ local fuel = GetCarInfo("fuel")
+ if fuel ~= nil then
+ fuel = GetFuel(fuel, unit)
+ if fuel >= 100 then
+ lPanel = string.format(" F%03d ", round(fuel))
+ elseif fuel >= 10 then
+ lPanel = string.format(" F%02d ", round(fuel))
+ else
+ lPanel = string.format(" F%1.1f ", fuel)
+ end
+ end
elseif swValue == 26 then
- -- 26.distance
- local dist = GetContextInfo("lapdistance")
- lPanel = string.format(" %5d", dist )
+ -- 26.distance
+ local dist = GetContextInfo("lapdistance")
+ lPanel = string.format(" %5d", dist )
elseif swValue == 27 then
- --27.lap completed
- local laps = GetContextInfo("laps")
- lPanel = string.format(" %3d ", laps )
+ --27.lap completed
+ local laps = GetContextInfo("laps")
+ lPanel = string.format(" %3d ", laps )
elseif swValue == 28 then
- --28.total laps
- local lpcnt = GetContextInfo("lapscount")
- lPanel = string.format(" %3d ", lpcnt )
+ --28.total laps
+ local lpcnt = GetContextInfo("lapscount")
+ lPanel = string.format(" %3d ", lpcnt )
elseif swValue == 29 then
- --29.sector
- local sect = GetCarInfo("sector")
- -- check if sector > 9
- if sect >9 then
- lPanel = string.format(" S%02d ", sect)
- else
- lPanel = string.format(" S%01d ", sect)
- end
+ --29.sector
+ local sect = GetCarInfo("sector")
+ -- check if sector > 9
+ if sect >9 then
+ lPanel = string.format(" S%02d ", sect)
+ else
+ lPanel = string.format(" S%01d ", sect)
+ end
elseif swValue == 30 then
- --30.kers
- local kers = GetCarInfo("kers")
- lPanel = string.format(" E:%3d", round(kers/1000))
+ --30.kers
+ local kers = GetCarInfo("kers")
+ lPanel = string.format(" E:%3d", round(kers/1000))
elseif swValue == 31 then
- --31.kers max
- local kmx = GetCarInfo("kersmax")
- lPanel = string.format(" E:%03d", round(kmx/1000))
+ --31.kers max
+ local kmx = GetCarInfo("kersmax")
+ lPanel = string.format(" E:%03d", round(kmx/1000))
elseif swValue == 32 then
- --32.drs
- local drs = GetCarInfo("drs")
- if drs == 1 then
- lPanel = "DrS:ON "
- else
- lPanel = "DrS:OFF"
- end
+ --32.drs
+ local drs = GetCarInfo("drs")
+ if drs == 1 then
+ lPanel = "DrS:ON "
+ else
+ lPanel = "DrS:OFF"
+ end
elseif swValue == 33 then
- --33.kers percent
- local kers = GetCarInfo("kers")
- lPanel = string.format(" E:%3d", round((kers/1000)/4))
+ --33.kers percent
+ local kers = GetCarInfo("kers")
+ lPanel = string.format(" E:%3d", round((kers/1000)/4))
elseif swValue == 34 then
- --33.kers percent:speed
- local kers = GetCarInfo("kers")
- lPanel = string.format("%3d:%3.0f", round((kers/1000)/4), spd)
+ --33.kers percent:speed
+ local kers = GetCarInfo("kers")
+ lPanel = string.format("%3d:%3.0f", round((kers/1000)/4), spd)
elseif swValue == 35 then
- -- PIT
- lPanel = " PIt "
+ -- PIT
+ lPanel = " PIt "
elseif swValue == 36 then
- -- sc
- local sc = GetContextInfo("safetycare")
- if sc == 1 then
- lPanel = " SCAR "
- else
- lPanel = " OFF "
- end
+ -- sc
+ local sc = GetContextInfo("safetycare")
+ if sc == 1 then
+ lPanel = " SCAR "
+ else
+ lPanel = " OFF "
+ end
else
- lPanel = "-:--.---"
+ lPanel = "-:--.---"
end
-- send string to sli manager
SetLeftDigits( lPanel )
@@ -350,7 +350,7 @@ function rightDigitsEvent(swFunction)
local hd = 0
local rPanel = ""
local lpt = 0.0
- local diffFlag = false
+ local diffTimeFlag = false
local unit = false
-- is OSP Tracking ON
@@ -358,7 +358,7 @@ function rightDigitsEvent(swFunction)
ospt = GetContextInfo("osptracking")
if ospt == nil then ospt = false end
if ospt then
- swValue = 23
+ swValue = 23
end
-- lap finished, display lap time a few seconds
@@ -366,7 +366,7 @@ function rightDigitsEvent(swFunction)
dlt = GetContextInfo("displaylaptime")
if dlt == nil then dlt = false end
if dlt and swValue ~= 37 and swValue ~= 38 then
- swValue = 3
+ swValue = 3
end
-- check if quick info button is down
@@ -374,10 +374,10 @@ function rightDigitsEvent(swFunction)
qi = GetContextInfo("quickinfobutton")
if qi == nil or qi == 0 then qi = false end
if qi then
- -- get index for right panel
- local qiRight = GetContextInfo("quickinforight")
- if qiRight == nil then qiRight = 1 end
- swValue = qiRight
+ -- get index for right panel
+ local qiRight = GetContextInfo("quickinforight")
+ if qiRight == nil then qiRight = 1 end
+ swValue = qiRight
end
-- get current display unit metric or imperial
unit = GetContextInfo("speedmetric")
@@ -387,11 +387,11 @@ function rightDigitsEvent(swFunction)
pf = GetContextInfo("pitfeedback")
if pf == nil or pf == 0 then pf = false end
if pf then
- -- force position to SPEED function
- local pit = GetCarInfo("inpits")
- if pit > 0 then
- swValue = 20
- end
+ -- force position to SPEED function
+ local pit = GetCarInfo("inpits")
+ if pit > 0 then
+ swValue = 20
+ end
end
--print ( "swValue: " .. swValue .. "\n")
@@ -399,463 +399,379 @@ function rightDigitsEvent(swFunction)
-- get sim name
local sim = GetContextInfo("simulation")
if sim ~= nil then
- if swValue == 1 then
- -- current lap time
- lpt = GetTimeInfo("laptime")
- elseif swValue == 2 then
- -- best lap time (PB)
- lpt = GetTimeInfo("bestlaptime")
- elseif swValue == 3 then
- -- last lap time
- lpt = GetTimeInfo("lastlaptime")
-
- elseif swValue >= 4 and swValue <= 10 and isAppIRacing(sim) then
- -- iRacing partials
- local ts = GetContextInfo("partialcount")
- local sector = GetCarInfo("sector")
- if ts ~= nil and ts > 0 then
- if swValue == 4 then
- lpt = GetPartialTimeInfo("currentpartial", sector)
- elseif swValue == 5 then
- diffFlag = true
- lpt = GetPartialTimeInfo("vsbestlap", sector)
- elseif swValue == 6 then
- diffFlag = true
- lpt = GetPartialTimeInfo("vsoptimallap", sector)
- elseif swValue == 7 then
- diffFlag = true
- lpt = GetPartialTimeInfo("vsoptimalsector", sector)
- elseif swValue == 8 then
- diffFlag = true
- lpt = GetPartialTimeInfo("vssessionbestlap", sector)
- elseif swValue == 9 then
- diffFlag = true
- lpt = GetPartialTimeInfo("vssessionoptimallap", sector)
- elseif swValue == 10 then
- diffFlag = true
- lpt = GetPartialTimeInfo("vssessionoptimalsector", sector)
- end
- else
- lpt = 0.0
- end
-
- elseif swValue == 11 then
- -- real time diff vs your best
- diffFlag = true
- lpt = GetTimeInfo("realdiffbest")
-
- elseif swValue == 12 then
- -- real time diff vs your last
- diffFlag = true
- lpt = GetTimeInfo("realdifflast")
-
- elseif swValue == 13 then
- -- current sector
- local sector = GetCarInfo("sector")
- if sector == 1 then
- lpt = GetTimeInfo("sector1")
- elseif sector == 2 then
- lpt = GetTimeInfo("sector2")
- else
- -- sector 3
- local s1 = GetTimeInfo("sector1")
- local s2 = GetTimeInfo("sector2")
- local lt = GetTimeInfo("laptime")
- lpt = lt - (s1 + s2)
- end
- elseif swValue == 14 then
- -- best sector 1
- lpt = GetTimeInfo("bestsector1")
- elseif swValue == 15 then
- -- best sector 2
- lpt = GetTimeInfo("bestsector2")
- elseif swValue == 16 then
- -- last sector 1
- lpt = GetTimeInfo("lastsector1")
- elseif swValue == 17 then
- -- last sector 2
- lpt = GetTimeInfo("lastsector2")
- elseif swValue == 18 then
- -- position
- local pos = GetContextInfo("position")
- if pos >= 100 then
- rPanel = string.format(" P%03d ", pos )
- else
- rPanel = string.format(" P%02d ", pos )
- end
- SetRightDigits( rPanel )
- return 1
- elseif swValue == 19 then
- -- get an average consumption of fuel per lap and gives the remaining laps
- local remainintank = GetCarInfo("remainlapsintank")
- rPanel = string.format(" FL%3.0f", math.floor(remainintank) )
-
- elseif swValue == 20 then
- -- speed on right panel
- local spd = GetCarInfo("speed")
- rPanel = string.format(" %3d ", spd )
- SetRightDigits( rPanel )
- return 1
-
- elseif swValue == 21 then
- -- time remaining if available
- lpt = GetTimeInfo("timeremaining")
-
- -- explod time
- hr, mn, sc, hd, ms = timeDispatcher(lpt)
- if hr > 0 then
- rPanel = string.format( "%02dh%02d ", hr, mn)
- else
- rPanel = string.format( " %02d.%02d ", mn, sc)
- end
- SetRightDigits( rPanel )
- return 1
-
- elseif swValue == 22 then
- -- PC system time
- lpt = GetTimeInfo("systemtime")
- -- explod time
- hr, mn, sc, hd, ms = timeDispatcher(lpt)
- rPanel = string.format( " %02d.%02d ", hr, mn)
- SetRightDigits( rPanel )
- return 1
-
- elseif swValue == 23 then
- -- rpm:gear
- local rpm = GetCarInfo("rpm")
- if rpm == nil then
- return 1
- end
- local gear = GetCarInfo("gear")
- if gear ~= nil then
- rPanel = string.format("%5d:%d", rpm, gear)
- SetRightDigits( rPanel )
- end
- return 1
-
- elseif swValue == 24 then
- -- time elapsed if available
- lpt = GetTimeInfo("timetotalelapsed")
-
- -- explod time
- hr, mn, sc, hd, ms = timeDispatcher(lpt)
- if hr > 0 then
- rPanel = string.format( "%02dh%02d ", hr, mn)
- else
- rPanel = string.format( " %02d.%02d ", mn, sc)
- end
- SetRightDigits( rPanel )
- return 1
- elseif swValue == 25 then
- -- 25.fuel
- local fuel = GetCarInfo("fuel")
- if fuel ~= nil then
- fuel = GetFuel(fuel, unit)
- if fuel >= 100 then
- rPanel = string.format(" F%03d ", round(fuel))
- elseif fuel >= 10 then
- rPanel = string.format(" F%02d ", round(fuel))
- else
- rPanel = string.format(" F%1.1f ", fuel)
- end
-
- SetRightDigits( rPanel )
- return 1
- end
-
- elseif swValue == 26 then
- -- 26.distance
- local dist = GetContextInfo("lapdistance")
- rPanel = string.format(" %5d", dist )
- SetRightDigits( rPanel )
- return 1
-
- elseif swValue == 27 then
- --27.lap completed
- local laps = GetContextInfo("laps")
- rPanel = string.format(" %3d ", laps )
- SetRightDigits( rPanel )
- return 1
-
- elseif swValue == 28 then
- --28.total laps
- local lpcnt = GetContextInfo("lapscount")
- rPanel = string.format(" %3d ", lpcnt )
- SetRightDigits( rPanel )
- return 1
-
- elseif swValue == 29 then
- --29.sector
- local sect = GetCarInfo("sector")
- -- check if sector > 9
- if sect >9 then
- rPanel = string.format(" S%02d ", sect)
- else
- rPanel = string.format(" S%01d ", sect)
- end
- SetRightDigits( rPanel )
- return 1
-
- elseif swValue == 30 then
- --30.kers
- local kers = GetCarInfo("kers")
- rPanel = string.format(" E%03d ", round(kers/1000) )
- SetRightDigits( rPanel )
- return 1
-
- elseif swValue == 31 then
- --31.kers max
- local kmx = GetCarInfo("kersmax")
- rPanel = string.format(" E%03d ", round(kmx/1000) )
- SetRightDigits( rPanel )
- return 1
-
- elseif swValue == 32 then
- --32.drs
- rPanel = "DrS.OFF"
- local drs = GetCarInfo("drs")
- if drs >= 1 then
- rPanel = "DrS. ON"
- end
- SetRightDigits( rPanel )
- return 1
-
- elseif swValue == 33 then
- --33.kers percent
- local kers = GetCarInfo("kers")
- rPanel = string.format(" %3d ", round((kers/1000)/4))
- SetRightDigits( rPanel )
- return 1
-
- elseif swValue == 34 then
- --34 track size
- local trcksz = GetContextInfo("tracksize")
- rPanel = string.format("%5d ", trcksz)
- SetRightDigits( rPanel )
- return 1
-
- elseif swValue == 35 then
- --35 last sector 1, 2 and 3
- local sector = GetCarInfo("sector")
- if sector == 1 then
- -- sector 3
- local ls1 = GetTimeInfo("lastsector1")
- local ls2 = GetTimeInfo("lastsector2")
- local lt = GetTimeInfo("lastlaptime")
- if ls1 > 0 and ls2 > 0 then
- lpt = lt - (ls1 + ls2)
- end
- elseif sector == 2 then
- local ls1 = GetTimeInfo("lastsector1")
- lpt = ls1
- else
- -- sector 3
- local ls2 = GetTimeInfo("lastsector2")
- lpt = ls2
- end
-
- elseif swValue == 36 then
- --36.rpm
- local rpm = GetCarInfo("rpm")
- rPanel = string.format("%5d ", rpm)
- SetRightDigits( rPanel )
- return 1
-
- elseif swValue == 37 then
- -- real time delta vs last + last sector diff 1, 2 and 3
- local sector = GetCarInfo("sector")
- diffFlag = true
- if mDiffSectorDelay == nil or mDiffOldSector == nil or mDiffOldSector ~= sector then
- -- 8s delay, increase it if needed
- mDiffSectorDelay = GetTicks() + 8000
- mDiffOldSector = sector
- end
- -- init backup vars
- if mOld_lt == nil then
- mOld_ls1 = 0.00000
- mOld_ls2 = 0.00000
- mOld_lt = 0.00000
- mDelta_lpt = 0.00000
- mDelta_lptb = 0.00000
- end
-
- -- display delta by default
- lpt = GetTimeInfo("realdifflast")
-
- if mDiffSectorDelay > GetTicks() then
- -- display sector
- if sector == 1 then
- -- sector 3
- local lt = GetTimeInfo("lastlaptime")
-
- -- if ls1 > 0 and ls2 > 0 and lt > 0 and mOld_ls1 > 0 and mOld_ls2 > 0 and mOld_lt > 0 then
- -- delta sector 3
- --lpt = (lt - (ls1 + ls2)) - (mOld_lt - (mOld_ls1 + mOld_ls2))
- if lt > 0 and mOld_lt > 0 then
- if lt ~= mOld_lt then
- mDelta_lpt = lt - mOld_lt
- print(mDelta_lpt, lt, mOld_lt)
- end
- lpt = mDelta_lpt
- end
-
- mOld_lt = lt
-
-
- elseif sector == 2 then
- -- sector 1
- local ls1 = GetTimeInfo("lastsector1")
- if ls1 > 0 and mOld_ls1 > 0 then
- lpt = ls1 - mOld_ls1
- end
- mOld_ls2 = GetTimeInfo("lastsector2")
- print(lpt, ls1 , mOld_ls1, mOld_ls2)
-
- else
- -- sector 2
- local ls2 = GetTimeInfo("lastsector2")
- if ls2 > 0 and mOld_ls2 > 0 then
- lpt = ls2 - mOld_ls2
- end
- mOld_ls1 = GetTimeInfo("lastsector1")
- print(lpt, ls2 , mOld_ls1, mOld_ls2)
- end
- end
-
- elseif swValue == 38 then
- -- real time delta vs best + last sector diff 1, 2 and 3
-
- -- get sector
- local sector = GetCarInfo("sector")
- -- set flags
- diffFlag = true
-
- -- set delay
- if mDiffSectorDelay == nil or mDiffOldSector == nil or mDiffOldSector ~= sector then
- -- 8s delay, increase it if needed
- mDiffSectorDelay = GetTicks() + 8000
- mDiffOldSector = sector
- end
-
- -- init backup vars
- if mOld_bt == nil then
- mOld_bs1 = 0.00000
- mOld_bs2 = 0.00000
- mOld_bt = 0.00000
- mDelta_lpt = 0.00000
- mDelta_lptb = 0.00000
- end
-
- -- display delta by default
- lpt = GetTimeInfo("realdiffbest")
-
- if mDiffSectorDelay > GetTicks() then
- -- display sector diff during delay
- if sector == 1 then
- -- sector 3
- local bt = GetTimeInfo("bestlaptime")
-
- --if bs1 > 0 and bs2 > 0 and bt > 0 and mOld_bs1 > 0 and mOld_bs2 > 0 and mOld_bt > 0 then
- -- delta sector 3
- -- lpt = (bt - (bs1 + bs2)) - (mOld_bt - (mOld_bs1 + mOld_bs2))
- if bt > 0 and mOld_bt > 0 then
- if bt ~= mOld_bt then
- mDelta_lptb = bt - mOld_bt
- print(mDelta_lpt, bt, mOld_bt)
- end
- lpt = mDelta_lptb
- end
-
- mOld_bt = bt
-
- elseif sector == 2 then
- -- sector 1
- local bs1 = GetTimeInfo("bestsector1")
- if bs1 > 0 and mOld_bs1 > 0 then
- lpt = bs1 - mOld_bs1
- end
- print(lpt, bs1 )
- mOld_bs2 = GetTimeInfo("bestsector2")
-
- else
- -- sector 2
- local bs2 = GetTimeInfo("bestsector2")
- if bs2 > 0 and mOld_bs2 > 0 then
- lpt = bs2 - mOld_bs2
- end
- print(lpt, bs2 )
- mOld_bs1 = GetTimeInfo("bestsector1")
- end
- end
-
- else
- -- none
- rPanel = "-:--.---"
- SetRightDigits( rPanel )
- return 1
- end
+ if swValue == 1 then
+ -- current lap time
+ lpt = GetTimeInfo("laptime")
+
+ elseif swValue == 2 then
+ -- best lap time (PB)
+ lpt = GetTimeInfo("bestlaptime")
+
+ elseif swValue == 3 then
+ -- last lap time
+ lpt = GetTimeInfo("lastlaptime")
+
+ elseif swValue >= 4 and swValue <= 10 and isAppIRacing(sim) then
+ -- iRacing partials
+ local ts = GetContextInfo("partialcount")
+ local sector = GetCarInfo("sector")
+ if ts ~= nil and ts > 0 then
+ if swValue == 4 then
+ lpt = GetPartialTimeInfo("currentpartial", sector)
+ elseif swValue == 5 then
+ diffTimeFlag = true
+ lpt = GetPartialTimeInfo("vsbestlap", sector)
+ elseif swValue == 6 then
+ diffTimeFlag = true
+ lpt = GetPartialTimeInfo("vsoptimallap", sector)
+ elseif swValue == 7 then
+ diffTimeFlag = true
+ lpt = GetPartialTimeInfo("vsoptimalsector", sector)
+ elseif swValue == 8 then
+ diffTimeFlag = true
+ lpt = GetPartialTimeInfo("vssessionbestlap", sector)
+ elseif swValue == 9 then
+ diffTimeFlag = true
+ lpt = GetPartialTimeInfo("vssessionoptimallap", sector)
+ elseif swValue == 10 then
+ diffTimeFlag = true
+ lpt = GetPartialTimeInfo("vssessionoptimalsector", sector)
+ end
+ else
+ lpt = 0.0
+ end
+
+ elseif swValue == 11 then
+ -- real time diff vs your best
+ diffTimeFlag = true
+ lpt = GetTimeInfo("realdiffbest")
+
+ elseif swValue == 12 then
+ -- real time diff vs your last
+ diffTimeFlag = true
+ lpt = GetTimeInfo("realdifflast")
+
+ elseif swValue == 13 then
+ -- current sector
+ local sector = GetCarInfo("sector")
+ if sector == 1 then
+ lpt = GetTimeInfo("sector1")
+ elseif sector == 2 then
+ lpt = GetTimeInfo("sector2")
+ else
+ -- sector 3
+ lpt = GetTimeInfo("sector3")
+ end
+ elseif swValue == 14 then
+ -- best sector 1
+ lpt = GetTimeInfo("bestsector1")
+
+ elseif swValue == 15 then
+ -- best sector 2
+ lpt = GetTimeInfo("bestsector2")
+
+ elseif swValue == 16 then
+ -- last sector 1
+ lpt = GetTimeInfo("lastsector1")
+
+ elseif swValue == 17 then
+ -- last sector 2
+ lpt = GetTimeInfo("lastsector2")
+
+ elseif swValue == 18 then
+ -- position
+ local pos = GetContextInfo("position")
+ if pos >= 100 then
+ rPanel = string.format(" P%03d ", pos )
+ else
+ rPanel = string.format(" P%02d ", pos )
+ end
+ SetRightDigits( rPanel )
+ return 1
+
+ elseif swValue == 19 then
+ -- get an average consumption of fuel per lap and gives the remaining laps
+ local remainintank = GetCarInfo("remainlapsintank")
+ rPanel = string.format(" FL%3.0f", math.floor(remainintank) )
+ SetRightDigits( rPanel )
+ return 1
+
+ elseif swValue == 20 then
+ -- speed on right panel
+ local spd = GetCarInfo("speed")
+ rPanel = string.format(" %3d ", spd )
+ SetRightDigits( rPanel )
+ return 1
+
+ elseif swValue == 21 then
+ -- time remaining if available
+ lpt = GetTimeInfo("timeremaining")
+
+ -- explod time
+ hr, mn, sc, hd, ms = timeDispatcher(lpt)
+ if hr > 0 then
+ rPanel = string.format( "%02dh%02d ", hr, mn)
+ else
+ rPanel = string.format( " %02d.%02d ", mn, sc)
+ end
+ SetRightDigits( rPanel )
+ return 1
+
+ elseif swValue == 22 then
+ -- PC system time
+ lpt = GetTimeInfo("systemtime")
+ -- explod time
+ hr, mn, sc, hd, ms = timeDispatcher(lpt)
+ rPanel = string.format( " %02d.%02d ", hr, mn)
+ SetRightDigits( rPanel )
+ return 1
+
+ elseif swValue == 23 then
+ -- rpm:gear
+ local rpm = GetCarInfo("rpm")
+ if rpm == nil then
+ return 1
+ end
+ local gear = GetCarInfo("gear")
+ if gear ~= nil then
+ rPanel = string.format("%5d:%d", rpm, gear)
+ SetRightDigits( rPanel )
+ end
+ return 1
+
+ elseif swValue == 24 then
+ -- time elapsed if available
+ lpt = GetTimeInfo("timetotalelapsed")
+
+ -- explod time
+ hr, mn, sc, hd, ms = timeDispatcher(lpt)
+ if hr > 0 then
+ rPanel = string.format( "%02dh%02d ", hr, mn)
+ else
+ rPanel = string.format( " %02d.%02d ", mn, sc)
+ end
+ SetRightDigits( rPanel )
+ return 1
+ elseif swValue == 25 then
+ -- 25.fuel
+ local fuel = GetCarInfo("fuel")
+ if fuel ~= nil then
+ fuel = GetFuel(fuel, unit)
+ if fuel >= 100 then
+ rPanel = string.format(" F%03d ", round(fuel))
+ elseif fuel >= 10 then
+ rPanel = string.format(" F%02d ", round(fuel))
+ else
+ rPanel = string.format(" F%1.1f ", fuel)
+ end
+
+ SetRightDigits( rPanel )
+ return 1
+ end
+
+ elseif swValue == 26 then
+ -- 26.distance
+ local dist = GetContextInfo("lapdistance")
+ rPanel = string.format(" %5d", dist )
+ SetRightDigits( rPanel )
+ return 1
+
+ elseif swValue == 27 then
+ --27.lap completed
+ local laps = GetContextInfo("laps")
+ rPanel = string.format(" %3d ", laps )
+ SetRightDigits( rPanel )
+ return 1
+
+ elseif swValue == 28 then
+ --28.total laps
+ local lpcnt = GetContextInfo("lapscount")
+ rPanel = string.format(" %3d ", lpcnt )
+ SetRightDigits( rPanel )
+ return 1
+
+ elseif swValue == 29 then
+ --29.sector
+ local sect = GetCarInfo("sector")
+ -- check if sector > 9
+ if sect >9 then
+ rPanel = string.format(" S%02d ", sect)
+ else
+ rPanel = string.format(" S%01d ", sect)
+ end
+ SetRightDigits( rPanel )
+ return 1
+
+ elseif swValue == 30 then
+ --30.kers
+ local kers = GetCarInfo("kers")
+ rPanel = string.format(" E%03d ", round(kers/1000) )
+ SetRightDigits( rPanel )
+ return 1
+
+ elseif swValue == 31 then
+ --31.kers max
+ local kmx = GetCarInfo("kersmax")
+ rPanel = string.format(" E%03d ", round(kmx/1000) )
+ SetRightDigits( rPanel )
+ return 1
+
+ elseif swValue == 32 then
+ --32.drs
+ rPanel = "DrS.OFF"
+ local drs = GetCarInfo("drs")
+ if drs >= 1 then
+ rPanel = "DrS. ON"
+ end
+ SetRightDigits( rPanel )
+ return 1
+
+ elseif swValue == 33 then
+ --33.kers percent
+ local kers = GetCarInfo("kers")
+ rPanel = string.format(" %3d ", round((kers/1000)/4))
+ SetRightDigits( rPanel )
+ return 1
+
+ elseif swValue == 34 then
+ --34 track size
+ local trcksz = GetContextInfo("tracksize")
+ rPanel = string.format("%5d ", trcksz)
+ SetRightDigits( rPanel )
+ return 1
+
+ elseif swValue == 35 then
+ --35 last sector 1, 2 and 3
+ local sector = GetCarInfo("sector")
+ if sector == 1 then
+ -- sector 3
+ local ls3 = GetTimeInfo("lastsector3")
+ lpt = ls3
+
+ elseif sector == 2 then
+ local ls1 = GetTimeInfo("lastsector1")
+ lpt = ls1
+ else
+ -- sector 3
+ local ls2 = GetTimeInfo("lastsector2")
+ lpt = ls2
+ end
+
+ elseif swValue == 36 then
+ --36.rpm
+ local rpm = GetCarInfo("rpm")
+ rPanel = string.format("%5d ", rpm)
+ SetRightDigits( rPanel )
+ return 1
+
+ elseif swValue == 37 then
+ -- real time delta vs last + last sector diff 1, 2 and 3
+ diffTimeFlag = true
+
+ lpt = GetDeltaLastTime(false)
+
+
+ elseif swValue == 38 then
+ -- real time delta vs best + last sector diff 1, 2 and 3
+ diffTimeFlag = true
+
+ lpt = GetDeltaBestTime(false)
+
+
+ elseif swValue == 39 then
+ -- last sector 3
+ lpt = GetTimeInfo("lastsector3")
+
+ elseif swValue == 40 then
+ -- last sector 3
+ lpt = GetTimeInfo("bestsector3")
+
+ elseif swValue == 41 then
+ -- current sector 1 (rFactor)
+ lpt = GetTimeInfo("sector1")
+
+ elseif swValue == 42 then
+ -- current sector 2 (rFactor)
+ lpt = GetTimeInfo("sector2")
+
+ elseif swValue == 43 then
+ -- current sector 3 (rFactor)
+ lpt = GetTimeInfo("sector3")
+
+ elseif swValue == 44 then
+ -- rfactor real time delta vs last + last sector diff 1, 2 and 3
+ diffTimeFlag = true
+
+ lpt = GetDeltaLastTime(true)
+
+
+ elseif swValue == 45 then
+ -- rFactor real time delta vs best + last sector diff 1, 2 and 3
+ diffTimeFlag = true
+
+ lpt = GetDeltaBestTime(true)
+
+ else
+ -- none
+ rPanel = "-:--.---"
+ SetRightDigits( rPanel )
+ return 1
+ end
end
if lpt == nil then return 0 end
local refreshRate = mRefreshLapTimeRate
- if diffFlag then
- refreshRate = mDeltaTimeDelay
+ if diffTimeFlag then
+ refreshRate = mDeltaTimeDelay
end
-- check if diff time is ready
local diffOK = GetTimeInfo("realdifftimeready")
- if diffFlag and diffOK == false then
- diffFlag = false
- rPanel = " nPEF "
-
- mOld_ls1 = 0.00000
- mOld_ls2 = 0.00000
- mOld_lt = 0.00000
- mDelta_lpt = 0.00000
- mDelta_lptb = 0.00000
-
- SetRightDigits( rPanel )
- return 1
+ if diffTimeFlag and diffOK == false and dlt == false then
+ diffTimeFlag = false
+ rPanel = " nrEF "
+ SetRightDigits( rPanel )
+ return 1
end
local c = " "
if lpt < 0 then
- c = "-"
+ c = "-"
end
-- explod time
hr, mn, sc, hd, ms = timeDispatcher(lpt)
-- print("lpt: " .. lpt .. " m: " .. mn .. " - s: " .. sc .. " - ms: " .. ms .. )
if GetTicks() > ( refreshRate + mDeltaTimeOldTicks ) then
- mDeltaTimeOldTicks = GetTicks()
-
- if diffFlag then
- --
- if lpt == -1 or (mn + sc + ms) == 0.0000 then
- mDeltaTimeBackup = " --.---"
- elseif mn > 0 then
- mDeltaTimeBackup = string.format( "%s%2d.%02d.%01d", c, mn, sc, ms)
- else
- mDeltaTimeBackup = string.format( "%s%2d.%03d", c, sc, ms)
- end
-
- rPanel = mDeltaTimeBackup
-
- else
- --if mTimeBackup == nil then mTimeBackup = 0.0000 end
- if lpt == -1 or (mn + sc + ms) == 0.0000 then
- mDeltaTimeBackup = "-:--.---"
- elseif mn < 10 then
- mDeltaTimeBackup = string.format( "%1d:%02d.%03d", mn, sc, ms)
- elseif hr > 0 then
- mDeltaTimeBackup = string.format( " %02d.%02d ", hr, mn)
- else
- mDeltaTimeBackup = string.format( " %02d.%02d.%01d", mn, sc, ms)
- end
-
-
- end
+ mDeltaTimeOldTicks = GetTicks()
+
+ if diffTimeFlag then
+ --
+ if lpt == -1 or (mn + sc + ms) == 0.0000 then
+ mDeltaTimeBackup = " --.---"
+ elseif mn > 0 then
+ mDeltaTimeBackup = string.format( "%s%2d.%02d.%01d", c, mn, sc, ms)
+ else
+ mDeltaTimeBackup = string.format( "%s%2d.%03d", c, sc, ms)
+ end
+
+ rPanel = mDeltaTimeBackup
+
+ else
+ --if mTimeBackup == nil then mTimeBackup = 0.0000 end
+ if lpt == -1 or (mn + sc + ms) == 0.0000 then
+ mDeltaTimeBackup = "-:--.---"
+ elseif mn < 10 then
+ mDeltaTimeBackup = string.format( "%1d:%02d.%03d", mn, sc, ms)
+ elseif hr > 0 then
+ mDeltaTimeBackup = string.format( " %02d.%02d ", hr, mn)
+ else
+ mDeltaTimeBackup = string.format( " %02d.%02d.%01d", mn, sc, ms)
+ end
+
+
+ end
end
rPanel = mDeltaTimeBackup
-- send time to sli manager
diff --git a/scripts/speedlimiter.lua b/scripts/speedlimiter.lua
index 9382675..8ce51cb 100644
--- a/scripts/speedlimiter.lua
+++ b/scripts/speedlimiter.lua
@@ -26,9 +26,9 @@ function spdLmtMethodEvent(idx)
-- check if initialized
if isGlobalInitialized == 0 then
- isGlobalInitialized = 1
- -- init them
- InitGlobals()
+ isGlobalInitialized = 1
+ -- init them
+ InitGlobals()
end
-- get global prefs
GetSLIMaxInfo()
@@ -38,200 +38,200 @@ function spdLmtMethodEvent(idx)
SetRPMLed("mRPMLedTable")
if mNoBlink or (mSpdLimitMethod == 0) then
- -- speedlimiter led NOT blinking
- SetWarnLed(mSpeedLimiterLED, 1)
+ -- speedlimiter led NOT blinking
+ SetWarnLed(mSpeedLimiterLED, 1)
elseif mSpdLimitMethod == 1 then
- -- speedlimiter led blinking, method 1
- if GetTicks() > mOldTickCount then
- mSpdLmtBlink = mSpdLmtBlink + 1
- end
+ -- speedlimiter led blinking, method 1
+ if GetTicks() > mOldTickCount then
+ mSpdLmtBlink = mSpdLmtBlink + 1
+ end
- if mSpdLmtBlink >= mBlinkTime then
- mSpdLmtBlink = 0
- end
+ if mSpdLmtBlink >= mBlinkTime then
+ mSpdLmtBlink = 0
+ end
- if mSpdLmtBlink <= (mBlinkTime / 2) then
- if mLimiterChar then SetGearDigit("L") end
- SetWarnLed(mSpeedLimiterLED, 1)
- end
+ if mSpdLmtBlink <= (mBlinkTime / 2) then
+ if mLimiterChar then SetGearDigit("L") end
+ SetWarnLed(mSpeedLimiterLED, 1)
+ end
- if mSpdLmtBlink > (mBlinkTime / 2) then
- if mLimiterChar then SetGearDigit(" ") end
- SetWarnLed(mSpeedLimiterLED, 0)
- end
+ if mSpdLmtBlink > (mBlinkTime / 2) then
+ if mLimiterChar then SetGearDigit(" ") end
+ SetWarnLed(mSpeedLimiterLED, 0)
+ end
elseif mSpdLimitMethod == 2 then
- -- speedlimiter led + RPM blinking, method 2
- if GetTicks() > mOldTickCount then
- mSpdLmtBlink = mSpdLmtBlink + 1
- end
-
- if mSpdLmtBlink >= mBlinkTime then
- mSpdLmtBlink = 0
- end
-
- if mSpdLmtBlink <= (mBlinkTime / 2) then
- if mLimiterChar then SetGearDigit("L") end
- initLedTable(mRPMLedTable, 1)
- if not mSpdLmtRPMLedOnly then
- SetWarnLed(mSpeedLimiterLED, 1)
- end
- end
-
- if mSpdLmtBlink > (mBlinkTime / 2) then
- if mLimiterChar then SetGearDigit(" ") end
- initLedTable(mRPMLedTable, 0)
- if not mSpdLmtRPMLedOnly then
- SetWarnLed(mSpeedLimiterLED, 0)
- end
- end
- SetRPMLed("mRPMLedTable")
+ -- speedlimiter led + RPM blinking, method 2
+ if GetTicks() > mOldTickCount then
+ mSpdLmtBlink = mSpdLmtBlink + 1
+ end
+
+ if mSpdLmtBlink >= mBlinkTime then
+ mSpdLmtBlink = 0
+ end
+
+ if mSpdLmtBlink <= (mBlinkTime / 2) then
+ if mLimiterChar then SetGearDigit("L") end
+ initLedTable(mRPMLedTable, 1)
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 1)
+ end
+ end
+
+ if mSpdLmtBlink > (mBlinkTime / 2) then
+ if mLimiterChar then SetGearDigit(" ") end
+ initLedTable(mRPMLedTable, 0)
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 0)
+ end
+ end
+ SetRPMLed("mRPMLedTable")
elseif mSpdLimitMethod == 3 then
- -- speedlimiter led + alternate RPM blinking, method 3
- if GetTicks() > mOldTickCount then
- mSpdLmtBlink = mSpdLmtBlink + 1
- end
- if mSpdLmtBlink >= mBlinkTime then
- mSpdLmtBlink = 0
- end
- if mSpdLmtBlink <= (mBlinkTime / 2) then
- if mLimiterChar then
- SetGearDigit("L")
- end
- for i = 0,12 do
- led = led.format("RPM%d",i)
- if (i % 2)==0 then
- mRPMLedTable[led] = 1
- else
- mRPMLedTable[led] = 0
- end
- end
- if not mSpdLmtRPMLedOnly then
- SetWarnLed(mSpeedLimiterLED, 1)
- end
- end
-
- if mSpdLmtBlink > (mBlinkTime / 2) then
- if mLimiterChar then
- SetGearDigit(" ")
- end
- for i = 0,13 do
- led = led.format("RPM%d",i)
- if (i % 2)==0 then
- mRPMLedTable[led] = 0
- else
- mRPMLedTable[led] = 1
- end
- end
- if not mSpdLmtRPMLedOnly then
- SetWarnLed(mSpeedLimiterLED, 0)
- end
- end
- SetRPMLed("mRPMLedTable")
+ -- speedlimiter led + alternate RPM blinking, method 3
+ if GetTicks() > mOldTickCount then
+ mSpdLmtBlink = mSpdLmtBlink + 1
+ end
+ if mSpdLmtBlink >= mBlinkTime then
+ mSpdLmtBlink = 0
+ end
+ if mSpdLmtBlink <= (mBlinkTime / 2) then
+ if mLimiterChar then
+ SetGearDigit("L")
+ end
+ for i = 0,12 do
+ led = led.format("RPM%d",i)
+ if (i % 2)==0 then
+ mRPMLedTable[led] = 1
+ else
+ mRPMLedTable[led] = 0
+ end
+ end
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 1)
+ end
+ end
+
+ if mSpdLmtBlink > (mBlinkTime / 2) then
+ if mLimiterChar then
+ SetGearDigit(" ")
+ end
+ for i = 0,13 do
+ led = led.format("RPM%d",i)
+ if (i % 2)==0 then
+ mRPMLedTable[led] = 0
+ else
+ mRPMLedTable[led] = 1
+ end
+ end
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 0)
+ end
+ end
+ SetRPMLed("mRPMLedTable")
elseif mSpdLimitMethod == 4 then
- -- speedlimiter led + RPM + digits blinking, method 4
- if GetTicks() > mOldTickCount then
- mSpdLmtBlink = mSpdLmtBlink + 1
- end
-
- if mSpdLmtBlink >= mBlinkTime then
- mSpdLmtBlink = 0
- end
-
- if mSpdLmtBlink <= (mBlinkTime / 2) then
-
- if mLimiterChar then SetGearDigit("L") end
- SetDigitsAllowed(true)
-
- for i = 0,2 do
- led = led.format("RPM%d",i)
- mRPMLedTable[led] = 0
- end
- for i = 10,12 do
- led = led.format("RPM%d",i)
- mRPMLedTable[led] = 0
- end
-
- if not mSpdLmtRPMLedOnly then
- SetWarnLed(mSpeedLimiterLED, 0)
- end
- end
-
- if mSpdLmtBlink > (mBlinkTime / 2) then
- if mLimiterChar then SetGearDigit(" ") end
-
- SetDigitsAllowed(false)
-
- SetLeftDigits (mLeftSpdLmtText)
- SetRightDigits (mRightSpdLmtText)
-
- for i = 0,2 do
- led = led.format("RPM%d",i)
- mRPMLedTable[led] = 1
- end
- for i = 10,12 do
- led = led.format("RPM%d",i)
- mRPMLedTable[led] = 1
- end
- if not mSpdLmtRPMLedOnly then
- SetWarnLed(mSpeedLimiterLED, 0)
- end
- end
- SetRPMLed("mRPMLedTable")
+ -- speedlimiter led + RPM + digits blinking, method 4
+ if GetTicks() > mOldTickCount then
+ mSpdLmtBlink = mSpdLmtBlink + 1
+ end
+
+ if mSpdLmtBlink >= mBlinkTime then
+ mSpdLmtBlink = 0
+ end
+
+ if mSpdLmtBlink <= (mBlinkTime / 2) then
+
+ if mLimiterChar then SetGearDigit("L") end
+ SetDigitsAllowed(true)
+
+ for i = 0,2 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 0
+ end
+ for i = 10,12 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 0
+ end
+
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 0)
+ end
+ end
+
+ if mSpdLmtBlink > (mBlinkTime / 2) then
+ if mLimiterChar then SetGearDigit(" ") end
+
+ SetDigitsAllowed(false)
+
+ SetLeftDigits (mLeftSpdLmtText)
+ SetRightDigits (mRightSpdLmtText)
+
+ for i = 0,2 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 1
+ end
+ for i = 10,12 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 1
+ end
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 0)
+ end
+ end
+ SetRPMLed("mRPMLedTable")
elseif mSpdLimitMethod == 5 or mSpdLimitMethod == 6 then
- -- speedlimiter led + digits blinking, method 5
- -- speedlimiter led + RPM fixed + Digits blinking, method 6
- if GetTicks() > mOldTickCount then
- mSpdLmtBlink = mSpdLmtBlink + 1
- end
+ -- speedlimiter led + digits blinking, method 5
+ -- speedlimiter led + RPM fixed + Digits blinking, method 6
+ if GetTicks() > mOldTickCount then
+ mSpdLmtBlink = mSpdLmtBlink + 1
+ end
- if mSpdLmtBlink >= mBlinkTime then
- mSpdLmtBlink = 0
- end
+ if mSpdLmtBlink >= mBlinkTime then
+ mSpdLmtBlink = 0
+ end
- if mSpdLmtBlink <= (mBlinkTime / 2) then
- if mLimiterChar then SetGearDigit("L") end
+ if mSpdLmtBlink <= (mBlinkTime / 2) then
+ if mLimiterChar then SetGearDigit("L") end
- SetDigitsAllowed (true)
+ SetDigitsAllowed (true)
- local state = 0
- if mSpdLimitMethod == 6 then state = 1 end
- initLedTable(mRPMLedTable, state)
+ local state = 0
+ if mSpdLimitMethod == 6 then state = 1 end
+ initLedTable(mRPMLedTable, state)
- if not mSpdLmtRPMLedOnly then
- SetWarnLed(mSpeedLimiterLED, 0)
- end
- end
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 0)
+ end
+ end
- if mSpdLmtBlink > (mBlinkTime / 2) then
- if mLimiterChar then SetGearDigit(" ") end
+ if mSpdLmtBlink > (mBlinkTime / 2) then
+ if mLimiterChar then SetGearDigit(" ") end
- SetLeftDigits ( mLeftSpdLmtText)
- SetRightDigits ( mRightSpdLmtText)
+ SetLeftDigits ( mLeftSpdLmtText)
+ SetRightDigits ( mRightSpdLmtText)
- SetDigitsAllowed(false)
+ SetDigitsAllowed(false)
- local state = 0
- if mSpdLimitMethod == 6 then state = 1 end
- initLedTable(mRPMLedTable, state)
+ local state = 0
+ if mSpdLimitMethod == 6 then state = 1 end
+ initLedTable(mRPMLedTable, state)
- if not mSpdLmtRPMLedOnly then
- SetWarnLed(mSpeedLimiterLED, 0)
- end
- end
- SetRPMLed("mRPMLedTable")
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 0)
+ end
+ end
+ SetRPMLed("mRPMLedTable")
else
- return 1
+ return 1
end
-- timebase
if GetTicks() > mOldTickCount then
- mOldTickCount = GetTicks() + 20
+ mOldTickCount = GetTicks() + 20
end
return 1
end
@@ -258,9 +258,9 @@ function spdLmtG27MethodEvent(idx)
-- check if initialized
if isGlobalInitialized == 0 then
- isGlobalInitialized = 1
- -- init them
- InitGlobals()
+ isGlobalInitialized = 1
+ -- init them
+ InitGlobals()
end
-- get global prefs
GetSLIMaxInfo()
@@ -269,58 +269,58 @@ function spdLmtG27MethodEvent(idx)
mG27Leds = 0
if mNoBlink or mSpdLimitG27Method == 0 then
- -- speedlimiter led NOT blinking
- mG27Leds = 0x1F
+ -- speedlimiter led NOT blinking
+ mG27Leds = 0x1F
elseif mSpdLimitG27Method == 1 then
- -- speedlimiter led blinking, method 1
- if GetTicks() > mOldTickCount then
- mSpdLmtBlink = mSpdLmtBlink + 1
- end
+ -- speedlimiter led blinking, method 1
+ if GetTicks() > mOldTickCount then
+ mSpdLmtBlink = mSpdLmtBlink + 1
+ end
- if mSpdLmtBlink >= mBlinkTime then
- mSpdLmtBlink = 0
- end
+ if mSpdLmtBlink >= mBlinkTime then
+ mSpdLmtBlink = 0
+ end
- if mSpdLmtBlink <= (mBlinkTime / 2) then
+ if mSpdLmtBlink <= (mBlinkTime / 2) then
- mG27Leds = 0x1F
- end
+ mG27Leds = 0x1F
+ end
- if mSpdLmtBlink > (mBlinkTime / 2) then
+ if mSpdLmtBlink > (mBlinkTime / 2) then
- mG27Leds = 0
- end
+ mG27Leds = 0
+ end
elseif mSpdLimitG27Method >= 2 then
- -- speedlimiter alternate led blinking, method 2 to n
- if GetTicks() > mOldTickCount then
- mSpdLmtBlink = mSpdLmtBlink + 1
- end
+ -- speedlimiter alternate led blinking, method 2 to n
+ if GetTicks() > mOldTickCount then
+ mSpdLmtBlink = mSpdLmtBlink + 1
+ end
- if mSpdLmtBlink >= mBlinkTime then
- mSpdLmtBlink = 0
- end
+ if mSpdLmtBlink >= mBlinkTime then
+ mSpdLmtBlink = 0
+ end
- if mSpdLmtBlink <= (mBlinkTime / 2) then
+ if mSpdLmtBlink <= (mBlinkTime / 2) then
- mG27Leds = 0x0A
- end
+ mG27Leds = 0x0A
+ end
- if mSpdLmtBlink > (mBlinkTime / 2) then
+ if mSpdLmtBlink > (mBlinkTime / 2) then
- mG27Leds = 0x15
- end
+ mG27Leds = 0x15
+ end
else
- return 1
+ return 1
end
SetG27Led(mG27Leds)
-- timebase
if GetTicks() > mOldTickCount then
- mOldTickCount = GetTicks() + 20
+ mOldTickCount = GetTicks() + 20
end
return 1
end
@@ -348,9 +348,9 @@ function spdLmtFanatecMethodEvent(idx)
-- check if initialized
if isGlobalInitialized == 0 then
- isGlobalInitialized = 1
- -- init them
- InitGlobals()
+ isGlobalInitialized = 1
+ -- init them
+ InitGlobals()
end
-- get global prefs
GetSLIMaxInfo()
@@ -360,191 +360,191 @@ function spdLmtFanatecMethodEvent(idx)
SetRPMLed("mRPMLedTable")
if mNoBlink or mSpdLimitFanatecMethod == 0 then
- -- speedlimiter first rpm led NOT blinking
- SetFanatecDigitsAllowed(true)
- mRPMLedTable["RPM0"]= 1
- SetRPMLed("mRPMLedTable")
- if mLimiterChar then
- SetFanatecDigitsAllowed(false)
- SetFanatecDigits( " L " )
- oldGear = 110
- else
- SetFanatecDigitsAllowed(true)
- end
+ -- speedlimiter first rpm led NOT blinking
+ SetFanatecDigitsAllowed(true)
+ mRPMLedTable["RPM0"]= 1
+ SetRPMLed("mRPMLedTable")
+ if mLimiterChar then
+ SetFanatecDigitsAllowed(false)
+ SetFanatecDigits( " L " )
+ oldGear = 110
+ else
+ SetFanatecDigitsAllowed(true)
+ end
elseif mSpdLimitFanatecMethod == 1 then
- -- speedlimiter first rpm led blinking
- if GetTicks() > mOldTickCount then
- mSpdLmtBlink = mSpdLmtBlink + 1
- end
- if mSpdLmtBlink >= mBlinkTime then
- mSpdLmtBlink = 0
- end
-
- if mSpdLmtBlink <= (mBlinkTime / 2) then
- -- one led
- mRPMLedTable["RPM0"]= 1
-
- if mLimiterChar then
- SetFanatecDigitsAllowed(false)
- SetFanatecDigits( " L " )
- oldGear = 110
- end
- end
-
- if mSpdLmtBlink > (mBlinkTime / 2) then
- mRPMLedTable["RPM0"]= 0
- if mLimiterChar then
- oldGear = 110
- SetFanatecDigitsAllowed(true)
- end
- end
- SetRPMLed("mRPMLedTable")
+ -- speedlimiter first rpm led blinking
+ if GetTicks() > mOldTickCount then
+ mSpdLmtBlink = mSpdLmtBlink + 1
+ end
+ if mSpdLmtBlink >= mBlinkTime then
+ mSpdLmtBlink = 0
+ end
+
+ if mSpdLmtBlink <= (mBlinkTime / 2) then
+ -- one led
+ mRPMLedTable["RPM0"]= 1
+
+ if mLimiterChar then
+ SetFanatecDigitsAllowed(false)
+ SetFanatecDigits( " L " )
+ oldGear = 110
+ end
+ end
+
+ if mSpdLmtBlink > (mBlinkTime / 2) then
+ mRPMLedTable["RPM0"]= 0
+ if mLimiterChar then
+ oldGear = 110
+ SetFanatecDigitsAllowed(true)
+ end
+ end
+ SetRPMLed("mRPMLedTable")
elseif mSpdLimitFanatecMethod == 2 then
- -- speedlimiter all rpm led blinking
- if GetTicks() > mOldTickCount then
- mSpdLmtBlink = mSpdLmtBlink + 1
- end
- if mSpdLmtBlink >= mBlinkTime then
- mSpdLmtBlink = 0
- end
- if mSpdLmtBlink <= (mBlinkTime / 2) then
- initLedTable(mRPMLedTable, 1)
-
- if mLimiterChar then
- SetFanatecDigitsAllowed(false)
- SetFanatecDigits( " L " )
- oldGear = 110
- end
- end
-
- if mSpdLmtBlink > (mBlinkTime / 2) then
- initLedTable(mRPMLedTable, 0)
-
- if mLimiterChar then
- oldGear = 110
- SetFanatecDigitsAllowed(true)
- end
- end
- SetRPMLed("mRPMLedTable")
+ -- speedlimiter all rpm led blinking
+ if GetTicks() > mOldTickCount then
+ mSpdLmtBlink = mSpdLmtBlink + 1
+ end
+ if mSpdLmtBlink >= mBlinkTime then
+ mSpdLmtBlink = 0
+ end
+ if mSpdLmtBlink <= (mBlinkTime / 2) then
+ initLedTable(mRPMLedTable, 1)
+
+ if mLimiterChar then
+ SetFanatecDigitsAllowed(false)
+ SetFanatecDigits( " L " )
+ oldGear = 110
+ end
+ end
+
+ if mSpdLmtBlink > (mBlinkTime / 2) then
+ initLedTable(mRPMLedTable, 0)
+
+ if mLimiterChar then
+ oldGear = 110
+ SetFanatecDigitsAllowed(true)
+ end
+ end
+ SetRPMLed("mRPMLedTable")
elseif mSpdLimitFanatecMethod == 3 or mSpdLimitFanatecMethod > 6 then
- -- speedlimiter alternate RPM blinking
- if GetTicks() > mOldTickCount then
- mSpdLmtBlink = mSpdLmtBlink + 1
- end
- if mSpdLmtBlink >= mBlinkTime then
- mSpdLmtBlink = 0
- end
- if mSpdLmtBlink <= (mBlinkTime / 2) then
-
- for i = 0,8 do
- led = led.format("RPM%d",i)
- if (i % 2)==0 then
- mRPMLedTable[led] = 1
- else
- mRPMLedTable[led] = 0
- end
- end
- SetFanatecDigitsAllowed(false)
- if mLimiterChar then
- SetFanatecDigits( " L " )
- oldGear = 110
- else
- SetFanatecDigits( "---" )
- end
- end
-
- if mSpdLmtBlink > (mBlinkTime / 2) then
- for i = 0,8 do
- led = led.format("RPM%d",i)
- if (i % 2)==0 then
- mRPMLedTable[led] = 0
- else
- mRPMLedTable[led] = 1
- end
- end
-
- SetFanatecDigitsAllowed(true)
- end
- SetRPMLed("mRPMLedTable")
+ -- speedlimiter alternate RPM blinking
+ if GetTicks() > mOldTickCount then
+ mSpdLmtBlink = mSpdLmtBlink + 1
+ end
+ if mSpdLmtBlink >= mBlinkTime then
+ mSpdLmtBlink = 0
+ end
+ if mSpdLmtBlink <= (mBlinkTime / 2) then
+
+ for i = 0,8 do
+ led = led.format("RPM%d",i)
+ if (i % 2)==0 then
+ mRPMLedTable[led] = 1
+ else
+ mRPMLedTable[led] = 0
+ end
+ end
+ SetFanatecDigitsAllowed(false)
+ if mLimiterChar then
+ SetFanatecDigits( " L " )
+ oldGear = 110
+ else
+ SetFanatecDigits( "---" )
+ end
+ end
+
+ if mSpdLmtBlink > (mBlinkTime / 2) then
+ for i = 0,8 do
+ led = led.format("RPM%d",i)
+ if (i % 2)==0 then
+ mRPMLedTable[led] = 0
+ else
+ mRPMLedTable[led] = 1
+ end
+ end
+
+ SetFanatecDigitsAllowed(true)
+ end
+ SetRPMLed("mRPMLedTable")
elseif mSpdLimitFanatecMethod == 4 or mSpdLimitFanatecMethod == 5 then
- -- speedlimiter no led digits only
- if GetTicks() > mOldTickCount then
- mSpdLmtBlink = mSpdLmtBlink + 1
- end
-
- if mSpdLmtBlink >= mBlinkTime then
- mSpdLmtBlink = 0
- end
-
- if mSpdLmtBlink <= (mBlinkTime / 2) then
- initLedTable(mRPMLedTable, 0)
-
- if mLimiterChar then
- SetFanatecDigitsAllowed(false)
- SetFanatecDigits( " L " )
- oldGear = 110
- else
- SetFanatecDigitsAllowed(false)
- SetFanatecDigits( "---" )
- end
- end
-
- if mSpdLmtBlink > (mBlinkTime / 2) then
-
- if mSpdLimitFanatecMethod == 4 then
- SetFanatecDigitsAllowed(true)
- else
- SetFanatecDigitsAllowed(false)
- SetFanatecDigits( " " )
- end
-
- initLedTable(mRPMLedTable, 0)
- end
- SetRPMLed("mRPMLedTable")
+ -- speedlimiter no led digits only
+ if GetTicks() > mOldTickCount then
+ mSpdLmtBlink = mSpdLmtBlink + 1
+ end
+
+ if mSpdLmtBlink >= mBlinkTime then
+ mSpdLmtBlink = 0
+ end
+
+ if mSpdLmtBlink <= (mBlinkTime / 2) then
+ initLedTable(mRPMLedTable, 0)
+
+ if mLimiterChar then
+ SetFanatecDigitsAllowed(false)
+ SetFanatecDigits( " L " )
+ oldGear = 110
+ else
+ SetFanatecDigitsAllowed(false)
+ SetFanatecDigits( "---" )
+ end
+ end
+
+ if mSpdLmtBlink > (mBlinkTime / 2) then
+
+ if mSpdLimitFanatecMethod == 4 then
+ SetFanatecDigitsAllowed(true)
+ else
+ SetFanatecDigitsAllowed(false)
+ SetFanatecDigits( " " )
+ end
+
+ initLedTable(mRPMLedTable, 0)
+ end
+ SetRPMLed("mRPMLedTable")
elseif mSpdLimitFanatecMethod == 6 then
- -- speedlimiter freezed rpm + digits blinking
- if GetTicks() > mOldTickCount then
- mSpdLmtBlink = mSpdLmtBlink + 1
- end
+ -- speedlimiter freezed rpm + digits blinking
+ if GetTicks() > mOldTickCount then
+ mSpdLmtBlink = mSpdLmtBlink + 1
+ end
- if mSpdLmtBlink >= mBlinkTime then
- mSpdLmtBlink = 0
- end
+ if mSpdLmtBlink >= mBlinkTime then
+ mSpdLmtBlink = 0
+ end
- if mSpdLmtBlink <= (mBlinkTime / 2) then
- initLedTable(mRPMLedTable, 1)
+ if mSpdLmtBlink <= (mBlinkTime / 2) then
+ initLedTable(mRPMLedTable, 1)
- if mLimiterChar then
- SetFanatecDigitsAllowed(false)
- SetFanatecDigits( " L " )
- oldGear = 110
- else
- SetFanatecDigitsAllowed(true)
- end
- end
+ if mLimiterChar then
+ SetFanatecDigitsAllowed(false)
+ SetFanatecDigits( " L " )
+ oldGear = 110
+ else
+ SetFanatecDigitsAllowed(true)
+ end
+ end
- if mSpdLmtBlink > (mBlinkTime / 2) then
+ if mSpdLmtBlink > (mBlinkTime / 2) then
- SetFanatecDigitsAllowed(false)
- SetFanatecDigits( " " )
+ SetFanatecDigitsAllowed(false)
+ SetFanatecDigits( " " )
- initLedTable(mRPMLedTable, 1)
- end
- SetRPMLed("mRPMLedTable")
+ initLedTable(mRPMLedTable, 1)
+ end
+ SetRPMLed("mRPMLedTable")
else
- return 1
+ return 1
end
-- timebase
if GetTicks() > mOldTickCount then
- mOldTickCount = GetTicks() + 20
+ mOldTickCount = GetTicks() + 20
end
return 1
end
@@ -572,9 +572,9 @@ function spdLmtSRDlxMethodEvent(idx)
-- check if initialized
if isGlobalInitialized == 0 then
- isGlobalInitialized = 1
- -- init them
- InitGlobals()
+ isGlobalInitialized = 1
+ -- init them
+ InitGlobals()
end
-- get global prefs
GetSLIMaxInfo()
@@ -584,200 +584,200 @@ function spdLmtSRDlxMethodEvent(idx)
SetRPMLed("mRPMLedTable")
if mNoBlink or (mSpdLimitSRDlxMethod == 0) then
- -- speedlimiter led NOT blinking
- SetWarnLed(mSpeedLimiterLED, 1)
+ -- speedlimiter led NOT blinking
+ SetWarnLed(mSpeedLimiterLED, 1)
elseif mSpdLimitSRDlxMethod == 1 then
- -- speedlimiter led blinking, method 1
- if GetTicks() > mOldTickCount then
- mSpdLmtBlink = mSpdLmtBlink + 1
- end
+ -- speedlimiter led blinking, method 1
+ if GetTicks() > mOldTickCount then
+ mSpdLmtBlink = mSpdLmtBlink + 1
+ end
- if mSpdLmtBlink >= mBlinkTime then
- mSpdLmtBlink = 0
- end
+ if mSpdLmtBlink >= mBlinkTime then
+ mSpdLmtBlink = 0
+ end
- if mSpdLmtBlink <= (mBlinkTime / 2) then
- if mLimiterChar then SetGearDigit("L") end
- SetWarnLed(mSpeedLimiterLED, 1)
- end
+ if mSpdLmtBlink <= (mBlinkTime / 2) then
+ if mLimiterChar then SetGearDigit("L") end
+ SetWarnLed(mSpeedLimiterLED, 1)
+ end
- if mSpdLmtBlink > (mBlinkTime / 2) then
- if mLimiterChar then SetGearDigit(" ") end
- SetWarnLed(mSpeedLimiterLED, 0)
- end
+ if mSpdLmtBlink > (mBlinkTime / 2) then
+ if mLimiterChar then SetGearDigit(" ") end
+ SetWarnLed(mSpeedLimiterLED, 0)
+ end
elseif mSpdLimitSRDlxMethod == 2 then
- -- speedlimiter led + RPM blinking, method 2
- if GetTicks() > mOldTickCount then
- mSpdLmtBlink = mSpdLmtBlink + 1
- end
-
- if mSpdLmtBlink >= mBlinkTime then
- mSpdLmtBlink = 0
- end
-
- if mSpdLmtBlink <= (mBlinkTime / 2) then
- if mLimiterChar then SetGearDigit("L") end
- initLedTable(mRPMLedTable, 1)
- if not mSpdLmtRPMLedOnly then
- SetWarnLed(mSpeedLimiterLED, 1)
- end
- end
-
- if mSpdLmtBlink > (mBlinkTime / 2) then
- if mLimiterChar then SetGearDigit(" ") end
- initLedTable(mRPMLedTable, 0)
- if not mSpdLmtRPMLedOnly then
- SetWarnLed(mSpeedLimiterLED, 0)
- end
- end
- SetRPMLed("mRPMLedTable")
+ -- speedlimiter led + RPM blinking, method 2
+ if GetTicks() > mOldTickCount then
+ mSpdLmtBlink = mSpdLmtBlink + 1
+ end
+
+ if mSpdLmtBlink >= mBlinkTime then
+ mSpdLmtBlink = 0
+ end
+
+ if mSpdLmtBlink <= (mBlinkTime / 2) then
+ if mLimiterChar then SetGearDigit("L") end
+ initLedTable(mRPMLedTable, 1)
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 1)
+ end
+ end
+
+ if mSpdLmtBlink > (mBlinkTime / 2) then
+ if mLimiterChar then SetGearDigit(" ") end
+ initLedTable(mRPMLedTable, 0)
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 0)
+ end
+ end
+ SetRPMLed("mRPMLedTable")
elseif mSpdLimitSRDlxMethod == 3 then
- -- speedlimiter led + alternate RPM blinking, method 3
- if GetTicks() > mOldTickCount then
- mSpdLmtBlink = mSpdLmtBlink + 1
- end
- if mSpdLmtBlink >= mBlinkTime then
- mSpdLmtBlink = 0
- end
- if mSpdLmtBlink <= (mBlinkTime / 2) then
- if mLimiterChar then
- SetGearDigit("L")
- end
- for i = 0,12 do
- led = led.format("RPM%d",i)
- if (i % 2)==0 then
- mRPMLedTable[led] = 1
- else
- mRPMLedTable[led] = 0
- end
- end
- if not mSpdLmtRPMLedOnly then
- SetWarnLed(mSpeedLimiterLED, 1)
- end
- end
-
- if mSpdLmtBlink > (mBlinkTime / 2) then
- if mLimiterChar then
- SetGearDigit(" ")
- end
- for i = 0,13 do
- led = led.format("RPM%d",i)
- if (i % 2)==0 then
- mRPMLedTable[led] = 0
- else
- mRPMLedTable[led] = 1
- end
- end
- if not mSpdLmtRPMLedOnly then
- SetWarnLed(mSpeedLimiterLED, 0)
- end
- end
- SetRPMLed("mRPMLedTable")
+ -- speedlimiter led + alternate RPM blinking, method 3
+ if GetTicks() > mOldTickCount then
+ mSpdLmtBlink = mSpdLmtBlink + 1
+ end
+ if mSpdLmtBlink >= mBlinkTime then
+ mSpdLmtBlink = 0
+ end
+ if mSpdLmtBlink <= (mBlinkTime / 2) then
+ if mLimiterChar then
+ SetGearDigit("L")
+ end
+ for i = 0,12 do
+ led = led.format("RPM%d",i)
+ if (i % 2)==0 then
+ mRPMLedTable[led] = 1
+ else
+ mRPMLedTable[led] = 0
+ end
+ end
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 1)
+ end
+ end
+
+ if mSpdLmtBlink > (mBlinkTime / 2) then
+ if mLimiterChar then
+ SetGearDigit(" ")
+ end
+ for i = 0,13 do
+ led = led.format("RPM%d",i)
+ if (i % 2)==0 then
+ mRPMLedTable[led] = 0
+ else
+ mRPMLedTable[led] = 1
+ end
+ end
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 0)
+ end
+ end
+ SetRPMLed("mRPMLedTable")
elseif mSpdLimitSRDlxMethod == 4 then
- -- speedlimiter led + RPM + digits blinking, method 4
- if GetTicks() > mOldTickCount then
- mSpdLmtBlink = mSpdLmtBlink + 1
- end
-
- if mSpdLmtBlink >= mBlinkTime then
- mSpdLmtBlink = 0
- end
-
- if mSpdLmtBlink <= (mBlinkTime / 2) then
-
- if mLimiterChar then SetGearDigit("L") end
- SetDigitsAllowed(true)
-
- for i = 0,2 do
- led = led.format("RPM%d",i)
- mRPMLedTable[led] = 0
- end
- for i = 10,12 do
- led = led.format("RPM%d",i)
- mRPMLedTable[led] = 0
- end
-
- if not mSpdLmtRPMLedOnly then
- SetWarnLed(mSpeedLimiterLED, 0)
- end
- end
-
- if mSpdLmtBlink > (mBlinkTime / 2) then
- if mLimiterChar then SetGearDigit(" ") end
-
- SetDigitsAllowed(false)
-
- SetLeftDigits (mLeftSpdLmtText)
- SetRightDigits (mRightSpdLmtText)
-
- for i = 0,2 do
- led = led.format("RPM%d",i)
- mRPMLedTable[led] = 1
- end
- for i = 10,12 do
- led = led.format("RPM%d",i)
- mRPMLedTable[led] = 1
- end
- if not mSpdLmtRPMLedOnly then
- SetWarnLed(mSpeedLimiterLED, 0)
- end
- end
- SetRPMLed("mRPMLedTable")
+ -- speedlimiter led + RPM + digits blinking, method 4
+ if GetTicks() > mOldTickCount then
+ mSpdLmtBlink = mSpdLmtBlink + 1
+ end
+
+ if mSpdLmtBlink >= mBlinkTime then
+ mSpdLmtBlink = 0
+ end
+
+ if mSpdLmtBlink <= (mBlinkTime / 2) then
+
+ if mLimiterChar then SetGearDigit("L") end
+ SetDigitsAllowed(true)
+
+ for i = 0,2 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 0
+ end
+ for i = 10,12 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 0
+ end
+
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 0)
+ end
+ end
+
+ if mSpdLmtBlink > (mBlinkTime / 2) then
+ if mLimiterChar then SetGearDigit(" ") end
+
+ SetDigitsAllowed(false)
+
+ SetLeftDigits (mLeftSpdLmtText)
+ SetRightDigits (mRightSpdLmtText)
+
+ for i = 0,2 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 1
+ end
+ for i = 10,12 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 1
+ end
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 0)
+ end
+ end
+ SetRPMLed("mRPMLedTable")
elseif mSpdLimitSRDlxMethod == 5 or mSpdLimitSRDlxMethod == 6 then
- -- speedlimiter led + digits blinking, method 5
- -- speedlimiter led + RPM fixed + Digits blinking, method 6
- if GetTicks() > mOldTickCount then
- mSpdLmtBlink = mSpdLmtBlink + 1
- end
+ -- speedlimiter led + digits blinking, method 5
+ -- speedlimiter led + RPM fixed + Digits blinking, method 6
+ if GetTicks() > mOldTickCount then
+ mSpdLmtBlink = mSpdLmtBlink + 1
+ end
- if mSpdLmtBlink >= mBlinkTime then
- mSpdLmtBlink = 0
- end
+ if mSpdLmtBlink >= mBlinkTime then
+ mSpdLmtBlink = 0
+ end
- if mSpdLmtBlink <= (mBlinkTime / 2) then
- if mLimiterChar then SetGearDigit("L") end
+ if mSpdLmtBlink <= (mBlinkTime / 2) then
+ if mLimiterChar then SetGearDigit("L") end
- SetDigitsAllowed (true)
+ SetDigitsAllowed (true)
- local state = 0
- if mSpdLimitSRDlxMethod == 6 then state = 1 end
- initLedTable(mRPMLedTable, state)
+ local state = 0
+ if mSpdLimitSRDlxMethod == 6 then state = 1 end
+ initLedTable(mRPMLedTable, state)
- if not mSpdLmtRPMLedOnly then
- SetWarnLed(mSpeedLimiterLED, 0)
- end
- end
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 0)
+ end
+ end
- if mSpdLmtBlink > (mBlinkTime / 2) then
- if mLimiterChar then SetGearDigit(" ") end
+ if mSpdLmtBlink > (mBlinkTime / 2) then
+ if mLimiterChar then SetGearDigit(" ") end
- SetLeftDigits ( mLeftSpdLmtText)
- SetRightDigits ( mRightSpdLmtText)
+ SetLeftDigits ( mLeftSpdLmtText)
+ SetRightDigits ( mRightSpdLmtText)
- SetDigitsAllowed(false)
+ SetDigitsAllowed(false)
- local state = 0
- if mSpdLimitSRDlxMethod == 6 then state = 1 end
- initLedTable(mRPMLedTable, state)
+ local state = 0
+ if mSpdLimitSRDlxMethod == 6 then state = 1 end
+ initLedTable(mRPMLedTable, state)
- if not mSpdLmtRPMLedOnly then
- SetWarnLed(mSpeedLimiterLED, 0)
- end
- end
- SetRPMLed("mRPMLedTable")
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 0)
+ end
+ end
+ SetRPMLed("mRPMLedTable")
else
- return 1
+ return 1
end
-- timebase
if GetTicks() > mOldTickCount then
- mOldTickCount = GetTicks() + 20
+ mOldTickCount = GetTicks() + 20
end
return 1
end
@@ -804,9 +804,9 @@ function spdLmtSRF1MethodEvent(idx)
-- check if initialized
if isGlobalInitialized == 0 then
- isGlobalInitialized = 1
- -- init them
- InitGlobals()
+ isGlobalInitialized = 1
+ -- init them
+ InitGlobals()
end
-- get global prefs
GetSLIMaxInfo()
@@ -816,201 +816,201 @@ function spdLmtSRF1MethodEvent(idx)
SetRPMLed("mRPMLedTable")
if mNoBlink or (mSpdLimitSRF1Method == 0) then
- -- speedlimiter led NOT blinking
- SetWarnLed(mSpeedLimiterLED, 1)
+ -- speedlimiter led NOT blinking
+ SetWarnLed(mSpeedLimiterLED, 1)
elseif mSpdLimitSRF1Method == 1 then
- -- speedlimiter led blinking, method 1
- if GetTicks() > mOldTickCount then
- mSpdLmtBlink = mSpdLmtBlink + 1
- end
+ -- speedlimiter led blinking, method 1
+ if GetTicks() > mOldTickCount then
+ mSpdLmtBlink = mSpdLmtBlink + 1
+ end
- if mSpdLmtBlink >= mBlinkTime then
- mSpdLmtBlink = 0
- end
+ if mSpdLmtBlink >= mBlinkTime then
+ mSpdLmtBlink = 0
+ end
- if mSpdLmtBlink <= (mBlinkTime / 2) then
- if mLimiterChar then SetGearDigit("L") end
- SetWarnLed(mSpeedLimiterLED, 1)
- end
+ if mSpdLmtBlink <= (mBlinkTime / 2) then
+ if mLimiterChar then SetGearDigit("L") end
+ SetWarnLed(mSpeedLimiterLED, 1)
+ end
- if mSpdLmtBlink > (mBlinkTime / 2) then
- if mLimiterChar then SetGearDigit(" ") end
- SetWarnLed(mSpeedLimiterLED, 0)
- end
+ if mSpdLmtBlink > (mBlinkTime / 2) then
+ if mLimiterChar then SetGearDigit(" ") end
+ SetWarnLed(mSpeedLimiterLED, 0)
+ end
elseif mSpdLimitSRF1Method == 2 then
- -- speedlimiter led + RPM blinking, method 2
- if GetTicks() > mOldTickCount then
- mSpdLmtBlink = mSpdLmtBlink + 1
- end
-
- if mSpdLmtBlink >= mBlinkTime then
- mSpdLmtBlink = 0
- end
-
- if mSpdLmtBlink <= (mBlinkTime / 2) then
- if mLimiterChar then SetGearDigit("L") end
- initLedTable(mRPMLedTable, 1)
- if not mSpdLmtRPMLedOnly then
- SetWarnLed(mSpeedLimiterLED, 1)
- end
- end
-
- if mSpdLmtBlink > (mBlinkTime / 2) then
- if mLimiterChar then SetGearDigit(" ") end
- initLedTable(mRPMLedTable, 0)
- if not mSpdLmtRPMLedOnly then
- SetWarnLed(mSpeedLimiterLED, 0)
- end
- end
- SetRPMLed("mRPMLedTable")
+ -- speedlimiter led + RPM blinking, method 2
+ if GetTicks() > mOldTickCount then
+ mSpdLmtBlink = mSpdLmtBlink + 1
+ end
+
+ if mSpdLmtBlink >= mBlinkTime then
+ mSpdLmtBlink = 0
+ end
+
+ if mSpdLmtBlink <= (mBlinkTime / 2) then
+ if mLimiterChar then SetGearDigit("L") end
+ initLedTable(mRPMLedTable, 1)
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 1)
+ end
+ end
+
+ if mSpdLmtBlink > (mBlinkTime / 2) then
+ if mLimiterChar then SetGearDigit(" ") end
+ initLedTable(mRPMLedTable, 0)
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 0)
+ end
+ end
+ SetRPMLed("mRPMLedTable")
elseif mSpdLimitSRF1Method == 3 then
- -- speedlimiter led + alternate RPM blinking, method 3
- if GetTicks() > mOldTickCount then
- mSpdLmtBlink = mSpdLmtBlink + 1
- end
- if mSpdLmtBlink >= mBlinkTime then
- mSpdLmtBlink = 0
- end
- if mSpdLmtBlink <= (mBlinkTime / 2) then
- if mLimiterChar then
- SetGearDigit("L")
- end
- for i = 0,14 do
- led = led.format("RPM%d",i)
- if (i % 2)==0 then
- mRPMLedTable[led] = 1
- else
- mRPMLedTable[led] = 0
- end
- end
- if not mSpdLmtRPMLedOnly then
- SetWarnLed(mSpeedLimiterLED, 1)
- end
- end
-
- if mSpdLmtBlink > (mBlinkTime / 2) then
- if mLimiterChar then
- SetGearDigit(" ")
- end
- for i = 0,15 do
- led = led.format("RPM%d",i)
- if (i % 2)==0 then
- mRPMLedTable[led] = 0
- else
- mRPMLedTable[led] = 1
- end
- end
- if not mSpdLmtRPMLedOnly then
- SetWarnLed(mSpeedLimiterLED, 0)
- end
- end
- SetRPMLed("mRPMLedTable")
+ -- speedlimiter led + alternate RPM blinking, method 3
+ if GetTicks() > mOldTickCount then
+ mSpdLmtBlink = mSpdLmtBlink + 1
+ end
+ if mSpdLmtBlink >= mBlinkTime then
+ mSpdLmtBlink = 0
+ end
+ if mSpdLmtBlink <= (mBlinkTime / 2) then
+ if mLimiterChar then
+ SetGearDigit("L")
+ end
+ for i = 0,14 do
+ led = led.format("RPM%d",i)
+ if (i % 2)==0 then
+ mRPMLedTable[led] = 1
+ else
+ mRPMLedTable[led] = 0
+ end
+ end
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 1)
+ end
+ end
+
+ if mSpdLmtBlink > (mBlinkTime / 2) then
+ if mLimiterChar then
+ SetGearDigit(" ")
+ end
+ for i = 0,15 do
+ led = led.format("RPM%d",i)
+ if (i % 2)==0 then
+ mRPMLedTable[led] = 0
+ else
+ mRPMLedTable[led] = 1
+ end
+ end
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 0)
+ end
+ end
+ SetRPMLed("mRPMLedTable")
elseif mSpdLimitSRF1Method == 4 then
- -- speedlimiter led + RPM + digits blinking, method 4
- if GetTicks() > mOldTickCount then
- mSpdLmtBlink = mSpdLmtBlink + 1
- end
-
- if mSpdLmtBlink >= mBlinkTime then
- mSpdLmtBlink = 0
- end
-
- if mSpdLmtBlink <= (mBlinkTime / 2) then
-
- if mLimiterChar then SetGearDigit("L") end
- SetDigitsAllowed(true)
-
- for i = 0,4 do
- led = led.format("RPM%d",i)
- mRPMLedTable[led] = 0
- end
- for i = 10,14 do
- led = led.format("RPM%d",i)
- mRPMLedTable[led] = 0
- end
-
- if not mSpdLmtRPMLedOnly then
- SetWarnLed(mSpeedLimiterLED, 0)
- end
- end
-
- if mSpdLmtBlink > (mBlinkTime / 2) then
- if mLimiterChar then SetGearDigit(" ") end
-
- SetDigitsAllowed(false)
-
- SetLeftDigits (mLeftSpdLmtText)
- SetRightDigits (mRightSpdLmtText)
-
- for i = 0,4 do
- led = led.format("RPM%d",i)
- mRPMLedTable[led] = 1
- end
- for i = 10,14 do
- led = led.format("RPM%d",i)
- mRPMLedTable[led] = 1
- end
- if not mSpdLmtRPMLedOnly then
- SetWarnLed(mSpeedLimiterLED, 0)
- end
- end
- SetRPMLed("mRPMLedTable")
+ -- speedlimiter led + RPM + digits blinking, method 4
+ if GetTicks() > mOldTickCount then
+ mSpdLmtBlink = mSpdLmtBlink + 1
+ end
+
+ if mSpdLmtBlink >= mBlinkTime then
+ mSpdLmtBlink = 0
+ end
+
+ if mSpdLmtBlink <= (mBlinkTime / 2) then
+
+ if mLimiterChar then SetGearDigit("L") end
+ SetDigitsAllowed(true)
+
+ for i = 0,4 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 0
+ end
+ for i = 10,14 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 0
+ end
+
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 0)
+ end
+ end
+
+ if mSpdLmtBlink > (mBlinkTime / 2) then
+ if mLimiterChar then SetGearDigit(" ") end
+
+ SetDigitsAllowed(false)
+
+ SetLeftDigits (mLeftSpdLmtText)
+ SetRightDigits (mRightSpdLmtText)
+
+ for i = 0,4 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 1
+ end
+ for i = 10,14 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 1
+ end
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 0)
+ end
+ end
+ SetRPMLed("mRPMLedTable")
elseif mSpdLimitSRF1Method == 5 or mSpdLimitSRF1Method == 6 then
- -- speedlimiter led + digits blinking, method 5
- -- speedlimiter led + RPM fixed + Digits blinking, method 6
- if GetTicks() > mOldTickCount then
- mSpdLmtBlink = mSpdLmtBlink + 1
- end
+ -- speedlimiter led + digits blinking, method 5
+ -- speedlimiter led + RPM fixed + Digits blinking, method 6
+ if GetTicks() > mOldTickCount then
+ mSpdLmtBlink = mSpdLmtBlink + 1
+ end
- if mSpdLmtBlink >= mBlinkTime then
- mSpdLmtBlink = 0
- end
+ if mSpdLmtBlink >= mBlinkTime then
+ mSpdLmtBlink = 0
+ end
- if mSpdLmtBlink <= (mBlinkTime / 2) then
- if mLimiterChar then SetGearDigit("L") end
+ if mSpdLmtBlink <= (mBlinkTime / 2) then
+ if mLimiterChar then SetGearDigit("L") end
- SetDigitsAllowed (true)
+ SetDigitsAllowed (true)
- local state = 0
- if mSpdLimitSRF1Method == 6 then state = 1 end
- initLedTable(mRPMLedTable, state)
+ local state = 0
+ if mSpdLimitSRF1Method == 6 then state = 1 end
+ initLedTable(mRPMLedTable, state)
- if not mSpdLmtRPMLedOnly then
- SetWarnLed(mSpeedLimiterLED, 0)
- end
- end
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 0)
+ end
+ end
- if mSpdLmtBlink > (mBlinkTime / 2) then
- if mLimiterChar then SetGearDigit(" ") end
+ if mSpdLmtBlink > (mBlinkTime / 2) then
+ if mLimiterChar then SetGearDigit(" ") end
- SetLeftDigits ( mLeftSpdLmtText)
- SetRightDigits ( mRightSpdLmtText)
+ SetLeftDigits ( mLeftSpdLmtText)
+ SetRightDigits ( mRightSpdLmtText)
- SetDigitsAllowed(false)
+ SetDigitsAllowed(false)
- local state = 0
- if mSpdLimitSRF1Method == 6 then state = 1 end
- initLedTable(mRPMLedTable, state)
+ local state = 0
+ if mSpdLimitSRF1Method == 6 then state = 1 end
+ initLedTable(mRPMLedTable, state)
- if not mSpdLmtRPMLedOnly then
- SetWarnLed(mSpeedLimiterLED, 0)
- end
- end
- SetRPMLed("mRPMLedTable")
+ if not mSpdLmtRPMLedOnly then
+ SetWarnLed(mSpeedLimiterLED, 0)
+ end
+ end
+ SetRPMLed("mRPMLedTable")
else
- return 1
+ return 1
end
-- timebase
if GetTicks() > mOldTickCount then
- mOldTickCount = GetTicks() + 20
+ mOldTickCount = GetTicks() + 20
end
return 1
-end
+end \ No newline at end of file
diff --git a/scripts/zdoc_scripts/iracing_common_scripts.lua b/scripts/zdoc_scripts/iracing_common_scripts.lua
index 1da0e2d..9b97e7a 100644
--- a/scripts/zdoc_scripts/iracing_common_scripts.lua
+++ b/scripts/zdoc_scripts/iracing_common_scripts.lua
@@ -1,219 +1,219 @@
--- iRacing SLI-PRO Custom SLIMax Manager Scripts v3.2.2
--- Copyright ©2012-2013 by Zappadoc - All Rights Reserved.
--- last change by Zappadoc - 2013-10
-
--- ================================
--- CONSTANTS
-
-
--- ================================
--- additional lua extension module dll
-
-
--- ================================
--- additional scripts file
-require "scripts/zdoc_scripts/iracing_stuff"
-
--- ================================
--- custom globals
-
-
--- ================================
--- custom functions
-
--- ================================
--- custom events
-
-function custom_initEvent(scriptfile)
- -- type your custom script initialization here
- -- if iRacingZDocComboInitialized == nil then
- -- iRacingZDocComboInitialized = true
- -- local devStr = GetDeviceType(GetContextInfo("devicetype"))
- -- if devStr == nil then devStr = "Unknown" end
- -- local str = string.format("iRacing Combo Setup (settings + scripts)\n©2012-2013 By zappadoc, All Rights Reserved.\n\nInitialized for device: %s\n\nReminder: A COMBO SETUP automatically chooses for you the best corresponding settings in the car you are currently driving. Change to a simple setup if you want to set up the car by yourself using Basic or Advanced Options panel.", devStr )
- -- SMXMessageBox(str)
- -- end
-end
-
--- function custom_controlsEvent(deviceType, ctrlType, ctrlPos, value, funcIndex)
- -- -- type your custom controls script here (manage buttons, switches and encoders)
- -- return 2
--- end
-
--- function custom_deviceReport(deviceType)
- -- -- type your script here (just before sending report to the device )
- -- return 2
--- end
-
-function UnifyOSPMethod(idx, device)
- -- custom OSP for each iRacing car
- local result = 2
- -- get current simulation name
- local sim = GetContextInfo("simulation")
- if isAppIRacing(sim) then
- result = iRacing_ospMethodEvent(idx, device)
- end
- return result
-end
-
-function custom_ospMethodEvent(idx)
- -- type your custom Optimal Shift Points (OSP) method here
-
- return UnifyOSPMethod(idx, "SLI")
-end
-
-function custom_ospFanatecMethodEvent(idx)
- -- type your custom Optimal Shift Points (OSP) method here
- -- custom speedlimiter for each iRacing car
- return UnifyOSPMethod(idx, "FANATEC")
-end
-
-function custom_ospSRDlxMethodEvent(idx)
- -- type your custom Optimal Shift Points (OSP) method here
- -- custom speedlimiter for each iRacing car
- return UnifyOSPMethod(idx, "SRDLX")
-end
-function custom_ospSRF1MethodEvent(idx)
- -- type your custom Optimal Shift Points (OSP) method here
- -- custom speedlimiter for each iRacing car
- return UnifyOSPMethod(idx, "SRF1")
-end
-
---==================================================
-
-function UnifyShiftlightsMethod(idx, device)
- -- custom shiftlights for each iRacing car
- -- get current simulation name
- local sim = GetContextInfo("simulation")
- if isAppIRacing(sim) then
- iRacing_shiftLightsMethodEvent(idx, device)
- -- skip std methods
- return 1
- end
- return 2
-end
-
-function custom_shiftLightsSRDlxMethodEvent(idx)
- -- type your custom shiftlights method here
-
- return UnifyShiftlightsMethod(idx, "SRDLX")
-end
-
-function custom_shiftLightsMethodEvent(idx)
- -- type your custom shiftlights method here
-
- return UnifyShiftlightsMethod(idx, "SLI")
-end
-
-function custom_shiftLightsFanatecMethodEvent(idx)
- -- type your custom shiftlights method here
-
- return UnifyShiftlightsMethod(idx, "FANATEC")
-end
-
-function custom_shiftLightsSRF1MethodEvent(idx)
- -- type your custom shiftlights method here
-
- return UnifyShiftlightsMethod(idx, "SRF1")
-end
-
--- function custom_shiftLightsBU0710Event(idx)
- -- -- type your custom shiftlights method for BU0710 device only here
- -- return 2
--- end
-
--- function custom_leftDigitsEvent(swPosition)
- -- -- type your custom script related to left SLI-PRO digits panel here
- -- return 2
--- end
-
--- function custom_rightDigitsEvent(swPosition)
- -- -- type your custom script related to right SLI-PRO digits panel here
- -- return 2
--- end
-
--- function custom_fanatecDigitsEvent(swPosition)
- -- -- type your custom script related to Fanatec digits panel here
- -- return 2
--- end
-
---==================================================
-
-function UnifySpeedlimiterMethod(idx, device)
- -- type your custom speedlimiter method here
-
- -- custom speedlimiter for each iRacing car
- local result = 2
- -- get current simulation name
- local sim = GetContextInfo("simulation")
- if isAppIRacing(sim) then
- result = iRacing_spdLmtMethodEvent(idx, device)
- end
- return result
-end
-
-function custom_spdLmtMethodEvent(idx)
- -- type your custom speedlimiter method here
-
- return UnifySpeedlimiterMethod(idx, "SLI")
-end
-
-function custom_spdLmtFanatecMethodEvent(idx)
- -- type your custom Optimal Shift Points (OSP) method here
-
- return UnifySpeedlimiterMethod(idx, "FANATEC")
-end
-
-function custom_spdLmtSRDlxMethodEvent(idx)
- -- type your custom Optimal Shift Points (OSP) method here
-
- return UnifySpeedlimiterMethod(idx, "SRDLX")
-end
-
-function custom_spdLmtSRF1MethodEvent(idx)
- -- type your custom Optimal Shift Points (OSP) method here
-
- return UnifySpeedlimiterMethod(idx, "SRF1")
-end
---==================================================
-
-function UnifyGearEvent(gear)
- local sim = GetContextInfo("simulation")
- if isAppIRacing(sim) then
- iRacing_InitGearEvent(gear)
- end
-end
-
-function custom_gearFanatecEvent(gear)
- -- type your custom gear event script here
-
- UnifyGearEvent(gear)
- return 2
-end
-
-function custom_gearEvent(gear)
- -- type your custom gear event script here
-
- UnifyGearEvent(gear)
- return 2
-end
-
---==================================================
-
-function custom_enterSessionEvent(deviceType)
- -- type your custom script on session start, here
-
- -- custom script to get the max gear of each iRacing car
- -- get current simulation name
- local sim = GetContextInfo("simulation")
- if isAppIRacing(sim ) then
- iRacing_CarSetup(0)
- iRacing_DebugCarInfo(deviceType)
- end
- return 2
-end
-
--- function custom_exitSessionEvent(deviceType)
- -- -- type your custom script on session ending, here
- -- return 2
+-- iRacing SLI-PRO Custom SLIMax Manager Scripts v3.2.2
+-- Copyright ©2012-2013 by Zappadoc - All Rights Reserved.
+-- last change by Zappadoc - 2013-10
+
+-- ================================
+-- CONSTANTS
+
+
+-- ================================
+-- additional lua extension module dll
+
+
+-- ================================
+-- additional scripts file
+require "scripts/zdoc_scripts/iracing_stuff"
+
+-- ================================
+-- custom globals
+
+
+-- ================================
+-- custom functions
+
+-- ================================
+-- custom events
+
+function custom_initEvent(scriptfile)
+ -- type your custom script initialization here
+ -- if iRacingZDocComboInitialized == nil then
+ -- iRacingZDocComboInitialized = true
+ -- local devStr = GetDeviceType(GetContextInfo("devicetype"))
+ -- if devStr == nil then devStr = "Unknown" end
+ -- local str = string.format("iRacing Combo Setup (settings + scripts)\n©2012-2013 By zappadoc, All Rights Reserved.\n\nInitialized for device: %s\n\nReminder: A COMBO SETUP automatically chooses for you the best corresponding settings in the car you are currently driving. Change to a simple setup if you want to set up the car by yourself using Basic or Advanced Options panel.", devStr )
+ -- SMXMessageBox(str)
+ -- end
+end
+
+-- function custom_controlsEvent(deviceType, ctrlType, ctrlPos, value, funcIndex)
+ -- -- type your custom controls script here (manage buttons, switches and encoders)
+ -- return 2
+-- end
+
+-- function custom_deviceReport(deviceType)
+ -- -- type your script here (just before sending report to the device )
+ -- return 2
+-- end
+
+function UnifyOSPMethod(idx, device)
+ -- custom OSP for each iRacing car
+ local result = 2
+ -- get current simulation name
+ local sim = GetContextInfo("simulation")
+ if isAppIRacing(sim) then
+ result = iRacing_ospMethodEvent(idx, device)
+ end
+ return result
+end
+
+function custom_ospMethodEvent(idx)
+ -- type your custom Optimal Shift Points (OSP) method here
+
+ return UnifyOSPMethod(idx, "SLI")
+end
+
+function custom_ospFanatecMethodEvent(idx)
+ -- type your custom Optimal Shift Points (OSP) method here
+ -- custom speedlimiter for each iRacing car
+ return UnifyOSPMethod(idx, "FANATEC")
+end
+
+function custom_ospSRDlxMethodEvent(idx)
+ -- type your custom Optimal Shift Points (OSP) method here
+ -- custom speedlimiter for each iRacing car
+ return UnifyOSPMethod(idx, "SRDLX")
+end
+function custom_ospSRF1MethodEvent(idx)
+ -- type your custom Optimal Shift Points (OSP) method here
+ -- custom speedlimiter for each iRacing car
+ return UnifyOSPMethod(idx, "SRF1")
+end
+
+--==================================================
+
+function UnifyShiftlightsMethod(idx, device)
+ -- custom shiftlights for each iRacing car
+ -- get current simulation name
+ local sim = GetContextInfo("simulation")
+ if isAppIRacing(sim) then
+ iRacing_shiftLightsMethodEvent(idx, device)
+ -- skip std methods
+ return 1
+ end
+ return 2
+end
+
+function custom_shiftLightsSRDlxMethodEvent(idx)
+ -- type your custom shiftlights method here
+
+ return UnifyShiftlightsMethod(idx, "SRDLX")
+end
+
+function custom_shiftLightsMethodEvent(idx)
+ -- type your custom shiftlights method here
+
+ return UnifyShiftlightsMethod(idx, "SLI")
+end
+
+function custom_shiftLightsFanatecMethodEvent(idx)
+ -- type your custom shiftlights method here
+
+ return UnifyShiftlightsMethod(idx, "FANATEC")
+end
+
+function custom_shiftLightsSRF1MethodEvent(idx)
+ -- type your custom shiftlights method here
+
+ return UnifyShiftlightsMethod(idx, "SRF1")
+end
+
+-- function custom_shiftLightsBU0710Event(idx)
+ -- -- type your custom shiftlights method for BU0710 device only here
+ -- return 2
+-- end
+
+-- function custom_leftDigitsEvent(swPosition)
+ -- -- type your custom script related to left SLI-PRO digits panel here
+ -- return 2
+-- end
+
+-- function custom_rightDigitsEvent(swPosition)
+ -- -- type your custom script related to right SLI-PRO digits panel here
+ -- return 2
+-- end
+
+-- function custom_fanatecDigitsEvent(swPosition)
+ -- -- type your custom script related to Fanatec digits panel here
+ -- return 2
+-- end
+
+--==================================================
+
+function UnifySpeedlimiterMethod(idx, device)
+ -- type your custom speedlimiter method here
+
+ -- custom speedlimiter for each iRacing car
+ local result = 2
+ -- get current simulation name
+ local sim = GetContextInfo("simulation")
+ if isAppIRacing(sim) then
+ result = iRacing_spdLmtMethodEvent(idx, device)
+ end
+ return result
+end
+
+function custom_spdLmtMethodEvent(idx)
+ -- type your custom speedlimiter method here
+
+ return UnifySpeedlimiterMethod(idx, "SLI")
+end
+
+function custom_spdLmtFanatecMethodEvent(idx)
+ -- type your custom Optimal Shift Points (OSP) method here
+
+ return UnifySpeedlimiterMethod(idx, "FANATEC")
+end
+
+function custom_spdLmtSRDlxMethodEvent(idx)
+ -- type your custom Optimal Shift Points (OSP) method here
+
+ return UnifySpeedlimiterMethod(idx, "SRDLX")
+end
+
+function custom_spdLmtSRF1MethodEvent(idx)
+ -- type your custom Optimal Shift Points (OSP) method here
+
+ return UnifySpeedlimiterMethod(idx, "SRF1")
+end
+--==================================================
+
+function UnifyGearEvent(gear)
+ local sim = GetContextInfo("simulation")
+ if isAppIRacing(sim) then
+ iRacing_InitGearEvent(gear)
+ end
+end
+
+function custom_gearFanatecEvent(gear)
+ -- type your custom gear event script here
+
+ UnifyGearEvent(gear)
+ return 2
+end
+
+function custom_gearEvent(gear)
+ -- type your custom gear event script here
+
+ UnifyGearEvent(gear)
+ return 2
+end
+
+--==================================================
+
+function custom_enterSessionEvent(deviceType)
+ -- type your custom script on session start, here
+
+ -- custom script to get the max gear of each iRacing car
+ -- get current simulation name
+ local sim = GetContextInfo("simulation")
+ if isAppIRacing(sim ) then
+ iRacing_CarSetup(0)
+ iRacing_DebugCarInfo(deviceType)
+ end
+ return 2
+end
+
+-- function custom_exitSessionEvent(deviceType)
+ -- -- type your custom script on session ending, here
+ -- return 2
-- end \ No newline at end of file
diff --git a/scripts/zdoc_scripts/iracing_stuff.lua b/scripts/zdoc_scripts/iracing_stuff.lua
index ee942d6..d0df9db 100644
--- a/scripts/zdoc_scripts/iracing_stuff.lua
+++ b/scripts/zdoc_scripts/iracing_stuff.lua
@@ -1,535 +1,535 @@
--- Custom SLIMax Manager Scripts for iRacing v3.2.1
--- Copyright ©2012-2013 by Zappadoc
--- _last change by Zappadoc - 2013-10
-
--- =====================================
--- iRacing Stuff script
--- define car setup function and all pit limiter and shiftlights methods for each car you drive
-function iRacing_DebugCarInfo(deviceType)
- -- see debug console window
- -- get car name
- local dev = GetDeviceType(deviceType)
- local cNm = GetContextInfo("carname")
- local mxG = GetCarInfo("maxgear")
- local rdz = GetCarInfo("redzone")
- local ospf = GetContextInfo("ospfactor")
- print("\n----------\nDevice:"..dev.."\nSetup car:" .. cNm .. "(" .. rdz .. ")" .. "\nMaxGear:" .. mxG .. "\nOSP Factor:" .. ospf .. "\n");
-end
-
-function iRacing_InitGearEvent(gear)
- -- get current simulation name
- -- custom script to overwrite OSP value and OSP limit for each gear of each iRacing car
- local sim = GetContextInfo("simulation")
- if isAppIRacing(sim) then
- if gOldGear == nil then gOldGear = -2 end
- -- setup iRacing car OSP, RedZone, Max gear, ...
- iRacing_CarSetup(gear)
- if gear ~= gOldGear then
- gOldGear = gear
- end
- end
-end
-
-function iRacing_CarSetup(cGear)
- -- get car name
- local cNm = ""
- cNm = GetContextInfo("carname")
- local mxG = 4
- local ospf = 140
-
- if cNm == "cadillacctsvr" then
- mxG = 6
- ospf = 148
-
- elseif cNm == "mclarenmp4" then
- mxG = 6
- ospf = 150
-
- elseif cNm == "kiaoptima" then
- mxG = 5
- ospf = 150
-
- elseif cNm == "formulamazda" then
- mxG = 6
- ospf = 60
-
- elseif cNm == "williamsfw31" then
- mxG = 7
- ospf = 90
-
- elseif cNm == "mx5 cup" or cNm == "mx5 roadster" then
- mxG = 6
- ospf = 140
-
- elseif cNm == "hpdarx01c" then
- mxG = 6
- if cGear <= 2 then
- ospf = 10
- gOSPLimit = 9900
- gRedZone = 9920
- elseif cGear ==3 then
- ospf = 100
- gOSPLimit = 9530
- gRedZone = 9545
- elseif cGear == 4 then
- ospf = 90
- gOSPLimit = 9500
- gRedZone = 9510
- else
- ospf = 150
- gOSPLimit = 9420
- gRedZone = 9425
- end
-
-
- elseif cNm == "fordgt" then
- mxG = 6
- ospf = 128
-
- elseif cNm == "fr500s" then
- mxG = 6
- ospf = 150
-
- elseif cNm == "fordv8sc" then
- mxG = 6
- ospf = 100
-
- elseif cNm == "dallara" then
- mxG = 6
- ospf = 95
-
- elseif cNm == "latemodel" then
- mxG = 5
-
- elseif cNm == "legends ford34c" then
- mxG = 5
- ospf = 150
-
- elseif cNm == "skmodified" then
- mxG = 6
-
- elseif cNm == "silvercrown" then
- mxG = 6
-
- elseif cNm == "trucks silverado" then
- mxG = 4
-
- elseif cNm == "stockcars impala" then
- mxG = 4
- ospf = 140
-
- elseif cNm == "lotus79" then
- mxG = 5
- ospf = 100
-
- elseif cNm == "stockcars2 chevy" then
- mxG = 4
- ospf = 130
-
- elseif cNm == "stockcars2 chevy cot" then
- mxG = 4
- ospf = 150
-
- elseif cNm == "c6r" then
- mxG = 6
- ospf = 145
-
- elseif cNm == "solstice" then
- mxG = 5
- ospf = 150
-
- elseif cNm == "jettatdi" then
- mxG = 5
-
- elseif cNm == "radical sr8" then
- mxG = 6
- ospf = 115
-
- elseif cNm == "rt2000" then
- mxG = 5
- ospf = 140
-
- elseif cNm == "specracer" then
- mxG = 5
- ospf = 140
-
- elseif cNm == "rileydp" then
- mxG = 5
- ospf = 85
-
- elseif cNm == "streetstock" then
- mxG = 4
- ospf = 150
-
- elseif cNm == "sprint" then
- mxG = 6
-
- else
- -- default
- mxG = 4
- ospf = 150
- end
- -- set max gear and OSP factor for this car
- SetMaxGear(mxG)
- SetOSPFactor(ospf)
-end
-
-function FixRPMSpeedlimiter()
- local led = ""
- -- init table
- initLedTable(mRPMLedTable, 0)
- SetRPMLed("mRPMLedTable")
- for i = 0,14 do
- led = led.format("RPM%d",i)
- mRPMLedTable[led] = 1
- end
- SetRPMLed("mRPMLedTable")
-
-end
-
-function iRacing_spdLmtMethodEvent(idx, deviceType)
- local led = ""
-
- -- get car name
- local cNm = GetContextInfo("carname")
-
- -- speedlimiter stuff
- if cNm == "formulamazda" then
- mSpdLimitMethod = 2
-
- elseif cNm == "mclarenmp4" then
- mSpdLimitMethod = 2
-
- elseif cNm == "williamsfw31" then
- -- speedlimiter led fixed + digits blinking, method 6
- mSpdLimitMethod = 5
-
- elseif cNm == "fordv8sc" then
- mSpdLimitMethod = 2
-
- elseif cNm == "dallara" then
- mSpdLimitMethod = 2
-
- elseif cNm == "fordgt" then
- mSpdLimitMethod = 2
-
- elseif cNm == "hpdarx01c" then
- FixRPMSpeedlimiter()
- return 1
-
- elseif cNm == "rileydp" then
- mSpdLimitMethod = 2
-
- elseif cNm == "c6r" then
- FixRPMSpeedlimiter()
- return 1
-
- elseif cNm == "radical sr8" then
- mSpdLimitMethod = 0
-
- elseif cNm == "jettatdi" then
- mSpdLimitMethod = 2
-
- elseif cNm == "cadillacctsvr" then
- FixRPMSpeedlimiter()
- return 1
-
- -- cars with without dashboardleds
- -- elseif cNm == "mx5 cup" or cNm == "mx5 roadster" then
- -- elseif cNm == "fr500s" then
- -- elseif cNm == "latemodel" then
- -- elseif cNm == "legends ford34c" then
- -- elseif cNm == "legends ford34c rookie" then
- -- elseif cNm == "skmodified" then
- -- elseif cNm == "silvercrown" then
- -- elseif cNm == "trucks silverado" then
- -- elseif cNm == "stockcars impala" then
- -- elseif cNm == "lotus79" then
- -- elseif cNm == "stockcars2 chevy" then
- -- elseif cNm == "solstice" then
- -- elseif cNm == "solstice rookie" then
- -- elseif cNm == "rt2000" then
- -- elseif cNm == "specracer" then
- -- elseif cNm == "streetstock" then
- -- elseif cNm == "sprint" then
-
- else
- -- default
- mSpdLimitMethod = 0
-
- end
- return 2
-end
-
-function iRacing_shiftLightsMethodEvent(idx, dev)
- -- rpm table name
- local tName = "mRPMLedTable"
- -- get rpm
- local rpm = 0
- rpm = GetCarInfo("rpm")
- if rpm == nil then rpm = 0 end
-
- -- check redzone value
- if gRedZone == nil or gRedZone == 0 then gRedZone = GetCarInfo("redzone") end
-
- -- get car name
- local cNm = GetContextInfo("carname")
-
- local isPit = GetCarInfo("inpits")
- local carspd = GetCarInfo("rawspeed")
-
- -- init leds (see global.lua)
- initLedTable(mRPMLedTable, 0)
-
- -- Pits Stuff
- if isPit == 1 and carspd == 0 then
- -- pit stop
-
- elseif isPit >= 1 and carspd > 21 then
- -- car Approaching pits (or in pit lane) and exceed 45 mph
- -- set the red zone to the current engine rpm (This sets the shiftlights to the max and warns the driver)
- local spdLmt = GetCarInfo("speedlimiter")
- if spdLmt == 0 then
- -- if speedlimiter is OFF
- gRedZone = rpm
- end
- end
-
- -- get device type
- if dev == nil then dev = "none" end
-
- -- shiftlights stuff
- if cNm == "formulamazda" then
- -- start Mazda shiftlights
- if dev == "FANATEC" then
- SideToCenterFanatec(rpm, gRedZone, 96, 97 ,98 ,99 ,99.5)
- elseif dev == "SRDLX" then
- SideToCenterSRDlx(rpm, gRedZone, 95, 96, 97 ,98 ,99 ,99.5)
- elseif dev == "SRF1" then
- SideToCenterSRF1(rpm, gRedZone, 94, 94.5, 95, 96, 97 ,98 ,99 ,99.5)
- else
- SideToCenterSLI(rpm, gRedZone, 94.5, 95, 96, 97 ,98 ,99 ,99.5)
- end
- elseif cNm == "mclarenmp4" then
- local gear = GetCarInfo("gear")
- if gear == 6 then
- if dev == "FANATEC" then
- RpmFanatec(rpm, 6720 , 6870 , 7000 , 7200, 7305, 7340, 7340, 7340, 7340)
- elseif dev == "SRDLX" then
- RpmSRDlx(rpm, 6690, 6720 , 6870 , 7000 , 7200, 7305, 7340, 7340, 7340, 7340)
- elseif dev == "SRF1" then
- RpmSRF1(rpm, 6300, 6350, 6400, 6490, 6580, 6690, 6720 , 6870 , 7000 , 7200, 7305, 7340, 7340, 7340, 7340)
- else
- ProgressiveFixedSLI(rpm, 6300, 6490, 6580, 6690, 6720 , 6870 , 7000 , 7200, 7305, 7340, 7340, 7340, 7340)
- end
- else
- if dev == "FANATEC" then
- RpmFanatec(rpm, 6620 , 6670 , 6750 , 6800, 6895, 7040, 7040, 7040, 7040)
- elseif dev == "SRDLX" then
- RpmSRDlx(rpm, 6590, 6620 , 6670 , 6750 , 6800, 6895, 7040, 7040, 7040, 7040)
- elseif dev == "SRF1" then
- RpmSRF1(rpm, 6200, 6250, 6300, 6390, 6480, 6590, 6620 , 6670 , 6750 , 6800, 6895, 7040, 7040, 7040, 7040)
- else
- ProgressiveFixedSLI(rpm, 6200, 6390, 6480, 6590, 6620 , 6670 , 6750 , 6800, 6895, 7040, 7040, 7040, 7040)
- end
- end
-
- elseif cNm == "williamsfw31" then
- if dev == "FANATEC" then
- AlternateFanatec(rpm, gRedZone, 7.0, 8.0, 8.9)
- elseif dev == "SRDLX" then
- AlternateSRDlx(rpm, gRedZone, 8.0, 9.0, 9.9)
- elseif dev == "SRF1" then
- AlternateSRF1(rpm, gRedZone, 12.0, 13.0, 14.9)
- else
- AlternateSLI(rpm, gRedZone, 11.0, 12.0, 12.9)
- end
-
- elseif cNm == "kiaoptima" then
- if dev == "FANATEC" then
- SideToCenterFanatec(rpm, gRedZone, 95, 96 ,97 ,98 ,99)
- elseif dev == "SRDLX" then
- SideToCenterSRDlx(rpm, gRedZone, 90, 95, 96 ,97 ,98 ,99)
- elseif dev == "SRF1" then
- SideToCenterSRF1(rpm, gRedZone, 86, 90, 95, 96 ,97 ,98 ,99, 99.5)
- else
- SideToCenterSLI(rpm, gRedZone, 86, 90, 95, 96 ,97 ,98 ,99)
- end
-
- elseif cNm == "mx5 cup" or cNm == "mx5 roadster" then
- if dev == "FANATEC" then
- SideToCenterFanatec(rpm, gRedZone, 95, 96 ,97 ,98 ,99)
- elseif dev == "SRDLX" then
- SideToCenterSRDlx(rpm, gRedZone, 90, 95, 96 ,97 ,98 ,99)
- elseif dev == "SRF1" then
- SideToCenterSRF1(rpm, gRedZone, 86, 90, 95, 96 ,97 ,98 ,99, 99.5)
- else
- SideToCenterSLI(rpm, gRedZone, 86, 90, 95, 96 ,97 ,98 ,99)
- end
-
- elseif cNm == "fr500s" then
- if dev == "FANATEC" then
- SideToCenterFanatec(rpm, gRedZone, 86, 88 ,90 ,98 ,99)
- elseif dev == "SRDLX" then
- SideToCenterSRDlx(rpm, gRedZone, 84, 86, 88 ,90 ,98 ,99)
- elseif dev == "SRF1" then
- SideToCenterSRF1(rpm, gRedZone, 80, 84, 86, 88 ,90 ,98 ,99, 99.5)
- else
- SideToCenterSLI(rpm, gRedZone, 80, 84, 86, 88 ,90 ,98 ,99)
- end
-
- elseif cNm == "fordv8sc" then
- if dev == "FANATEC" then
- SideToCenterFanatec(rpm, gRedZone, 92, 94 ,97 ,98 ,99)
- elseif dev == "SRDLX" then
- SideToCenterSRDlx(rpm, gRedZone, 90, 92, 94 ,97 ,98 ,99)
- elseif dev == "SRF1" then
- SideToCenterSRF1(rpm, gRedZone, 87, 90, 92, 94 ,97 ,98 ,99, 99.5)
- else
- SideToCenterSLI(rpm, gRedZone, 87, 90, 92, 94 ,97 ,98 ,99)
- end
-
- elseif cNm == "dallara" then
- if dev == "FANATEC" then
- SideToCenterFanatec(rpm, gRedZone, 90, 94 ,97 ,98 ,99)
- elseif dev == "SRDLX" then
- SideToCenterSRDlx(rpm, gRedZone, 82, 90, 94 ,97 ,98 ,99)
- elseif dev == "SRF1" then
- SideToCenterSRF1(rpm, gRedZone, 78, 82, 90, 94 ,97 ,98 ,99, 99.5)
- else
- SideToCenterSLI(rpm, gRedZone, 78, 82, 90, 94 ,97 ,98 ,99)
- end
-
- elseif cNm == "fordgt" then
- if dev == "FANATEC" then
- SideToCenterFanatec(rpm, gRedZone, 95, 96 ,97 ,98 ,99)
- elseif dev == "SRDLX" then
- SideToCenterSRDlx(rpm, gRedZone, 94, 95, 96 ,97 ,98 ,99)
- elseif dev == "SRF1" then
- SideToCenterSRF1(rpm, gRedZone, 93, 94, 95, 96 ,97 ,98 ,99, 99.5)
- else
- SideToCenterSLI(rpm, gRedZone, 93, 94, 95, 96 ,97 ,98 ,99)
- end
-
- elseif cNm == "hpdarx01c" then
- if dev == "FANATEC" then
- RpmFanatec(rpm, 8500 , 8700 , 8800 , 8900, 9100, 9300, 9500, 9700, 9940)
- elseif dev == "SRDLX" then
- RpmSRDlx(rpm, 8300, 8500 , 8700 , 8800 , 8900, 9100, 9300, 9500, 9700, 9940)
- elseif dev == "SRF1" then
- RpmSRF1(rpm, 7800, 7840, 7890, 7900, 8100, 8300, 8500 , 8700 , 8800 , 8900, 9100, 9300, 9500, 9700, 9940)
- else
- ProgressiveFixedSLI(rpm, 7800, 7900, 8100, 8300, 8500 , 8700 , 8800 , 8900, 9100, 9300, 9500, 9700, 9940)
- end
-
- elseif cNm == "rileydp" then
- if dev == "FANATEC" then
- RpmFanatec(rpm, 6900, 7000 , 10000 , 10000 , 10000, 10000, 10000, 10000, 10000)
- elseif dev == "SRDLX" then
- RpmSRDlx(rpm, 6800, 6900, 7000 , 10000 , 10000 , 10000, 10000, 10000, 10000, 10000)
- elseif dev == "SRF1" then
- RpmSRF1(rpm, 10000, 10000, 6700, 6800, 6900, 7000 , 10000 , 10000 , 10000, 10000, 10000, 10000, 10000, 10000, 10000)
- else
- ProgressiveFixedSLI(rpm, 10000, 6700, 6800, 6900, 7000 , 10000 , 10000 , 10000, 10000, 10000, 10000, 10000, 10000)
- end
-
- elseif cNm == "c6r" then
- if dev == "FANATEC" then
- RpmFanatec(rpm, 5200 , 5300 , 5400 , 5600, 5700, 5800, 5900, 6000, 6100)
- elseif dev == "SRDLX" then
- RpmSRDlx(rpm, 5000, 5200 , 5300 , 5400 , 5600, 5700, 5800, 5900, 6000, 6100)
- elseif dev == "SRF1" then
- RpmSRF1(rpm, 4700, 4800, 4900, 5000, 5040, 5190, 5200 , 5300 , 5400 , 5600, 5700, 5800, 5900, 6000, 6100)
- else
- ProgressiveFixedSLI(rpm, 4700, 4800, 4900, 5000, 5200 , 5300 , 5400 , 5600, 5700, 5800, 5900, 6000, 6100)
- end
-
- elseif cNm == "radical sr8" then
- if dev == "FANATEC" then
- RpmFanatec(rpm, 6400 , 6900 , 7700 , 8100, 8700, 9850, 10100, 10250, 10500)
- elseif dev == "SRDLX" then
- RpmSRDlx(rpm, 5700, 6400 , 6900 , 7700 , 8100, 8700, 9850, 10100, 10250, 10500)
- elseif dev == "SRF1" then
- RpmSRF1(rpm, 4350, 4800, 5100, 5300, 5500, 5700, 6400 , 6900 , 7700 , 8100, 8700, 9850, 10100, 10250, 10500)
- else
- ProgressiveFixedSLI(rpm, 4350, 4800, 5100, 5700, 6400 , 6900 , 7700 , 8100, 8700, 9850, 10100, 10250, 10500)
- end
-
- elseif cNm == "jettatdi" then
- if dev == "FANATEC" then
- SideToCenterFanatec(rpm, gRedZone, 86, 88 ,90 ,98 ,99)
- elseif dev == "SRDLX" then
- SideToCenterSRDlx(rpm, gRedZone, 84, 86, 88 ,90 ,98 ,99)
- elseif dev == "SRF1" then
- SideToCenterSRF1(rpm, gRedZone, 80, 84, 86, 88 ,90 ,98 ,99, 99.5)
- else
- SideToCenterSLI(rpm, gRedZone, 80, 84, 86, 88 ,90 ,98 ,99)
- end
-
- elseif cNm == "cadillacctsvr" then
- --ProgressiveFixedSLI(rpm, 6500, 6580, 6600, 6700, 6800 , 6900 , 7000 , 7100, 7200, 7300, 7400, 7500, 7600)
- if dev == "FANATEC" then
- ProgressiveFanatec(rpm, gRedZone, 7.9, 8.15, 8.2, 8.25, 8.3, 8.35, 8.5, 8.8, 8.98 )
- elseif dev == "SRDLX" then
- ProgressiveSRDlx(rpm, gRedZone, 8.5, 8.9, 9.15, 9.2, 9.25, 9.3, 9.35, 9.5, 9.8, 9.98 )
- elseif dev == "SRF1" then
- ProgressiveSRF1(rpm, gRedZone, 13.8, 13.85, 13.9, 13.95, 13.98, 14, 14.1, 14.15, 14.2, 14.25, 14.3, 14.35, 14.5, 14.8, 14.98 )
- else
- ProgressiveSLI(rpm, gRedZone, 11.9, 11.95, 11.98, 12, 12.1, 12.15, 12.2, 12.25, 12.3, 12.35, 12.5, 12.8, 12.98 )
- end
-
- -- progressive default method for all cars with dashboard without leds
- -- elseif cNm == "latemodel" then
- -- elseif cNm == "legends ford34c" then
- -- elseif cNm == "legends ford34c rookie" then
- -- elseif cNm == "skmodified" then
- -- elseif cNm == "silvercrown" then
- -- elseif cNm == "trucks silverado" then
- -- elseif cNm == "stockcars impala" then
- -- elseif cNm == "lotus79" then
- -- elseif cNm == "stockcars2 chevy" then
- -- elseif cNm == "solstice" then
- -- elseif cNm == "solstice rookie" then
- -- elseif cNm == "rt2000" then
- -- elseif cNm == "specracer" then
- -- elseif cNm == "streetstock" then
- -- elseif cNm == "sprint" then
-
- else
- -- default
- if dev == "FANATEC" then
- ProgressiveFanatec(rpm, gRedZone, 4.5, 5, 6.5, 7, 7.5, 8, 8.5, 8.8, 8.98 )
- elseif dev == "SRDLX" then
- ProgressiveSRDlx(rpm, gRedZone, 5.0, 5.5, 6, 7.5, 8, 8.5, 9, 9.5, 9.8, 9.98 )
- elseif dev == "SRF1" then
- ProgressiveSRF1(rpm, gRedZone, 9.0, 9.5, 9.8, 10, 10.5, 11, 11.5, 12, 12.5, 13, 13.5, 14, 14.5, 14.8, 14.98 )
- else
- ProgressiveSLI(rpm, gRedZone, 7.5, 8, 8.5, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.5, 12.8, 12.98 )
- end
- end
-
- -- set leds
- SetRPMLed(tName)
-end
-
-function iRacing_ospMethodEvent(idx, deviceType)
- -- get car name
- local cNm = GetContextInfo("carname")
- -- OSP Method stuff
- if mOSPMethod ~= nil then
- if cNm == "mclarenmp4" or cNm == "williamsfw31" then
- if deviceType == "FANATEC" then
- mOSPMethod = 1
- else
- mOSPMethod = 3
- end
-
- -- else
- -- -- default
- -- if deviceType == "FANATEC" then
- -- mOSPMethod = 1
- -- end
- end
- end
- return 2
+-- Custom SLIMax Manager Scripts for iRacing v3.2.1
+-- Copyright ©2012-2013 by Zappadoc
+-- _last change by Zappadoc - 2013-10
+
+-- =====================================
+-- iRacing Stuff script
+-- define car setup function and all pit limiter and shiftlights methods for each car you drive
+function iRacing_DebugCarInfo(deviceType)
+ -- see debug console window
+ -- get car name
+ local dev = GetDeviceType(deviceType)
+ local cNm = GetContextInfo("carname")
+ local mxG = GetCarInfo("maxgear")
+ local rdz = GetCarInfo("redzone")
+ local ospf = GetContextInfo("ospfactor")
+ print("\n----------\nDevice:"..dev.."\nSetup car:" .. cNm .. "(" .. rdz .. ")" .. "\nMaxGear:" .. mxG .. "\nOSP Factor:" .. ospf .. "\n");
+end
+
+function iRacing_InitGearEvent(gear)
+ -- get current simulation name
+ -- custom script to overwrite OSP value and OSP limit for each gear of each iRacing car
+ local sim = GetContextInfo("simulation")
+ if isAppIRacing(sim) then
+ if gOldGear == nil then gOldGear = -2 end
+ -- setup iRacing car OSP, RedZone, Max gear, ...
+ iRacing_CarSetup(gear)
+ if gear ~= gOldGear then
+ gOldGear = gear
+ end
+ end
+end
+
+function iRacing_CarSetup(cGear)
+ -- get car name
+ local cNm = ""
+ cNm = GetContextInfo("carname")
+ local mxG = 4
+ local ospf = 140
+
+ if cNm == "cadillacctsvr" then
+ mxG = 6
+ ospf = 148
+
+ elseif cNm == "mclarenmp4" then
+ mxG = 6
+ ospf = 150
+
+ elseif cNm == "kiaoptima" then
+ mxG = 5
+ ospf = 150
+
+ elseif cNm == "formulamazda" then
+ mxG = 6
+ ospf = 60
+
+ elseif cNm == "williamsfw31" then
+ mxG = 7
+ ospf = 90
+
+ elseif cNm == "mx5 cup" or cNm == "mx5 roadster" then
+ mxG = 6
+ ospf = 140
+
+ elseif cNm == "hpdarx01c" then
+ mxG = 6
+ if cGear <= 2 then
+ ospf = 10
+ gOSPLimit = 9900
+ gRedZone = 9920
+ elseif cGear ==3 then
+ ospf = 100
+ gOSPLimit = 9530
+ gRedZone = 9545
+ elseif cGear == 4 then
+ ospf = 90
+ gOSPLimit = 9500
+ gRedZone = 9510
+ else
+ ospf = 150
+ gOSPLimit = 9420
+ gRedZone = 9425
+ end
+
+
+ elseif cNm == "fordgt" then
+ mxG = 6
+ ospf = 128
+
+ elseif cNm == "fr500s" then
+ mxG = 6
+ ospf = 150
+
+ elseif cNm == "fordv8sc" then
+ mxG = 6
+ ospf = 100
+
+ elseif cNm == "dallara" then
+ mxG = 6
+ ospf = 95
+
+ elseif cNm == "latemodel" then
+ mxG = 5
+
+ elseif cNm == "legends ford34c" then
+ mxG = 5
+ ospf = 150
+
+ elseif cNm == "skmodified" then
+ mxG = 6
+
+ elseif cNm == "silvercrown" then
+ mxG = 6
+
+ elseif cNm == "trucks silverado" then
+ mxG = 4
+
+ elseif cNm == "stockcars impala" then
+ mxG = 4
+ ospf = 140
+
+ elseif cNm == "lotus79" then
+ mxG = 5
+ ospf = 100
+
+ elseif cNm == "stockcars2 chevy" then
+ mxG = 4
+ ospf = 130
+
+ elseif cNm == "stockcars2 chevy cot" then
+ mxG = 4
+ ospf = 150
+
+ elseif cNm == "c6r" then
+ mxG = 6
+ ospf = 145
+
+ elseif cNm == "solstice" then
+ mxG = 5
+ ospf = 150
+
+ elseif cNm == "jettatdi" then
+ mxG = 5
+
+ elseif cNm == "radical sr8" then
+ mxG = 6
+ ospf = 115
+
+ elseif cNm == "rt2000" then
+ mxG = 5
+ ospf = 140
+
+ elseif cNm == "specracer" then
+ mxG = 5
+ ospf = 140
+
+ elseif cNm == "rileydp" then
+ mxG = 5
+ ospf = 85
+
+ elseif cNm == "streetstock" then
+ mxG = 4
+ ospf = 150
+
+ elseif cNm == "sprint" then
+ mxG = 6
+
+ else
+ -- default
+ mxG = 4
+ ospf = 150
+ end
+ -- set max gear and OSP factor for this car
+ SetMaxGear(mxG)
+ SetOSPFactor(ospf)
+end
+
+function FixRPMSpeedlimiter()
+ local led = ""
+ -- init table
+ initLedTable(mRPMLedTable, 0)
+ SetRPMLed("mRPMLedTable")
+ for i = 0,14 do
+ led = led.format("RPM%d",i)
+ mRPMLedTable[led] = 1
+ end
+ SetRPMLed("mRPMLedTable")
+
+end
+
+function iRacing_spdLmtMethodEvent(idx, deviceType)
+ local led = ""
+
+ -- get car name
+ local cNm = GetContextInfo("carname")
+
+ -- speedlimiter stuff
+ if cNm == "formulamazda" then
+ mSpdLimitMethod = 2
+
+ elseif cNm == "mclarenmp4" then
+ mSpdLimitMethod = 2
+
+ elseif cNm == "williamsfw31" then
+ -- speedlimiter led fixed + digits blinking, method 6
+ mSpdLimitMethod = 5
+
+ elseif cNm == "fordv8sc" then
+ mSpdLimitMethod = 2
+
+ elseif cNm == "dallara" then
+ mSpdLimitMethod = 2
+
+ elseif cNm == "fordgt" then
+ mSpdLimitMethod = 2
+
+ elseif cNm == "hpdarx01c" then
+ FixRPMSpeedlimiter()
+ return 1
+
+ elseif cNm == "rileydp" then
+ mSpdLimitMethod = 2
+
+ elseif cNm == "c6r" then
+ FixRPMSpeedlimiter()
+ return 1
+
+ elseif cNm == "radical sr8" then
+ mSpdLimitMethod = 0
+
+ elseif cNm == "jettatdi" then
+ mSpdLimitMethod = 2
+
+ elseif cNm == "cadillacctsvr" then
+ FixRPMSpeedlimiter()
+ return 1
+
+ -- cars with without dashboardleds
+ -- elseif cNm == "mx5 cup" or cNm == "mx5 roadster" then
+ -- elseif cNm == "fr500s" then
+ -- elseif cNm == "latemodel" then
+ -- elseif cNm == "legends ford34c" then
+ -- elseif cNm == "legends ford34c rookie" then
+ -- elseif cNm == "skmodified" then
+ -- elseif cNm == "silvercrown" then
+ -- elseif cNm == "trucks silverado" then
+ -- elseif cNm == "stockcars impala" then
+ -- elseif cNm == "lotus79" then
+ -- elseif cNm == "stockcars2 chevy" then
+ -- elseif cNm == "solstice" then
+ -- elseif cNm == "solstice rookie" then
+ -- elseif cNm == "rt2000" then
+ -- elseif cNm == "specracer" then
+ -- elseif cNm == "streetstock" then
+ -- elseif cNm == "sprint" then
+
+ else
+ -- default
+ mSpdLimitMethod = 0
+
+ end
+ return 2
+end
+
+function iRacing_shiftLightsMethodEvent(idx, dev)
+ -- rpm table name
+ local tName = "mRPMLedTable"
+ -- get rpm
+ local rpm = 0
+ rpm = GetCarInfo("rpm")
+ if rpm == nil then rpm = 0 end
+
+ -- check redzone value
+ if gRedZone == nil or gRedZone == 0 then gRedZone = GetCarInfo("redzone") end
+
+ -- get car name
+ local cNm = GetContextInfo("carname")
+
+ local isPit = GetCarInfo("inpits")
+ local carspd = GetCarInfo("rawspeed")
+
+ -- init leds (see global.lua)
+ initLedTable(mRPMLedTable, 0)
+
+ -- Pits Stuff
+ if isPit == 1 and carspd == 0 then
+ -- pit stop
+
+ elseif isPit >= 1 and carspd > 21 then
+ -- car Approaching pits (or in pit lane) and exceed 45 mph
+ -- set the red zone to the current engine rpm (This sets the shiftlights to the max and warns the driver)
+ local spdLmt = GetCarInfo("speedlimiter")
+ if spdLmt == 0 then
+ -- if speedlimiter is OFF
+ gRedZone = rpm
+ end
+ end
+
+ -- get device type
+ if dev == nil then dev = "none" end
+
+ -- shiftlights stuff
+ if cNm == "formulamazda" then
+ -- start Mazda shiftlights
+ if dev == "FANATEC" then
+ SideToCenterFanatec(rpm, gRedZone, 96, 97 ,98 ,99 ,99.5)
+ elseif dev == "SRDLX" then
+ SideToCenterSRDlx(rpm, gRedZone, 95, 96, 97 ,98 ,99 ,99.5)
+ elseif dev == "SRF1" then
+ SideToCenterSRF1(rpm, gRedZone, 94, 94.5, 95, 96, 97 ,98 ,99 ,99.5)
+ else
+ SideToCenterSLI(rpm, gRedZone, 94.5, 95, 96, 97 ,98 ,99 ,99.5)
+ end
+ elseif cNm == "mclarenmp4" then
+ local gear = GetCarInfo("gear")
+ if gear == 6 then
+ if dev == "FANATEC" then
+ RpmFanatec(rpm, 6720 , 6870 , 7000 , 7200, 7305, 7340, 7340, 7340, 7340)
+ elseif dev == "SRDLX" then
+ RpmSRDlx(rpm, 6690, 6720 , 6870 , 7000 , 7200, 7305, 7340, 7340, 7340, 7340)
+ elseif dev == "SRF1" then
+ RpmSRF1(rpm, 6300, 6350, 6400, 6490, 6580, 6690, 6720 , 6870 , 7000 , 7200, 7305, 7340, 7340, 7340, 7340)
+ else
+ ProgressiveFixedSLI(rpm, 6300, 6490, 6580, 6690, 6720 , 6870 , 7000 , 7200, 7305, 7340, 7340, 7340, 7340)
+ end
+ else
+ if dev == "FANATEC" then
+ RpmFanatec(rpm, 6620 , 6670 , 6750 , 6800, 6895, 7040, 7040, 7040, 7040)
+ elseif dev == "SRDLX" then
+ RpmSRDlx(rpm, 6590, 6620 , 6670 , 6750 , 6800, 6895, 7040, 7040, 7040, 7040)
+ elseif dev == "SRF1" then
+ RpmSRF1(rpm, 6200, 6250, 6300, 6390, 6480, 6590, 6620 , 6670 , 6750 , 6800, 6895, 7040, 7040, 7040, 7040)
+ else
+ ProgressiveFixedSLI(rpm, 6200, 6390, 6480, 6590, 6620 , 6670 , 6750 , 6800, 6895, 7040, 7040, 7040, 7040)
+ end
+ end
+
+ elseif cNm == "williamsfw31" then
+ if dev == "FANATEC" then
+ AlternateFanatec(rpm, gRedZone, 7.0, 8.0, 8.9)
+ elseif dev == "SRDLX" then
+ AlternateSRDlx(rpm, gRedZone, 8.0, 9.0, 9.9)
+ elseif dev == "SRF1" then
+ AlternateSRF1(rpm, gRedZone, 12.0, 13.0, 14.9)
+ else
+ AlternateSLI(rpm, gRedZone, 11.0, 12.0, 12.9)
+ end
+
+ elseif cNm == "kiaoptima" then
+ if dev == "FANATEC" then
+ SideToCenterFanatec(rpm, gRedZone, 95, 96 ,97 ,98 ,99)
+ elseif dev == "SRDLX" then
+ SideToCenterSRDlx(rpm, gRedZone, 90, 95, 96 ,97 ,98 ,99)
+ elseif dev == "SRF1" then
+ SideToCenterSRF1(rpm, gRedZone, 86, 90, 95, 96 ,97 ,98 ,99, 99.5)
+ else
+ SideToCenterSLI(rpm, gRedZone, 86, 90, 95, 96 ,97 ,98 ,99)
+ end
+
+ elseif cNm == "mx5 cup" or cNm == "mx5 roadster" then
+ if dev == "FANATEC" then
+ SideToCenterFanatec(rpm, gRedZone, 95, 96 ,97 ,98 ,99)
+ elseif dev == "SRDLX" then
+ SideToCenterSRDlx(rpm, gRedZone, 90, 95, 96 ,97 ,98 ,99)
+ elseif dev == "SRF1" then
+ SideToCenterSRF1(rpm, gRedZone, 86, 90, 95, 96 ,97 ,98 ,99, 99.5)
+ else
+ SideToCenterSLI(rpm, gRedZone, 86, 90, 95, 96 ,97 ,98 ,99)
+ end
+
+ elseif cNm == "fr500s" then
+ if dev == "FANATEC" then
+ SideToCenterFanatec(rpm, gRedZone, 86, 88 ,90 ,98 ,99)
+ elseif dev == "SRDLX" then
+ SideToCenterSRDlx(rpm, gRedZone, 84, 86, 88 ,90 ,98 ,99)
+ elseif dev == "SRF1" then
+ SideToCenterSRF1(rpm, gRedZone, 80, 84, 86, 88 ,90 ,98 ,99, 99.5)
+ else
+ SideToCenterSLI(rpm, gRedZone, 80, 84, 86, 88 ,90 ,98 ,99)
+ end
+
+ elseif cNm == "fordv8sc" then
+ if dev == "FANATEC" then
+ SideToCenterFanatec(rpm, gRedZone, 92, 94 ,97 ,98 ,99)
+ elseif dev == "SRDLX" then
+ SideToCenterSRDlx(rpm, gRedZone, 90, 92, 94 ,97 ,98 ,99)
+ elseif dev == "SRF1" then
+ SideToCenterSRF1(rpm, gRedZone, 87, 90, 92, 94 ,97 ,98 ,99, 99.5)
+ else
+ SideToCenterSLI(rpm, gRedZone, 87, 90, 92, 94 ,97 ,98 ,99)
+ end
+
+ elseif cNm == "dallara" then
+ if dev == "FANATEC" then
+ SideToCenterFanatec(rpm, gRedZone, 90, 94 ,97 ,98 ,99)
+ elseif dev == "SRDLX" then
+ SideToCenterSRDlx(rpm, gRedZone, 82, 90, 94 ,97 ,98 ,99)
+ elseif dev == "SRF1" then
+ SideToCenterSRF1(rpm, gRedZone, 78, 82, 90, 94 ,97 ,98 ,99, 99.5)
+ else
+ SideToCenterSLI(rpm, gRedZone, 78, 82, 90, 94 ,97 ,98 ,99)
+ end
+
+ elseif cNm == "fordgt" then
+ if dev == "FANATEC" then
+ SideToCenterFanatec(rpm, gRedZone, 95, 96 ,97 ,98 ,99)
+ elseif dev == "SRDLX" then
+ SideToCenterSRDlx(rpm, gRedZone, 94, 95, 96 ,97 ,98 ,99)
+ elseif dev == "SRF1" then
+ SideToCenterSRF1(rpm, gRedZone, 93, 94, 95, 96 ,97 ,98 ,99, 99.5)
+ else
+ SideToCenterSLI(rpm, gRedZone, 93, 94, 95, 96 ,97 ,98 ,99)
+ end
+
+ elseif cNm == "hpdarx01c" then
+ if dev == "FANATEC" then
+ RpmFanatec(rpm, 8500 , 8700 , 8800 , 8900, 9100, 9300, 9500, 9700, 9940)
+ elseif dev == "SRDLX" then
+ RpmSRDlx(rpm, 8300, 8500 , 8700 , 8800 , 8900, 9100, 9300, 9500, 9700, 9940)
+ elseif dev == "SRF1" then
+ RpmSRF1(rpm, 7800, 7840, 7890, 7900, 8100, 8300, 8500 , 8700 , 8800 , 8900, 9100, 9300, 9500, 9700, 9940)
+ else
+ ProgressiveFixedSLI(rpm, 7800, 7900, 8100, 8300, 8500 , 8700 , 8800 , 8900, 9100, 9300, 9500, 9700, 9940)
+ end
+
+ elseif cNm == "rileydp" then
+ if dev == "FANATEC" then
+ RpmFanatec(rpm, 6900, 7000 , 10000 , 10000 , 10000, 10000, 10000, 10000, 10000)
+ elseif dev == "SRDLX" then
+ RpmSRDlx(rpm, 6800, 6900, 7000 , 10000 , 10000 , 10000, 10000, 10000, 10000, 10000)
+ elseif dev == "SRF1" then
+ RpmSRF1(rpm, 10000, 10000, 6700, 6800, 6900, 7000 , 10000 , 10000 , 10000, 10000, 10000, 10000, 10000, 10000, 10000)
+ else
+ ProgressiveFixedSLI(rpm, 10000, 6700, 6800, 6900, 7000 , 10000 , 10000 , 10000, 10000, 10000, 10000, 10000, 10000)
+ end
+
+ elseif cNm == "c6r" then
+ if dev == "FANATEC" then
+ RpmFanatec(rpm, 5200 , 5300 , 5400 , 5600, 5700, 5800, 5900, 6000, 6100)
+ elseif dev == "SRDLX" then
+ RpmSRDlx(rpm, 5000, 5200 , 5300 , 5400 , 5600, 5700, 5800, 5900, 6000, 6100)
+ elseif dev == "SRF1" then
+ RpmSRF1(rpm, 4700, 4800, 4900, 5000, 5040, 5190, 5200 , 5300 , 5400 , 5600, 5700, 5800, 5900, 6000, 6100)
+ else
+ ProgressiveFixedSLI(rpm, 4700, 4800, 4900, 5000, 5200 , 5300 , 5400 , 5600, 5700, 5800, 5900, 6000, 6100)
+ end
+
+ elseif cNm == "radical sr8" then
+ if dev == "FANATEC" then
+ RpmFanatec(rpm, 6400 , 6900 , 7700 , 8100, 8700, 9850, 10100, 10250, 10500)
+ elseif dev == "SRDLX" then
+ RpmSRDlx(rpm, 5700, 6400 , 6900 , 7700 , 8100, 8700, 9850, 10100, 10250, 10500)
+ elseif dev == "SRF1" then
+ RpmSRF1(rpm, 4350, 4800, 5100, 5300, 5500, 5700, 6400 , 6900 , 7700 , 8100, 8700, 9850, 10100, 10250, 10500)
+ else
+ ProgressiveFixedSLI(rpm, 4350, 4800, 5100, 5700, 6400 , 6900 , 7700 , 8100, 8700, 9850, 10100, 10250, 10500)
+ end
+
+ elseif cNm == "jettatdi" then
+ if dev == "FANATEC" then
+ SideToCenterFanatec(rpm, gRedZone, 86, 88 ,90 ,98 ,99)
+ elseif dev == "SRDLX" then
+ SideToCenterSRDlx(rpm, gRedZone, 84, 86, 88 ,90 ,98 ,99)
+ elseif dev == "SRF1" then
+ SideToCenterSRF1(rpm, gRedZone, 80, 84, 86, 88 ,90 ,98 ,99, 99.5)
+ else
+ SideToCenterSLI(rpm, gRedZone, 80, 84, 86, 88 ,90 ,98 ,99)
+ end
+
+ elseif cNm == "cadillacctsvr" then
+ --ProgressiveFixedSLI(rpm, 6500, 6580, 6600, 6700, 6800 , 6900 , 7000 , 7100, 7200, 7300, 7400, 7500, 7600)
+ if dev == "FANATEC" then
+ ProgressiveFanatec(rpm, gRedZone, 7.9, 8.15, 8.2, 8.25, 8.3, 8.35, 8.5, 8.8, 8.98 )
+ elseif dev == "SRDLX" then
+ ProgressiveSRDlx(rpm, gRedZone, 8.5, 8.9, 9.15, 9.2, 9.25, 9.3, 9.35, 9.5, 9.8, 9.98 )
+ elseif dev == "SRF1" then
+ ProgressiveSRF1(rpm, gRedZone, 13.8, 13.85, 13.9, 13.95, 13.98, 14, 14.1, 14.15, 14.2, 14.25, 14.3, 14.35, 14.5, 14.8, 14.98 )
+ else
+ ProgressiveSLI(rpm, gRedZone, 11.9, 11.95, 11.98, 12, 12.1, 12.15, 12.2, 12.25, 12.3, 12.35, 12.5, 12.8, 12.98 )
+ end
+
+ -- progressive default method for all cars with dashboard without leds
+ -- elseif cNm == "latemodel" then
+ -- elseif cNm == "legends ford34c" then
+ -- elseif cNm == "legends ford34c rookie" then
+ -- elseif cNm == "skmodified" then
+ -- elseif cNm == "silvercrown" then
+ -- elseif cNm == "trucks silverado" then
+ -- elseif cNm == "stockcars impala" then
+ -- elseif cNm == "lotus79" then
+ -- elseif cNm == "stockcars2 chevy" then
+ -- elseif cNm == "solstice" then
+ -- elseif cNm == "solstice rookie" then
+ -- elseif cNm == "rt2000" then
+ -- elseif cNm == "specracer" then
+ -- elseif cNm == "streetstock" then
+ -- elseif cNm == "sprint" then
+
+ else
+ -- default
+ if dev == "FANATEC" then
+ ProgressiveFanatec(rpm, gRedZone, 4.5, 5, 6.5, 7, 7.5, 8, 8.5, 8.8, 8.98 )
+ elseif dev == "SRDLX" then
+ ProgressiveSRDlx(rpm, gRedZone, 5.0, 5.5, 6, 7.5, 8, 8.5, 9, 9.5, 9.8, 9.98 )
+ elseif dev == "SRF1" then
+ ProgressiveSRF1(rpm, gRedZone, 9.0, 9.5, 9.8, 10, 10.5, 11, 11.5, 12, 12.5, 13, 13.5, 14, 14.5, 14.8, 14.98 )
+ else
+ ProgressiveSLI(rpm, gRedZone, 7.5, 8, 8.5, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.5, 12.8, 12.98 )
+ end
+ end
+
+ -- set leds
+ SetRPMLed(tName)
+end
+
+function iRacing_ospMethodEvent(idx, deviceType)
+ -- get car name
+ local cNm = GetContextInfo("carname")
+ -- OSP Method stuff
+ if mOSPMethod ~= nil then
+ if cNm == "mclarenmp4" or cNm == "williamsfw31" then
+ if deviceType == "FANATEC" then
+ mOSPMethod = 1
+ else
+ mOSPMethod = 3
+ end
+
+ -- else
+ -- -- default
+ -- if deviceType == "FANATEC" then
+ -- mOSPMethod = 1
+ -- end
+ end
+ end
+ return 2
end \ No newline at end of file