From 6f8803a5e60246f0231f6c3d0642c3ece04a4944 Mon Sep 17 00:00:00 2001 From: Hugues Hiegel Date: Wed, 20 Nov 2013 03:39:32 +0100 Subject: [gugus] controls : rF/rF2 LCD switcher. Don’t work on special keys.... MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/gugus/controls.lua | 43 ++++++++++++++++++++++--------------------- 1 file 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 -- cgit v1.2.3