Jump to content
The simFlight Network Forums

Rotary Encoder Problems


Recommended Posts

Could someone advise as to the setting of rotary encoders.

I can operate the encoder and get Joy!#2 BTN0 which I set OBS inc, I then get Joy#64 BTN1 which I set to OBS inc fast, then Joy#2 BTN1 for OBS dec  and Joy#64 BTN3 as OBS dec fast.

All selections have been left at parameter 0.

This operates the OBS but if I rotate slowly if moves fast and if I rotate fast it moves slower. What am I doing wrong?

I notice there are also Joy#64 BTN 0 and Joy#64 BTN2: do these have to be set?

This is the same for spd, but nav, com, hdg, alt and vs do not give me the option of Joy#64, therefore I am unable to set for fast control. This appears to only allow only two encoders to have access to Joy#64, is there a reason for this?

In effect this is only Joy#64 BTN0 to Joy#64 BTN 7

I am using PoKeys interface card  set for seven encoders and the FSUIPC Lua script is set as:

[Vendor = 0x1DC3
Product = 0x1001
Device = 0  -- Multiple devices of the same name need increasing Device numbers

-- Use separate Lua plug-ins for separate cards!

-- NOTE: this can handle up to 16 rotaries only, using the first 64 "virtual buttons"
-- List the pairs here:

Rotaries = {1,2,3,4,5,6,7}]

Reading the NOTE above 16 encoders should have four Joy# 64 each or am I not understanding this correctly!

Thanks

Bill.

EDIT: I am using FS9

Link to comment
Share on other sites

18 hours ago, bloggoman said:

I can operate the encoder and get Joy!#2 BTN0 which I set OBS inc, I then get Joy#64 BTN1 which I set to OBS inc fast, then Joy#2 BTN1 for OBS dec  and Joy#64 BTN3 as OBS dec fast.

Er .. button on joystick numbers 64 to 72 are all VIRTUAL buttons, operating from bits being toggled in FSUIPC offsets. It sounds like you have some program (or Lua plug-in) also reading the rotaries and sending them to FSUIPC as virtual buttons!

You most certainly don't want to assign as a real joystick AND as a virtual one! That will mess things up for sure. You must use one or the other, or probably best stop whatever it is you have running which is working the virtual joystick button offsets.

18 hours ago, bloggoman said:

am using PoKeys interface card  set for seven encoders and the FSUIPC Lua script is set as:

So it is a Lua script to blame?

Sorry, I don't know anything about PoKeys whatsoever, but if your rotaries are seen on regular joysticks 0-15 then I don't think you have any need for anything else, unless PKeys doesn't give you the fast/slow alternatives. Is that why you are using a Lua plug-in?

18 hours ago, bloggoman said:

Vendor = 0x1DC3
Product = 0x1001
Device = 0  -- Multiple devices of the same name need increasing Device numbers

-- Use separate Lua plug-ins for separate cards!

-- NOTE: this can handle up to 16 rotaries only, using the first 64 "virtual buttons"
-- List the pairs here:

Rotaries = {1,2,3,4,5,6,7}

Ah, that looks like it is based on the Rotaries.lua examle provided with FSUIPC. In that case you must do ALL your assignmetns on joysticks 64-72, not to the 'real' joysticks 10-15.

18 hours ago, bloggoman said:

Reading the NOTE above 16 encoders should have four Joy# 64 each or am I not understanding this correctly!

No, there are only 32 buttons on each joystick. There would be 32 on Joy#64 and 32 on Joy#65. You only have 7 encoders, so just 28 buttons on Joy #64.

Do NOT also program on Joy#2!

To program the fast turn, turn it fast, for the slow turn, turn it slow. You should get different button numbers (on Joy#64) for each. Same the other direction, so 4 distinct button numbers. 

If you get the opposite results to what you expected you have assigned them incorrectly.

Pete

 

Link to comment
Share on other sites

OK I understand about the virtual joysticks and have set the encoders 1 & 2 with the Joy#64 buttons 0-7. I am however, unable to get fast with fast turn and slow with slow turn whatever configuration I set; it will only work opposite i.e. fast rotation of the encoder increments slowly and slow rotation increments fast. This is not a concern as it is easy enough to work with.

When I attempt to set encoder 3 I am unable to get the joy#64 button to display whether I rotate the encoder fast or slow I only get the real joy#2.

I thought this may require InitialButton=j,b setting in the INI file, but this made no difference, so what am I doing wrong?

Bill.

 

Link to comment
Share on other sites

1 hour ago, bloggoman said:

I am however, unable to get fast with fast turn and slow with slow turn whatever configuration I set; it will only work opposite i.e. fast rotation of the encoder increments slowly and slow rotation increments fast.

It may be that the FS controls are wrongly named in FS. Some are -- I don't recall which. As a test you could try assigning them to keystrokes or buttons and see if you get the same.

Either way, the obvious and easy solution is to assign them the other way round!

Quote

When I attempt to set encoder 3 I am unable to get the joy#64 button to display whether I rotate the encoder fast or slow I only get the real joy#2.

Do encoders 1 and 2 give joystick number 2 as well? It may just be that the joystick 2 input is always arriving into FSUIPC before that for the Lua virtual button. You could tell FSUIPC to ignore the buttons arriving first so it sees the ones signalling from the same action. See the IgnoreThese parameter on page 18 of the Advanced User's guide.

Pete

 

Link to comment
Share on other sites

Didn't expect you to reply on a Sunday!

2 hours ago, Pete Dowson said:

Either way, the obvious and easy solution is to assign them the other way round!

 

I had already tried this it did but it did not work, but as I said it is not a problem.

 

3 hours ago, Pete Dowson said:

Do encoders 1 and 2 give joystick number 2 as well? It may just be that the joystick 2 input is always arriving into FSUIPC before that for the Lua virtual button. You could tell FSUIPC to ignore the buttons arriving first so it sees the ones signalling from the same action. See the IgnoreThese parameter on page 18 of the Advanced User's guide.

 

Yes encoder 1 & 2 show joy#2.

I tried setting the ignore parameter in INI and it saved, but when I loaded FS9 and run the lua it somehow removed it from the file.

This is how I set it in the INI file:

[Buttons]
InitialButton=j,b
IgnoreThese=j.b,2.4
IgnoreThese=j.b,2.5
ButtonRepeat=20,10

This is how the entry was after running FS9:

InitialButton=j,b
ButtonRepeat=20,10

I am assuming that this is the way the ignore parameter should be set!

I also tried starting the Lua program automatically and manually but this made no difference.

Bill.

Link to comment
Share on other sites

11 minutes ago, bloggoman said:

This is how I set it in the INI file:

[Buttons]
InitialButton=j,b
IgnoreThese=j.b,2.4
IgnoreThese=j.b,2.5

Oh dear. :-( The "j" stands for joystick number, the "b" stands for button number. You are supposed to REPLACE those with your joystick number and button number. Why would a parameter always start with "j,b"? Neither j nor b are valid numbers!

j = joystick, b = button. It was simply showing the format or the parameters to use:  j, b instead of b,j or j/b etc etc!

Pete

 

 

 

Link to comment
Share on other sites

I understood what the j & b meant and I thought that it was to correspond with the Lua program, but I  did replace "InitialButton=j,b" with "InitialButton=64,0" at one point.

In the advanced guide it states: "IgnoreThese=j.b,j.b" so I assumed it was meant to be "IgnoreThese=j.b,2.4" which was the joystick and button numbers, otherwise why is it necessary to put j,b twice unless it indicates that it is the joystick numbers to be ignored.

I will try again with: IgnoreThese=2.4

Bill.

Link to comment
Share on other sites

2 hours ago, bloggoman said:

I understood what the j & b meant and I thought that it was to correspond with the Lua program, but I  did replace "InitialButton=j,b" with "InitialButton=64,0" at one point.

InitialButton just does a one off "retend" press of that button. I don't think you need any of that forrotaries.

Quote

In the advanced guide it states: "IgnoreThese=j.b,j.b" so I assumed it was meant to be "IgnoreThese=j.b,2.4"

It is just intended to show there can be multiple entries. That's why there's also a "..." afterwards, which is normal punctuation to mean "and so on". Each entry is in the format j.b, separated by commas. You never literally put j and b in!

On your earlier reply,  I seem to have missed this part:

Quote

I had already tried this it did but it did not work, but as I said it is not a problem.

If the assignment to "fast" was when you turned is fast, and vice versa, then changing the assignments around, "slow" for "fast2 and "fast" for "slow" MUST work. It has no alternative. it is merely sending what you tell it.

Perhaps you should show me the [Buttons] section from your FSUIPC INI file, so I can see what you've done.

Pete

Link to comment
Share on other sites

14 hours ago, Pete Dowson said:

If the assignment to "fast" was when you turned is fast, and vice versa, then changing the assignments around, "slow" for "fast2 and "fast" for "slow" MUST work. It has no alternative. it is merely sending what you tell it.

Perhaps you should show me the [Buttons] section from your FSUIPC INI file, so I can see what you've done.

 

I have changed it again and what I get is two or three indents before it increments the display which is slow for three indents then suddenly jumps ten increments. This is the Button configuration from the INI:

[Buttons]
InitialButton=64,0
IgnoreThese=2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7
ButtonRepeat=20,10
0=P64,0,C65663,0
1=P64,1,C1027,0
2=P64,2,C65662,0
3=P64,3,C1026,0
4=P64,4,C65896,0
5=P64,5,C1021,0
6=P64,6,C65897,0
7=P64,7,C1020,0

[Profile.A320]
1=Airbus A320 IAE British Airways

[Keys.A320]
2=116,8,L36:R,0
4=117,8,L36:K,0
6=90,8,65580,0

[Buttons.A320]
0=P64,0,C1027,0
1=P64,1,C65663,0
2=P64,2,C1026,0
3=P64,3,C65662,0
4=P64,4,C65896,0
5=P64,5,C1021,0
6=P64,6,C65897,0
7=P64,7,C1020,0

This may need adjusting in the Lua program so I will play with this.

The important thing at the moment is that I am still unable to get any joystick numbers above Joy#64 Btn7. I have set the "IgnoreThese" as shown above and this has removed the "Joy2", but the entry box remains blank. I have also tried removing the "InirialButton" from the list but this has made no difference. As there is a profile for the A320 Buttons I also entered the "IgnoreThese" in this list all to no avail.

It appears as though anything above "Joy#64 Btn7" is being restricted somewhere, but I am not experienced enough to understand why!

One thing I have noticed was that "J=<< MISSING JOYSTICK >>" has been entered in the "Joynames" list as follows:

[JoyNames]
AutoAssignLetters=No
0=CH PRO PEDALS USB
0.GUID={36DA8880-FF31-11E5-8005-444553540000}
1=CH FLIGHT SIM YOKE USB
1.GUID={36DCF980-FF31-11E5-8006-444553540000}
2=Virtual Joystick
2.GUID={4B46EE70-15C1-11E6-8001-444553540000}
J=<< MISSING JOYSTICK >>

This was not there originally and even though I have removed all my alterations it is still listed; it seems to be a coincidence that it has the letter "J", perhaps this doesn't matter.

Bill.

Link to comment
Share on other sites

I have looked at the Lua program, although I do not fully understand Lua, but there is a "buttonbit = 4" in the program, would this have any bearing on the lack of "Joy#64".

 

Vendor = 0x1DC3
Product = 0x1001
Device = 0  -- Multiple devices of the same name need increasing Device numbers

-- Use separate Lua plug-ins for separate cards!

-- NOTE: this can handle up to 16 rotaries only, using the first 64 "virtual buttons"
-- List the pairs here:

Rotaries = {1,2,3,4,5,6,7}

-- Example { 31, 30, 25, 22 } would be 31+30 for one, 25+22 for the next, and so on
-- Which is clockwise and which counterclockwise doesn't matter -- you'll get
-- fast and slow of each in any case

dev, rd, wrf, wr, init = com.openhid(Vendor, Product, Device, Report)


if dev == 0 then
   ipc.log("Could not open HID")
   ipc.exit()
end

-- Set the boundary time in milliseconds between
-- "fast" (shorter) and "slow" (longer) signalling

FastTimeLimit = 40-- Adjust to taste

-- Polling time in milliseconds: should be much shorter than
-- the boundary time

Pollrate = 10  -- same as 50 times per second

-- Initialise variables used to keep track of things
LastTimes = {}
Buttons = 0
PrevButtons = 0
Diff = 0

-- This function will be called by a time event, set at the end of the program before exit.
function poll(Time)
 -- read any data available from the device (only need most recent report)
  data, n = com.readlast(dev, rd)

 if n ~= 0 then
   -- Data was returned, so get the status of all the possible "buttons" we are using
   -- one value of 32 bits
  Buttons = com.gethidbuttons(dev, data)           

   -- See if any changes occurred:
   Diff = logic.Xor(Buttons, PrevButtons)
   PrevButtons = Buttons
         
    if Diff ~= 0 then
     offset = 0x3340
     buttonbit = 1
    j = 1
     while Rotaries[j] ~= nil do
    mask = logic.Shl(1, Rotaries[j]-1)      
    if logic.And(Diff,mask) ~= 0 then
     -- This one changed
       -- See if changed in less than the "boundary" time
       thisbutton = buttonbit
       if (LastTimes[j] ~= nil) and ((Time - LastTimes[j]) < FastTimeLimit) then
           thisbutton = buttonbit + buttonbit  -- Use next higher button for fast
         end
         LastTimes[j] = Time
                       
        -- Toggle a virtual button accordingly
         ipc.togglebitsUB(offset, thisbutton)
    end
    
    j = j + 1
    buttonbit = 4 * buttonbit
    if logic.And(j,15) == 0 then
       buttonbit = 1
       offset = offset + 4
    end
    end
  end
 end
end

event.timer(Pollrate, "poll")

Bill.

Link to comment
Share on other sites

3 hours ago, bloggoman said:

I have changed it again and what I get is two or three indents before it increments the display which is slow for three indents then suddenly jumps ten increments.

Rotaries alternately signal "on" and "off", so you should always program both the "Press" and "Release" to the same control in order to get an It will be 2 clicks. action on every click.

3 hours ago, bloggoman said:

The important thing at the moment is that I am still unable to get any joystick numbers above Joy#64 Btn7

That is because the default "Rotaries.lua" is set for just the first 7 buttons. Look:

Rotaries = {1,2,3,4,5,6,7}

-- Example { 31, 30, 25, 22 } would be 31+30 for one, 25+22 for the next, and so on
-- Which is clockwise and which counterclockwise doesn't matter -- you'll get
-- fast and slow of each in any case
Link to comment
Share on other sites

Sorry, somehow I was unable to continue my last message , so continue here:

The button flags supplied by the USB deviceare defined here. You list pairs 1,2 and 3,4, and 5,6. Without seeing the input from your USB connnection I cannot tell, but you could try:

Rotaries = { 1,2,3,4,5,6,7,8,9,10 }

3 hours ago, bloggoman said:

I have looked at the Lua program, although I do not fully understand Lua, but there is a "buttonbit = 4" in the program, would this have any bearing on the lack of "Joy#64"

There's no "buttonbit = 4", only a "buttonbit = 4 * buttonbit", which shifts the bit up 2 places to address the next rotary acion. Remember it needs 2 bits per direction for each rotary (bits = button numbers).

And anyway, you don't have a "lack of Joy#64".

3 hours ago, bloggoman said:

As there is a profile for the A320 Buttons I also entered the "IgnoreThese" in this list all to no avail.

That parameter is ONLY for the main [Buttons] section.

3 hours ago, bloggoman said:

J=<< MISSING JOYSTICK >>

This was not there originally and even though I have removed all my alterations it is still listed; it seems to be a coincidence that it has the letter "J", perhaps this doesn't matter.

You must still have an entry somewhere with "j" in it, maybe your use of j.b earler. Search for all instances of j, or show me the complete INI/

Pete

 

Link to comment
Share on other sites

2 hours ago, Pete Dowson said:

Rotaries alternately signal "on" and "off", so you should always program both the "Press" and "Release" to the same control in order to get an It will be 2 clicks. action on every click.

 

I have done this and as you suggest it increments twice for each click, but this does not allow for fine adjustment. Do the parameters have to be set either 1 or 0 or left blank?

 

2 hours ago, Pete Dowson said:

The button flags supplied by the USB deviceare defined here. You list pairs 1,2 and 3,4, and 5,6. Without seeing the input from your USB connnection I cannot tell, but you could try:

Rotaries = { 1,2,3,4,5,6,7,8,9,10 }

 

I assumed that "Rotaries =" in Lua meant each rotary not that they were pairs. I have set it 1-10 as suggested but I am still unable to get "Joy#64 Btn8" onwards. One thing I have noticed is that although the box remained blank it has increased the amount in the button list in the INI and as well as P64 it now shows U64!

INI List:

[Auto.A320]
1=Lua Rotaries

[JoyNames]
AutoAssignLetters=No
0=CH PRO PEDALS USB
0.GUID={36DA8880-FF31-11E5-8005-444553540000}
1=CH FLIGHT SIM YOKE USB
1.GUID={36DCF980-FF31-11E5-8006-444553540000}
2=Virtual Joystick
2.GUID={4B46EE70-15C1-11E6-8001-444553540000}


[General]
UpdatedByVersion=3999z9b
WindSmoothing=No
AutoTaxiWind=No
PropTaxiWind=No
TimeSetMode=Partial
WhiteMessages=No
ThrottleSyncAll=No
GraduatedVisibility=No
LowerVisAltitude=0
UpperVisAltitude=25000
UpperVisibility=6000
GenerateCirrus=Yes
WindShearSharp=No
UpperWindGusts=No
ExtendMetarMaxVis=Yes
CorrectVSsign=Yes
MouseWheelTrim=No
MouseWheelTrimSpeed=1
BrakeReleaseThreshold=75
AxisInterceptIfDirect=No
DontResetAxes=No
DisconnTrimForAP=No
ZeroElevForAPAlt=No
AutoClearWeather=Yes
ExtendTopWind=Yes
WindSmoothness=5
SmoothPressure=No
PressureSmoothness=5
SmoothVisibility=No
VisibilitySmoothness=2
MaxSurfaceWind=0
WindLimitLevel=200
WindDiscardLevel=400
WindAjustAltitude=No
WindAjustAltitudeBy=2000
MinimumVisibility=0
MaximumVisibilityFewClouds=0
MaximumVisibility=0
MaximumVisibilityOvercast=0
MaximumVisibilityRainy=0
OneCloudLayer=No
ThinClouds=No
ThinThunderClouds=No
CloudThinness=1000
ThunderCloudThinness=10000
CloudTurbulence=No
CloudIcing=No
WindTurbulence=No
SuppressAllGusts=No
ExternalOptionControl=Yes
AutoTuneADF=No
KeepFS98CloudCover=No
ShowPMcontrols=No
MagicBattery=No
RudderSpikeRemoval=No
ElevatorSpikeRemoval=No
AileronSpikeRemoval=No
ReversedElevatorTrim=No
StopAutoFuel=No
TrapUserInterrupt=Yes
NavFreq50KHz=No
ClockSync=No
SmoothIAS=Yes
SetVisUpperAlt=No
VisUpperAltLimit=6000
MaxIce=3
MinIce=-1
WindSmoothingDelay=0
WindSmoothAirborneOnly=No
LimitWindVariance=No
VisSmoothingDelay=0
VisSmoothAirborneOnly=No
TrafficControlDirect=Yes
SuppressCloudTurbulence=No
SuppressWindTurbulence=No
SpoilerIncrement=512
JoystickTimeout=20
PollGFTQ6=Yes
BlankDisplays=No
ZapSound=firework
ShortAircraftNameOk=Substring
UseProfiles=Yes
TCASid=Flight
TCASrange=40
TrafficScanPerFrame=10
AxesWrongRange=No
AxisCalibration=No
CentredDialogue=Yes
ShowMultilineWindow=Yes
SuppressSingleline=No
SuppressMultilineFS=No
ClearWeatherDynamics=Yes
OwnWeatherChanges=No
FixWindows=No
FixControlAccel=No
WeatherReadInterval=4
MoveBGLvariables=Yes
TimeForSelect=4
WeatherReadsFast=No
LuaRerunDelay=66
MainMenu=&Modules
SubMenu=&FSUIPC ...

[JoystickCalibration]
AllowSuppressForPFCquad=Yes
ExcludeThrottleSet=Yes
ExcludeMixtureSet=Yes
ExcludePropPitchSet=Yes
SepRevsJetsOnly=No
ApplyHeloTrim=No
UseAxisControlsForNRZ=No
FlapsSetControl=0
FlapDetents=No
ReverserControl=66292
Reverser1Control=66422
Reverser2Control=66425
Reverser3Control=66428
Reverser4Control=66431
MaxThrottleForReverser=256
AileronTrimControl=0
RudderTrimControl=0
CowlFlaps1Control=0
CowlFlaps2Control=0
CowlFlaps3Control=0
CowlFlaps4Control=0
MaxSteerSpeed=60

[Sounds]
Path=D:\Program Files (x86)\Microsoft Games\Flight Simulator 9\Sound\
Device1=Primary Sound Driver
Device2=BenQ GL2250H-8 (NVIDIA High Definition Audio)
Device3=BenQ GL2250H-4 (NVIDIA High Definition Audio)

[MacroFiles]
1=A320MFD
2=WXRadar

[LuaFiles]
1=Airport
2=display vals
3=DynamicFriction
4=EICAS ECAM AC
5=EICAS ECAM DATA
6=EICAS ECAM ENG
7=EICAS ECAM FLT
8=EICAS ECAM FUEL
9=EICAS ECAM HYD
10=Frictions
11=Fuel737
12=gfdDisplay
13=GFpower
14=HidDemo
15=init pos
16=ipcDebug
17=landing
18=liar
19=log lvars
20=MasterClient
21=MFD 10
22=MFD 160
23=MFD 20
24=MFD 320
25=MFD 40
26=MFD 80
27=MFD ARC
28=MFD LS
29=MFD NAV
30=MFD PLN
31=MFD VOR
32=mrudder
33=MyDisplay
34=Payload737
35=record to csv
36=Rotaries
37=Rotaries2
38=SlaveServer
39=SyncAxis
40=testclnt
41=testsrvr
42=textmenu
43=ThrustSym
44=ThrustSym4
45=TileSix
46=TripleUse
47=VRI_SetBaro
48=VRI_SetMach
49=WP6test
50=WXradar

[Buttons]
ButtonRepeat=20,10
IgnoreThese=2.0, 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7
0=P64,0,C65663,0
1=P64,1,C1027,0
2=P64,2,C65662,0
3=P64,3,C1026,0
4=P64,4,C65896,0
5=P64,5,C1021,0
6=P64,6,C65897,0
7=P64,7,C1020,0
8=U64,0,C65663,0
9=U64,1,C1027,0
10=U64,2,C65662,0
11=U64,3,C1026,0

[Profile.A320]
1=Airbus A320 IAE British Airways

[Keys.A320]
2=116,8,L36:R,0
4=117,8,L36:K,0
6=90,8,65580,0

[Buttons.A320]
0=P64,0,C65663,0
1=P64,1,C1027,0
2=P64,2,C65662,0
3=P64,3,C1026,0
4=P64,4,C65896,0
5=P64,5,C1021,0
6=P64,6,C65897,0
7=P64,7,C1020,0
8=U64,0,C65663,0
9=U64,1,C1027,0
10=U64,2,C65662,0
11=U64,3,C1026,0

2 hours ago, Pete Dowson said:

There's no "buttonbit = 4", only a "buttonbit = 4 * buttonbit", which shifts the bit up 2 places to address the next rotary acion. Remember it needs 2 bits per direction for each rotary (bits = button numbers).

And anyway, you don't have a "lack of Joy#64".

 

Just clutching at straws!

2 hours ago, Pete Dowson said:

You must still have an entry somewhere with "j" in it, maybe your use of j.b earler. Search for all instances of j, or show me the complete INI/

Pete

 

I could not find the "j" so I deleted it from the file and it did not return after restarting FS9.

Bill

Link to comment
Share on other sites

11 minutes ago, bloggoman said:

I have done this and as you suggest it increments twice for each click

No no! I didn't suggest that. I said assign the same FS control for "press" and "realeae", because the rotary does a "press" on one click and a "release" on the next -- or at all the rotaries I've ever met do. So you only get ONE increment per click.

13 minutes ago, bloggoman said:

I assumed that "Rotaries =" in Lua meant each rotary not that they were pairs.

There are TWO actions on each rotary -- clockwise and anticlockwise.  They signal separately -- otherwise how can they be distinguished?

15 minutes ago, bloggoman said:

I have set it 1-10 as suggested but I am still unable to get "Joy#64 Btn8" onwards.

Well, in that case I would say it is something to do with the interface you are using. If I had it here I would you a USB analyser program on it to find out what it is doing, because it is not acting in a standard way. Are all the rotaries recognised as buttons on Joy #2?

17 minutes ago, bloggoman said:

One thing I have noticed is that although the box remained blank it has increased the amount in the button list in the INI and as well as P64 it now shows U64!

P="Press", "U" = "Unpress" (couldn't use "R" for release because that's used for "Repeat whilst pressed")

All this is explained in the FSUIPC4 documentation, in the section in the Advanced guide which explains button assignment formats.

Pete

 

Link to comment
Share on other sites

11 minutes ago, Pete Dowson said:

No no! I didn't suggest that. I said assign the same FS control for "press" and "realeae", because the rotary does a "press" on one click and a "release" on the next -- or at all the rotaries I've ever met do. So you only get ONE increment per click.

 

This is what I thought I had done!! But let us leave this fast and slow situation and I will peruse the manual for the umpteenth time, as now it is causing confusion and frustration and I would rather  sort out the Joy#64 problem.

16 minutes ago, Pete Dowson said:

There are TWO actions on each rotary -- clockwise and anticlockwise.  They signal separately -- otherwise how can they be distinguished?

 

I am aware of the rotary encoder actions but it was not clear to me that this was how the Lua was meant to be.

 

18 minutes ago, Pete Dowson said:

Well, in that case I would say it is something to do with the interface you are using. If I had it here I would you a USB analyser program on it to find out what it is doing, because it is not acting in a standard way. Are all the rotaries recognised as buttons on Joy #2?

 

I have set my interface card rotaries with the same configuration and as it is recognised in FSUIPC as "Joy#2" and is incremented with each encoder, I fail to see that the interface card is a problem. Why, if the card was the problem, would it allow the first two encoders to be acknowledged!

This is all new to me and I do not have answers, so if you believe the card to be the problem I can post on one of their sites to see if and further configuration is necessary.

Link to comment
Share on other sites

Quote

I have set my interface card rotaries with the same configuration and as it is recognised in FSUIPC as "Joy#2" and is incremented with each encoder, I fail to see that the interface card is a problem. Why, if the card was the problem, would it allow the first two encoders to be acknowledged!

I never said it was a problem, I said I don't know why the other encoders aren't being seen, that other controllers I've used and seen used work with that Lua plug-in.

Maybe the only way I'd understand what is going on with it would be to analyse the binary data being received on the USB cable to see why the extra encoders, over two, are not being seen. The function being used --  "com.gethidbuttons" -- may not understand the data it sees. Perhaps it is a completely valid set of data, but just in a format I did not know when I wrote that function some years back.

All I can think of doing is to add a lot more code to the Lua, or maybe into FSUIPC itself, to get and log the actual data being received, for you to run and test each rotary in turn, then send me the log so I can match up what happened to what was expected.

Quote

This is all new to me and I do not have answers, so if you believe the card to be the problem I can post on one of their sites to see if and further configuration is necessary

There you go again. the PROBLEM is not the card, the problem is not knowing why it is different, or in what way this is going wrong. I have been trying to help you sort it out, but if you read back it's only been these last hours where we are finally coming to the conclusion I stated, which you seem to consider as me accusing the card of being or having a problem!

I do not know the Pokeys system, I have no idea what it is or what it does, and I cannot possibly know about all the possible interfaces out there. All I can do is try to help. I do not want to have to buy a card just to see. The Lua plug-in system is supposed to alleviate the load on me meeting user requests, by allowing them to do their own thing rather than me add more and more to FSUIPC.

If you wish to carry on, when I have a little more time (which I certainly haven't since last Thursday, whilst working with an engineer on my cockpit trying to sort my own problems out), I will look at code needed to find out more about what is happening. I can't really look at that before Wednesday.

Pete

 

Link to comment
Share on other sites

I am sorry if I misunderstood you and perhaps I need to reconsider how I word posts.

Without knowing the workings of FSUIPC or the Pokeys interface card I thought that once the signal had been received that was all there was to it, but now you have explained I understand better.

I do appreciate all the help you have given and any more you can add, whenever you can find time. I am however, worried that this may be time consuming for you as this is FS9 and I doubt many members will benefit from the results as the majority use FSX. If you do feel that it is fairly easy to fix and is worth continuing, then as I say it would be appreciated and any testing you want I can do.

As for the Pokeys I would certainly not want you to buy one for this project; if necessary I would send you mine to play with!

Bill.

Link to comment
Share on other sites

One thing you can do which might help is run HidScanner and show me the contents of the related file -- not all of it, just the entry for Pokeys.

Get HidScanner from the "Useful Additional Programs" thread in the Download Links subforum.

Pete

 

Link to comment
Share on other sites

As requested Hidscan.

 

Device at "\\?\hid#vid_1dc3&pid_1001&mi_00#8&1eb1748&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}"
  Vendor=1DC3, Product=1001 (Version 16.0)
  Manufacturer= PoLabs
  Product= Virtual joystick
  Serial Number= 2.35939
  Usage Page: 1
  Input Report Byte Length: 18
  Output Report Byte Length: 0
  Feature Report Byte Length: 0
  Number of Link Collection Nodes: 2
  Number of Input Button Caps: 1
  Number of InputValue Caps: 7
  Number of InputData Indices: 39
  Number of Output Button Caps: 0
  Number of Output Value Caps: 0
  Number of Output Data Indices: 0
  Number of Feature Button Caps: 0
  Number of Feature Value Caps: 0
  Number of Feature Data Indices: 0
  Buttons range 1 -> 32 at indices 6 -> 37
  Value U/RX at index 0, range 0 -> 4095, using 16 bits
  Value V/RY at index 1, range 0 -> 4095, using 16 bits
  Value Z at index 2, range 0 -> 4095, using 16 bits
  Value Y at index 3, range 0 -> 4095, using 16 bits
  Value X at index 4, range 0 -> 4095, using 16 bits
  Value Thr at index 5, range 0 -> 4095, using 16 bits
  Value POV at index 38, range 0 -> 7, using 8 bits
  **************************************************************************

  Device at "\\?\hid#vid_1dc3&pid_1001&mi_01#8&19aea38d&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}"
  Vendor=1DC3, Product=1001 (Version 16.0)
  Manufacturer= PoLabs
  Product= Communication interface
  Serial Number= 2.35939
  Usage Page: FF10
  Input Report Byte Length: 65
  Output Report Byte Length: 65
  Feature Report Byte Length: 0
  Number of Link Collection Nodes: 1
  Number of Input Button Caps: 0
  Number of InputValue Caps: 1
  Number of InputData Indices: 1
  Number of Output Button Caps: 0
  Number of Output Value Caps: 1
  Number of Output Data Indices: 1
  Number of Feature Button Caps: 0
  Number of Feature Value Caps: 0
  Number of Feature Data Indices: 0
  Value 0x01 at index 0, range 0 -> 255, using 8 bits
  **************************************************************************

  Device at "\\?\hid#vid_1dc3&pid_1001&mi_02#8&a289a35&0&0000#{4d1e55b2-f16f-11cf-88cb-001111000030}"
  Vendor=1DC3, Product=1001 (Version 16.0)
  Manufacturer= PoLabs
  Product= Virtual keyboard
  Serial Number= 2.35939
  Device is a keyboard
  Usage Page: 1
  Input Report Byte Length: 35
  Output Report Byte Length: 0
  Feature Report Byte Length: 0
  Number of Link Collection Nodes: 1
  Number of Input Button Caps: 2
  Number of InputValue Caps: 0
  Number of InputData Indices: 110
  Number of Output Button Caps: 0
  Number of Output Value Caps: 0
  Number of Output Data Indices: 0
  Number of Feature Button Caps: 0
  Number of Feature Value Caps: 0
  Number of Feature Data Indices: 0
  **************************************************************************

Bill.

 

 

Link to comment
Share on other sites

25 minutes ago, bloggoman said:

  Buttons range 1 -> 32 at indices 6 -> 37
  Value U/RX at index 0, range 0 -> 4095, using 16 bits
  Value V/RY at index 1, range 0 -> 4095, using 16 bits
  Value Z at index 2, range 0 -> 4095, using 16 bits
  Value Y at index 3, range 0 -> 4095, using 16 bits
  Value X at index 4, range 0 -> 4095, using 16 bits
  Value Thr at index 5, range 0 -> 4095, using 16 bits
  Value POV at index 38, range 0 -> 7, using 8 bits

That looks okay. I assume all your rotaries are connected as two buttons + common each? The other connections available are all analologue, for potentiometers and the like. So it supports 32 buttons, contiguously arranged in bits 6-37. It should all work fine.

Tomorrow, or even maybe later today if I get time, I will have something which logs what I see coming in. There may be some logging already built in which will do the job, i shall check for that first.

Pete

 

 

Link to comment
Share on other sites

Okay. I rigged up an old device I had with more than 8 buttons (no rotaries, bt for this test it didn't matter), and tested the "Rotaries.lua" on it with debug tracing enabled. And I found the problem.

The distributed Rotaries.lua has a bug. Find this line:

 ipc.togglebitsUB(offset, thisbutton)

and change the "UB" into "UD". i.e.

 ipc.togglebitsUD(offset, thisbutton)

I don't know when this got changed in the Examples package, but in my original, it was correct. otherwise I'd have spotted it earlier!

"UB" means Unsigned Byte. "UD" is Unsigned Double wrod. A byte has 8 bits (8 buttons), a double word has 32. Each joystick allows 32 buttons, but this error restricted the plug-in to just the 8!

I've fixed the distributed copy -- it will be installed with the next main update, but meanwhile you only need to change that one character.

Pete

 

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.