summaryrefslogtreecommitdiff
path: root/scripts/global_custom_scripts.lua
blob: 9c2d3373254fb992613e8adb2cd79cf93b98f656 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
-- Global Custom SLIMax Manager Scripts v2.2
-- Copyright ©2011-2013 by Zappadoc - All Rights Reserved.
-- last change by Zappadoc - 2012-11

-- add you global custom functions and globals variables here 
-- patch the std SLIMax Events with your global custom scripts if needed
-- see the scripting section of the forum for more info...

-- IMPORTANT:
-- this script will not be deleted by uninstalling the software

-- ================================
-- CONSTANTS


-- ================================
-- additional lua extension module dll


-- ================================
-- additional scripts file

-- ================================
-- custom globals


-- ================================
-- custom functions

-- ================================
-- custom events

function global_custom_controlsEvent(deviceIdx, ctrlType, ctrlPos, value, funcIndex)
	-- type your custom controls script here (manage buttons, switches and encoders)
	return 2
end

function global_custom_deviceReport(devType)
	-- type your script here (just before sending report to the device )
	return 2
end

function global_custom_ospMethodEvent(idx)
	-- type your custom Optimal Shift Points (OSP) method here
	return 2
end

function global_custom_shiftLightsMethodEvent(idx)
	-- type your custom shiftlights method here	
	return 2
end

function global_custom_shiftLightsBU0710Event(idx)
	-- type your custom shiftlights method for BU0710 device only here
	return 2
end

function global_custom_leftDigitsEvent(swPosition)
	-- type your custom script related to left SLI-PRO digits panel here
	return 2
end

function global_custom_rightDigitsEvent(swPosition)
	-- type your custom script related to right SLI-PRO digits panel here
	return 2
end

function global_custom_spdLmtMethodEvent(idx)
	if idx > 2 then
		-- reinit RPM leds only if method > 2
		initLedTable(mRPMLedTable, 0)
		SetRPMLed("mRPMLedTable")
	end

	-- continue with standard behaviour
	return 2
end

function global_custom_gearEvent(gear)
	-- type your custom gear event script here
	-- check if gear == 'E' (see ascii table )
	if gear == 69 then

		-- toggle OFF in this example
		toggleAllLed(0)

		-- control gear digit display
		SetGearDigit(GetCurrentGear())

		-- control left panel (6 chars max)
		-- nothing display in this example
		local ldigits = "      "
		SetLeftDigits( ldigits )
		-- control right panel (6 chars max)
		-- nothing display in this example
		local rdigits = "      "
		SetRightDigits( rdigits )

		-- refresh SLI board
		SLISendReport(1)

		-- return 1 to bypass std behavior
		return 1
	end

	return 2
end

function global_custom_enterSessionEvent(devType)
	initLedTable(mRPMLedTable,0)
	SetRPMLed("mRPMLedTable")

	for j = 1, 0 do
		for i = 0, 6 do
			led = led.format("RPM%d",   i)
			mRPMLedTable[led] = j
			led = led.format("RPM%d",12-i)
			mRPMLedTable[led] = j
			SetRPMLed("mRPMLedTable")
			SLISleep(200)
		end
	end

	for j = 1,0 do
		for i = 0,2 do
			SetWarnLed(1+i, j)
			SetWarnLed(6-i, j)
			SetExtLed(1+i, j)
			SetExtLed(5-i, j)
			SLISleep(200)
		end
	end

	return 1
end

function global_custom_exitSessionEvent(devType)
	-- type your custom script on session ending, here
	local ldigits = " exit "
	SetLeftDigits( ldigits )
	local rdigits = " exit "
	SetRightDigits( rdigits )

	-- refresh SLI board
	SLISendReport(1)

	return 1
end

function global_custom_ledEvent(idx, ledFunction, state)
	-- bypass for power led --
	if ledFunction == 10 
	then
		if mPowerLED > 0
		then
			if mPowerLED > 6
			then
				setExtLed(mPowerLED - 6, state)
			else
				setWarnLed(mPowerLED, state)
		end
		-- continue
	end
	return 2
end


-- ================================
-- local custom events PLACEHOLDERS
-- DO NOT CHANGE THE SCRIPT BELOW
-- ================================
function custom_controlsEvent(deviceIdx, ctrlType, ctrlPos, value, funcIndex) return 2 end
function custom_deviceReport(devType) return 2 end
function custom_ospMethodEvent(idx) return 2 end
function custom_shiftLightsMethodEvent(idx) return 2 end
function custom_shiftLightsBU0710Event(idx) return 2 end
function custom_leftDigitsEvent(swPosition) return 2 end
function custom_rightDigitsEvent(swPosition) return 2 end
function custom_spdLmtMethodEvent(idx) return 2 end
function custom_gearEvent(gear) return 2 end
function custom_enterSessionEvent(devType) return 2 end
function custom_exitSessionEvent(devType) return 2 end
function custom_ledEvent(idx, ledFunction, state) return 2 end