Jump to content
The simFlight Network Forums

Compound with rotary encoder


guit33

Recommended Posts

hello

I do not succed to make work my dual rotary with click encoder with the compound function.

 (In the 737 NG via MSFS2020)

When I turn it nothing is happening (no affectation in fsuipc)

I try this:

79=CP(+2,13)PC,17,CPPMDG_B737-7_NAV1_RADIO_WHOLE_INC,0
80=CP(+2,13)PC,16,CPPMDG_B737-7_NAV1_RADIO_WHOLE_DEC,0
81=CP(+2,13)PC,17,CPPMDG_B737-7_NAV2_RADIO_WHOLE_INC,0
82=CP(+PC,13)PC,16,CPPMDG_B737-7_NAV2_RADIO_WHOLE_DEC,0

FSUICP change always the name of my joystick from 2 to PC for the last line.. I don't know why

When I press the rotary encoder (button 13) I want to change the rotary function from from nav 1 to nav 2.

For the moment I test it only with the unit.

 

 

FSUIPC7.ini

Link to comment
Share on other sites

Could you please also activate logging for Buttons & keys as well as Events, and produce a short log file (i.e. load a plane, turn your selection rotary to the required position and then try to inc/dec, then exit FSUIPC). If you do this with the logging console open (Log -> Open Console....) you may be able to determine what is happening and fix this yourself, otherwise attach the log and I will take a look (you can compress/zip it if too large to attach directly).

John

Link to comment
Share on other sites

I succeed to make it work now !

I have a last question (I read the advanced user but I do not find the solution)

I want to give three different function to my rotary encoder (one for NAV, other for VOR, last for ADF), I have three button (button 1, 2 and 3) on a joystick (each button will activate one function)

When I push button 1 the first function is activated (NAV). To be able to use the second function I have to push first the one button (to desactivate the first function) and then push button 2.

Is there a way to not have to push again button 1 to desactivate the function ?

Link to comment
Share on other sites

2 minutes ago, guit33 said:

I succeed to make it work now !

Great!

2 minutes ago, guit33 said:

I want to give three different function to my rotary encoder (one for NAV, other for VOR, last for ADF), I have three button (button 1, 2 and 3) on a joystick (each button will activate one function)

When I push button 1 the first function is activated (NAV). To be able to use the second function I have to push first the one button (to desactivate the first function) and then push button 2.

Is there a way to not have to push again button 1 to desactivate the function ?

Yes, I am sure there is...are you using button flags for you compound conditions? if not, switch to using those. Then, when button 1 is pressed, you can have two additional assignments that clears the button flag for your 2nd and 3rd buttons, and similarly, button 2 would have additional assignments to clear the flags for buttons 1 and 3, and button 4 to clear the flags for buttons 1 and 2. See page 21 for details on the "latching" flags, as well as the controls to set/clear/toggle these manually.

Btw, I have just noticed that you are using FSUIPC7. There is a specific sub-forum for FSUIPC7 / MSFS - I will move this topic to that subforum.

John

Link to comment
Share on other sites

Hello

Yes I use the flag.

I saw that there is a FLAG CLEAR (C1004)

But I do not understand how this flag is affected to a button ?

For example: 

Here is the function for my button 2 (button N°2 of my joy 13):

19=CP(F+2,13)PC,17,CPPMDG_B737-7_NAV1_RADIO_WHOLE_INC,0

If I do this

19=CP(F+2,13)PC,17,CPPMDG_B737-7_NAV1_RADIO_WHOLE_INC,0, C1004

It will clear the flag but how can I know it is the flag for button 1 and 3 ?

Do I have to use the formula 256J+B ? (so for example for button 1: 3329) where do I put this number in the formule ?)

19=CP(F+2,13)PC,17,CPPMDG_B737-7_NAV1_RADIO_WHOLE_INC,0, C1004, 3329 ?

Link to comment
Share on other sites

1 hour ago, guit33 said:

If I do this

19=CP(F+2,13)PC,17,CPPMDG_B737-7_NAV1_RADIO_WHOLE_INC,0, C1004

No it won't - that is an illegal button assignment - you can only assign to one action per assignment line. You need to adds 2 additional assignment lines for each of your 3 buttons. If you have no current assignments to those buttons (which I guess is the case, as you are just using the button flags which are toggled automatically), for button 1, assign the press to Button Flag Clear for button 2 (i.e with parameter 56 * J + B, as stated in the manual), and either then duplicate this assignment and change the parameter to clear the button 3 flag, or (if your buttons are the press/release type) you can assign to clear the button 3 flag on release.
 

1 hour ago, guit33 said:

Do I have to use the formula 256J+B ? (so for example for button 1: 3329) where do I put this number in the formule ?)

19=CP(F+2,13)PC,17,CPPMDG_B737-7_NAV1_RADIO_WHOLE_INC,0, C1004, 3329 ?

As well as not being the correct format, you need to clear the flags when the buttons 1/2/3 are pressed, NOT on the rotary buttons, which should just inc/dec the appropriate value (and not change any flags).

John

Link to comment
Share on other sites

Hello

All is working now !

A last question (I don't find the answer), is it possible to activate a button flag when fsuicp is starting (not with a button). I want to have a button already activated when I start a flight

not sure it is possible

Link to comment
Share on other sites

Just now, guit33 said:

All is working now !

👍

Just now, guit33 said:

is it possible to activate a button flag when fsuicp is starting (not with a button). I want to have a button already activated when I start a flight

You can use a lua script to do this and have that started from your [Auto] or profile-specific [Auto.xxx] section. You can send the Button Flag Set control with a simple ipc.control statement.

John

Link to comment
Share on other sites

The lua is:  ipc.control(n, param)

I will do ipc.control (1, 259) to give 1 (I suppose the flag can be 0 or 1) to my flag button (259:button 3) but where do I use C1003 (button flag set) function ?

 

Or maybe this ?

 ipc.setflag(259,1) or ipc.setflag(259)=1?

the documentation tell: ipc.setflag(flagnum)

Link to comment
Share on other sites

13 hours ago, guit33 said:

The lua is:  ipc.control(n, param)

I will do ipc.control (1, 259) to give 1 (I suppose the flag can be 0 or 1) to my flag button (259:button 3) but where do I use C1003 (button flag set) function ?

From the documentation: 
 

Quote

Sends the FS or FSUIPC control ‘n’, with the optional parameter (assumed 0 if omitted).
FS controls are listed in a List of ...” controls document provided separately. FSUIPC added control numbers are listed in the Advanced User’s guide.

The control you want to sent is Button Flag Set, which has a control number of 1003, so you need
    
ipc.control (1003, param)
where your param = 256 * J + B. So, for joystick #1 button 3 you would use:
    ipc.control (1003, 259)

13 hours ago, guit33 said:

Or maybe this ?

 ipc.setflag(259,1) or ipc.setflag(259)=1?

the documentation tell: ipc.setflag(flagnum)

They are different flags, specific to lua.

Note also that if you want this to run every time you start FSUIPC, you can use either ipcInit.lua or ipcReady.lua and you then don;t need to use the Auto section - from the FSUIPC Lua Plug-ins document:

Quote

There are currently three explicitly reserved Lua names, for programs which are run automatically if present:

 

ipcinit.lua automatically run as soon as FSUIPC has connected to the FS. Note that there will be no access to the FSUIPC WASM functionality (lvars, hvars, calculator code) when this lua is started.
 

ipcready.lua     automatically run when FS is really “ready to fly”. If the FSUIPC WASM module is enabled, this
                         will be ran once the lvars and hvars have been received from the WASM

ipcDebug.lua    automatically loaded before any Lua program which is started in Debug mode.

 

John

 

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.