Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to bind button to C172p knobs and levers #890

Closed
wkitty42 opened this issue Dec 5, 2016 · 10 comments
Closed

How to bind button to C172p knobs and levers #890

wkitty42 opened this issue Dec 5, 2016 · 10 comments
Labels

Comments

@wkitty42
Copy link
Contributor

wkitty42 commented Dec 5, 2016

dropping this here so that is it not missed...

https://forum.flightgear.org/viewtopic.php?f=24&t=31175

Dear FG veterans

I am struggling to map certain c172p levers and switches to my quadrant buttons. In Joystick configuration dialogue, I see very limited options. For an instance, following mapping (mapping to button) options are missing:

  • Starter Switch control, Master Battery Switch, Alternator Switch, Primer-Pump lever, Carburetor Heat lever

I had success mapping starter to a button. (Purely because nasal command for this was available in keyboard.xml file).

Since I am not developer, please help me with a procedure to enable control of following items on panel through quadrant or equivalent external switch.

  • Master Battery Switch, Alternator Switch, Primer-Pump lever, Carburetor Heat lever, panel switches for lights, radio etc.

System Information
My FG version is 2016.3.1
OS = Ubuntu 16.04.1 LTS
Aircraft = Cessna 172p

Other related information
All these levers and switches are operational through mouse. Except Starter switch, I could not locate any nasal command in keyboard.xml that I could copy and augment in CH-PRODUCTS-CH-THROTTLE-QUADRANT.xml file.

Thanks and Regards
Hiten

@gilbertohasnofb
Copy link
Member

Hmm, I don't have a joystick any longer to test this, but I would suppose that if the OP can use Nasal to map the buttons, then he should be able to map a button to toggle a certain property. So then it's just up to him/her to get a list of the properties being used for those switches/toggles (one can take a look at /Models/c172p.xml to find which properties are mapped to which objects in the cockpit).

@dany93
Copy link
Collaborator

dany93 commented Dec 6, 2016

Gilberto is right.
In /Models/c172p.xml I see:

            <button>0</button>
            <repeatable>false</repeatable>
            <binding>
                <command>property-toggle</command>
                <property>controls/switches/master-alt</property>
            </binding>

            <button>0</button>
            <repeatable>false</repeatable>
            <binding>
                <command>property-toggle</command>
                <property>controls/switches/master-bat</property>
            </binding>

            <button>0</button>
            <repeatable>false</repeatable>
            <binding>
                <command>property-toggle</command>
                <property>/controls/engines/current-engine/carb-heat</property>
            </binding>

Generally, in the JS file, it should look like

 <button n="2">
  <desc>What you want</desc>
  <repeatable type="bool">true</repeatable> <!-- or false -->
  <binding>
   <command>property-adjust</command> <!-- write the appropriate command -->
   <property>/controls/flight/elevator-trim</property> <!-- write the appropriate property -->
   <step type="double">-0.001</step> <!-- or no line, depends on the command -->
  </binding>
 </button>

@wkitty42
Copy link
Contributor Author

wkitty42 commented Dec 7, 2016

ok but i'm not sure how to express this back to the OP on the forums... i don't know how they are doing the mapping... i figured they were using the mapping options in the sim where you can set the buttons to what you want... i don't know... i didn't want them to get discouraged about the craft which is why i posted their message here with the link...

@gilbertohasnofb
Copy link
Member

@wkitty42 I don't understand what you are saying.

i'm not sure how to express this back to the OP on the forums

You can point him to this page, for instance

i don't know how they are doing the mapping

Neither do we, but if he is able to use Nasal to assign buttons then what @dany93 and I wrote should be trivial

i didn't want them to get discouraged about the craft

Why would they get discouraged with our answer? I really can't see what you mean.

@dany93
Copy link
Collaborator

dany93 commented Dec 7, 2016

i don't know how they are doing the mapping... i figured they were using the mapping options in the sim where you can set the buttons to what you want...

He tried using the sim mapping options (Joystick Configuration)

In Joystick configuration dialogue, I see very limited options.

but he is looking for more, particular options.

He seems to know how to map a joystick if he has the binding

I had success mapping starter to a button.

It is not an issue of nasal or not (I guess it is copied). Even if someone knows how to write bindings in a JS config file, the most difficult can be to find the bindings (properties, instruction lines) for a particular aircraft. Even worst if he is not used to find and read aircraft xml files.
After that, having the bindings in the aircraft file may still need some fitting and trials (not merely copy-paste), but the more important is here.
And he can ask more questions if needed.

@wkitty42
Copy link
Contributor Author

wkitty42 commented Dec 7, 2016 via email

@dany93
Copy link
Collaborator

dany93 commented Dec 7, 2016

Yes, we should have responded directly in the US FG forum.
I have given the link.

@gilbertohasnofb gilbertohasnofb added this to the 2017.1 release milestone Dec 7, 2016
@onox onox modified the milestones: 2017.1 release, 2017.2 release Feb 15, 2017
@onox
Copy link
Member

onox commented May 1, 2017

What should we do with this issue?

@onox onox modified the milestones: 2017.2 release, Future release May 1, 2017
@gilbertohasnofb
Copy link
Member

@onox I think this should be closed. It has been quite a long time since the user posed that in the forum and he hasn't responded, so I would consider this as solved from his side. Moreover, this whole discussion is preserved when we close the issue, so anyone browsing our repo or that forum thread can read the solution.

@gilbertohasnofb
Copy link
Member

Also, it doesn't have anything to do with our plane, just how FG works.

@onox onox removed this from the Future release milestone May 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants