summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugues Hiegel <hugues@hiegel.fr>2013-11-20 03:39:32 +0100
committerHugues Hiegel <hugues@hiegel.fr>2013-11-20 03:39:32 +0100
commit6f8803a5e60246f0231f6c3d0642c3ece04a4944 (patch)
tree605316799a7b3619e0724c9e521e5bba1603663b
parent466983819c9c8a97229f89e9e3cfb3d36ad57e05 (diff)
[gugus] controls : rF/rF2 LCD switcher. Don’t work on special keys....
-rw-r--r--scripts/gugus/controls.lua43
1 files changed, 22 insertions, 21 deletions
diff --git a/scripts/gugus/controls.lua b/scripts/gugus/controls.lua
index ff11bf5..2651f17 100644
--- a/scripts/gugus/controls.lua
+++ b/scripts/gugus/controls.lua
@@ -1,41 +1,41 @@
---
-mLCDup = 10
mLCDdown = 9
+mLCDup = 10
mKeyDelay = 100
--
-- rFactor
---
mRFactorLCD_keys = {
- "H", -- std
- "J", -- standings
- "K", -- pit
- "L", -- vehicle
- "Y", -- aids
- "I", -- extra
- "O" -- race
+ 0x36, -- std
+ 0x37, -- standings
+ 0x38, -- pit
+ 0x39, -- vehicle
+ 0x30, -- aids
+ "-", -- extra
+ "=" -- race
}
+mRFactorLCD_states = table.getn(mRFactorLCD_keys)
mRFactorLCD_state = 0
--
-- rFactor2
---
mRFactor2LCD_keys = {
- "6", -- std
- "7", -- standings
- "8", -- pit
- "9", -- vehicle
- "]", -- aids
- "0", -- extra
- "-", -- race
- "=" -- penalities
+ 0x36, -- std
+ 0x37, -- standings
+ 0xA3, -- pit (Right CTRL)
+ 0x38, -- vehicle
+ 0x39, -- aids
+ 0x30, -- extra
+ "-", -- race
+ "=" -- penalities
}
+mRFactor2LCD_states = table.getn(mRFactor2LCD_keys)
mRFactor2LCD_state = 0
function custom_controlsEvent(deviceType, ctrlType, ctrlPos, value, funcIndex, targetDevice)
- -- print ( string.format("[%s] %s:%s = %s => %s (%s)", deviceType, ctrlType, ctrlPos, value, funcIndex, targetDevice) )
+ --print ( string.format("[%s] %s:%s = %s => %s (%s)", deviceType, ctrlType, ctrlPos, value, funcIndex, targetDevice) )
if funcIndex == -1 then
if ctrlType == 1 and ( ctrlPos == mLCDup or ctrlPos == mLCDdown ) and value == 0 then
@@ -57,7 +57,7 @@ function custom_controlsEvent(deviceType, ctrlType, ctrlPos, value, funcIndex, t
mRFactor2LCD_state = mRFactor2LCD_state - 1
end
- mRFactor2LCD_state = mRFactor2LCD_state % table.getn(mRFactor2LCD_keys)
+ mRFactor2LCD_state = mRFactor2LCD_state % mRFactor2LCD_states
--print ( " << rF2 :" , mRFactor2LCD_state)
Key = mRFactor2LCD_keys[mRFactor2LCD_state + 1]
@@ -71,7 +71,7 @@ function custom_controlsEvent(deviceType, ctrlType, ctrlPos, value, funcIndex, t
mRFactorLCD_state = mRFactorLCD_state - 1
end
- mRFactorLCD_state = mRFactorLCD_state % table.getn(mRFactorLCD_keys)
+ mRFactorLCD_state = mRFactorLCD_state % mRFactorLCD_states
--print ( " << rF :" , mRFactorLCD_state)
Key = mRFactorLCD_keys[mRFactorLCD_state + 1]
@@ -80,6 +80,7 @@ function custom_controlsEvent(deviceType, ctrlType, ctrlPos, value, funcIndex, t
if Key ~= nil then
--print ( "KeyStroke : ", Key )
SetKeystroke(Key, mKeyDelay, "")
+ --SLISleep(10)
return 0
end
end