Zero-One Posted January 31, 2022 Posted January 31, 2022 Hi all, I have a game controller with an 8-position rotary switch. I have mapped this to the UH-1H Armament Panel Rocket-Pair 8-position switch, but have some odd behaviour. Hoping you can help. In-game the switch positions are marked 0 to 7 (zero rocket pairs selected, to seven rocket pairs selected) My game controller has the switch positions mapped to a button press, so within Windows/control-panel/gamecontroller-settings/properties we see that setting the switch position maps as follows: Physical switch position 7 = game controller Button 18 depressed (only) Physical switch position 6 = game controller Button 19 depressed (only) Physical switch position 5 = game controller Button 20 depressed (only) Physical switch position 4 = game controller Button 21 depressed (only) Physical switch position 3 = game controller Button 22 depressed (only) Physical switch position 2 = game controller Button 23 depressed (only) Physical switch position 1 = game controller Button 24 depressed (only) Physical switch position 0 = no buttons depressed In the UH-1H/joystick/default.lua file, I create the following entry (and I suspect this is where I might have an issue): {down = 3011, value_down = 0.1, up = 3011, value_up = 0.0, cockpit_device_id = devices.WEAPON_SYS, name = "ALT Rocket Pair 1", category = _("Armament System"), }, {down = 3011, value_down = 0.2, up = 3011, value_up = 0.0, cockpit_device_id = devices.WEAPON_SYS, name = "ALT Rocket Pair 2", category = _("Armament System"), }, {down = 3011, value_down = 0.3, up = 3011, value_up = 0.0, cockpit_device_id = devices.WEAPON_SYS, name = "ALT Rocket Pair 3", category = _("Armament System"), }, {down = 3011, value_down = 0.4, up = 3011, value_up = 0.0, cockpit_device_id = devices.WEAPON_SYS, name = "ALT Rocket Pair 4", category = _("Armament System"), }, {down = 3011, value_down = 0.5, up = 3011, value_up = 0.0, cockpit_device_id = devices.WEAPON_SYS, name = "ALT Rocket Pair 5", category = _("Armament System"), }, {down = 3011, value_down = 0.6, up = 3011, value_up = 0.0, cockpit_device_id = devices.WEAPON_SYS, name = "ALT Rocket Pair 6", category = _("Armament System"), }, {down = 3011, value_down = 0.7, up = 3011, value_up = 0.0, cockpit_device_id = devices.WEAPON_SYS, name = "ALT Rocket Pair 7", category = _("Armament System"), }, In-game I go to Settings/Controls and my new Options "Alt Rocket Pair X" are available. I map my game controller buttons 18 - 24 to these new settings 7 - 1 as appropriate. But here's the issue. When I rotate the game-controller knob up, then down, through the full range I get the following behaviour: Controller knob -> Result in-game 0 -> 0 1 -> 1 2 -> 0 3 -> 0 4 -> 0 5 -> 0 6 -> 0 7 -> 0 6 -> 6 5 -> 5 4 -> 4 3 -> 3 2 -> 2 1 -> 1 0 -> 0 So rotating down works perfect, rotating up only works on the first step. Why? Any ideas? If someone else has done it (I'm sure they have - happy just for a link). Thanks for your time.
ANDR0ID Posted February 20, 2023 Posted February 20, 2023 It looks like, since you have values assign to both the up and down positions of the controller switch, that the commands are getting over ridden on the way "up" IE moving the physical switch from 1 to 2 gives, results in the value_up of 1 being given, which is zero. Rotating down, based on your data, has the opposite effect where the correct value_down figure is dominant. Have you tried removing the value_up portion of your code?
Zero-One Posted May 13, 2023 Author Posted May 13, 2023 (edited) Yes, thanks ANDROID. With your input plus I've recently converted over to using Quaggles Input Command Injector and Munkwolf's extensive keybinds. Adding the following (mirroring other rotary switches in Munkwolfs keybinds file) does work, but requires an additional button press for value zero (rather than simply: if not 1-7 down, then zero). Out with the soldering iron then! {down = 3011, cockpit_device_id = devices.WEAPON_SYS, value_down = 0, name = _('Rocket Pair 0'), category = {_('Armament System'), _('Custom')}}, {down = 3011, cockpit_device_id = devices.WEAPON_SYS, value_down = 0.11, name = _('Rocket Pair 1'), category = {_('Armament System'), _('Custom')}}, {down = 3011, cockpit_device_id = devices.WEAPON_SYS, value_down = 0.22, name = _('Rocket Pair 2'), category = {_('Armament System'), _('Custom')}}, {down = 3011, cockpit_device_id = devices.WEAPON_SYS, value_down = 0.33, name = _('Rocket Pair 3'), category = {_('Armament System'), _('Custom')}}, {down = 3011, cockpit_device_id = devices.WEAPON_SYS, value_down = 0.44, name = _('Rocket Pair 4'), category = {_('Armament System'), _('Custom')}}, {down = 3011, cockpit_device_id = devices.WEAPON_SYS, value_down = 0.55, name = _('Rocket Pair 5'), category = {_('Armament System'), _('Custom')}}, {down = 3011, cockpit_device_id = devices.WEAPON_SYS, value_down = 0.66, name = _('Rocket Pair 6'), category = {_('Armament System'), _('Custom')}}, {down = 3011, cockpit_device_id = devices.WEAPON_SYS, value_down = 0.77, name = _('Rocket Pair 7'), category = {_('Armament System'), _('Custom')}}, Appreciate your reply. Edited May 13, 2023 by Zero-One
Recommended Posts