zuby Posted March 2, 2018 Report Share Posted March 2, 2018 Hello Pete, I made 8 axes and 128 buttons joystick. when i connect joystick it shows joy# 64 to 71 in fsuipc buttons/switches tab. is it normal? the joystick 0-31 buttons is working fine. but 32 to 127 is responding very slow. i don't know why? and rotary pulse switch is also skipping some values. i'm connecting a rotary on two buttons. pls guide me. thanks Link to comment Share on other sites More sharing options...
Pete Dowson Posted March 2, 2018 Report Share Posted March 2, 2018 2 hours ago, zuby said: I made 8 axes and 128 buttons joystick. 128 buttons? I thought with DirectInput that the maximum was 64. Is it a DirectInput joystick device? 2 hours ago, zuby said: when i connect joystick it shows joy# 64 to 71 in fsuipc buttons/switches tab. is it normal? See the FSUIPC Offsets list, offset 3340. See what it says there? Virtual buttons, operated by writing to the 36 bytes 0x3340-0x3363, are treated as joysticks 64-73. You have the equivalent of 8 joysticks (8 x 16 = 128), so 64-71 seems correct. Surely you must know: you must have written the program which is writing to these offsets, or at least been told by the author? 2 hours ago, zuby said: 32 to 127 is responding very slow. i don't know why? Well, they are all the same to FSUIPC, just bits in offsets. You'll need to look at your hardware of whatever program you have writing to FSUIPC. 2 hours ago, zuby said: and rotary pulse switch is also skipping some values. i'm connecting a rotary on two buttons. pls guide me. Is it an encoding rotary, pulsing one or the other buttons according to direction, or one which pulses both all the time but with different phasing to differentiate the direction? The latter need quite a complicated programmatic treatment to decode. There is a discussion on this in the Advanced Users guide. "Skipping values" is meaningless in relation to buttons. The buttons will simple be "pressed" and "unpressed" alternately. There's nothing to "skip". The rest depends what you do with the button press/release indications. Pete Link to comment Share on other sites More sharing options...
zuby Posted March 2, 2018 Author Report Share Posted March 2, 2018 Thanks Pete for your response. 41 minutes ago, Pete Dowson said: 128 buttons? I thought with DirectInput that the maximum was 64. Is it a DirectInput joystick device? It is 128 buttons HID joystick. 28 minutes ago, Pete Dowson said: Well, they are all the same to FSUIPC, just bits in offsets. You'll need to look at your hardware of whatever program you have writing to FSUIPC. Im using hiddemo.lua program. my joystick buttons matrix is 8x16. will the below program work fine with 8x16 matrix. Vendor = 0x03EB Product = 0x2043 Device = 0 Report = 0 Pollrate = 25 dev, rd, wrf, wr, init = com.openhid(Vendor, Product, Device, Report) if dev == 0 then ipc.log("Could not open HID") ipc.exit() end buttons = {} -- Up to 256 buttons = 8 x 32 bit words prevbuttons = { 0, 0, 0, 0, 0, 0, 0, 0 } function Poll(time) -- We use "readlast" so the values we use are the most up-to-date CurrentData, n, discards = com.readlast(dev, rd) -- Extract values we need if n ~= 0 then -- Now handle the buttons : up to 256 of them! buttons[1], buttons[2], buttons[3], buttons[4], buttons[5], buttons[6], buttons[7], buttons[8] = com.GetHidButtons(dev, CurrentData) -- check for changes i = 1 while i <= 8 do if buttons[i] ~= prevbuttons[i] then prevbuttons[i] = buttons[i] -- Send to FSUIPC as a set of 32 virtual buttons -- i.e. DWORD offsets 3340 onwards ipc.writeUD(0x3340 + ((i-1) * 4), buttons[i]) end i = i + 1 end end end ------------------------------------------------------------------------ if init then -- Deal with initial values, if supplied (some joysticks don't) ipc.log("init seen!") Poll(0) end if Pollrate == 0 then -- Ouch. Mustn't divide by zero! Pollrate = 25 end event.timer(1000/Pollrate, "Poll") -- poll values 'Pollrate' times per second 37 minutes ago, Pete Dowson said: Is it an encoding rotary, pulsing one or the other buttons according to direction, or one which pulses both all the time but with different phasing to differentiate the direction? it is a rotary switch here its diagram. Link to comment Share on other sites More sharing options...
Pete Dowson Posted March 2, 2018 Report Share Posted March 2, 2018 It all looks okay to me. There'll be no difference in any of the timings, all 128 or 256 buttons will be treated exactly alike by the plug in. With 128 buttons instead of 256 you could shorten the loop to "while i <= 4 do", and only read the first 4 "buttons[]" values, but it won't make any noticeable difference. It looks like only one button connection is made on the rotary being turned, so then it is a simple matter of detecting the buttons being pressed and releaed. What you then do with them is up to you. There are no "values" being skipped because it isn't related to values. Pete Link to comment Share on other sites More sharing options...
zuby Posted March 2, 2018 Author Report Share Posted March 2, 2018 Thanks Pete your gud response. I will check to change while loop. then inform you. 4 hours ago, Pete Dowson said: There are no "values" being skipped because it isn't related to values. I mean when i attach Ap Spd Inc, from fs control, to rotary switch then rotate rotary knob air speed values do not increment smoothly...means rotary switch's 1 or two detentes pass without changes air speed values. is it rotary switch problem or programming bug? Link to comment Share on other sites More sharing options...
Pete Dowson Posted March 2, 2018 Report Share Posted March 2, 2018 9 minutes ago, zuby said: 1 or two detentes pass without changes air speed values. is it rotary switch problem or programming bug? Don't forget that the buttons are pressed and released on alternate "clicks". If you want every click to count then you therefore have to program both "press" and "release". Additionally, turning any rotary too fast will mean that the button scanning with miss some "clicks". You can incread the scan frequency (it's an INI file parameter, but it's a trade off between that and affecting the Sim's performance. The GoFlight rotaries, as on their RP48 module, send back "fast" or "slow" codes -- i.e. effectively 4 buttons for each rotary, fast and slow either way. The fast ones are generally used to do things like increment by 10 whilst the slow increment by 1 (for example). But nevertheless not all clicks will be noticed unless the dials are turned at a speed not exceeding the joystick scan rate. It just isn't possible. You might like to try using the Lua example "Rotaries.lua", provided in the Examples ZIP. This is specifically aimed at rotaries on HID devices. That implements the same sort of fast/slow results for the RP48, treated as a basic HID device, as the GoFlight driver itself does. Pete Link to comment Share on other sites More sharing options...
zuby Posted March 4, 2018 Author Report Share Posted March 4, 2018 Thanks Pete for guidance. now buttons are working fine I changed while loop limit to 4 in HIDemo.lua as you said. On 3/2/2018 at 11:01 PM, Pete Dowson said: You can incread the scan frequency (it's an INI file parameter could you tell me? which parameter should i change in ini file? On 3/2/2018 at 11:01 PM, Pete Dowson said: The fast ones are generally used to do things like increment by 10 whilst the slow increment by 1 (for example). Ok. it means i need push button rotary that will change incremental value. will rotary encoder also miss some click? On 3/2/2018 at 11:01 PM, Pete Dowson said: You might like to try using the Lua example "Rotaries.lua", provided in the Examples ZIP. thanks Pete I liked this one its working. what would you recommend for trim wheel, rotary switch or multi turn pot? Link to comment Share on other sites More sharing options...
Pete Dowson Posted March 4, 2018 Report Share Posted March 4, 2018 5 hours ago, zuby said: Ok. it means i need push button rotary that will change incremental value. will rotary encoder also miss some click? According to your diagram, it is a rotary encoder. A simple one would click both buttons on each click, just in a different phasing. 5 hours ago, zuby said: could you tell me? which parameter should i change in ini file? Look in the [Buttons] section. PollInterval -- decrease for a faster scan. (the FSUIPC Advanced User's guide contains all this sort of information). 5 hours ago, zuby said: what would you recommend for trim wheel, rotary switch or multi turn pot? Rotary switch. It's a nightmare programming any sort of axis for such a job. Pete Link to comment Share on other sites More sharing options...
zuby Posted March 5, 2018 Author Report Share Posted March 5, 2018 Thanks a lot Pete for your time and help. I'm glad now my rotaries and buttons are working gud. thanks again. Link to comment Share on other sites More sharing options...
zuby Posted March 5, 2018 Author Report Share Posted March 5, 2018 Hello Pete, On 3/2/2018 at 11:01 PM, Pete Dowson said: The GoFlight rotaries, as on their RP48 module, send back "fast" or "slow" codes -- i.e. effectively 4 buttons for each rotary, fast and slow either way. The fast ones are generally used to do things like increment by 10 whilst the slow increment by 1 (for example). Is this dual concentric rotary switch? could you attach that rotary pic? Link to comment Share on other sites More sharing options...
Pete Dowson Posted March 5, 2018 Report Share Posted March 5, 2018 1 hour ago, zuby said: Is this dual concentric rotary switch? could you attach that rotary pic? No, not on the RP48. For a picture of the RP48 check the Goflight website. I'm sure they have pictures of all their units there. So may have dual concentric ones, I don't know. The fast/slow decoding will be done in their firmware, not by hardware, much like my method via the Rotaries lua plug-in. Pete Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now