Board index FlightGear Support Hardware

Using Keyboard for various Nav,AP, Comms Inputs

Joysticks, pedals, monitors.

Using Keyboard for various Nav,AP, Comms Inputs

Postby Robertfm » Fri Oct 18, 2019 10:13 pm

Came across this. Can this be done for flightgear seems an alternative to making Saitek type things to work. https://youtu.be/P2p6CHxMOl8
Robertfm
 
Posts: 1722
Joined: Thu Apr 25, 2019 5:56 pm
Callsign: RFM1
Version: 2020.3.11
OS: W10 v 19041.746

Re: Using Keyboard for various Nav,AP, Comms Inputs

Postby Johan G » Sun Nov 10, 2019 4:33 am

With some Nasal scripting it sure can be done.

An intermediate might be Multi-key commands (permalink).
Low-level flying — It's all fun and games till someone looses an engine. (Paraphrased from a YouTube video)
Improving the Dassault Mirage F1 (Wiki, Forum, GitLab. Work in slow progress)
Some YouTube videos
Johan G
Moderator
 
Posts: 6634
Joined: Fri Aug 06, 2010 6:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 2020.3.4
OS: Windows 10, 64 bit

Re: Using Keyboard for various Nav,AP, Comms Inputs

Postby V12 » Sun Nov 10, 2019 10:43 am

I made keyboard controller for NAV1 radio :

Code: Select all
<PropertyList>
   <key n="257">
    <name>F1</name>
    <desc>NAV1 +/- 1 MHz</desc>
    <repeatable type="bool">true</repeatable>

     <binding>
      <command>nasal</command>
      <script>
       f=getprop("/instrumentation/nav[1]/frequencies/selected-mhz");
       mod=getprop("/devices/status/keyboard/ctrl");

       if(mod==0) {
    f=f+1;
         if (f>118){
           f=118;
         };     
       }

       if(mod==1) {
    f=f-1;
         if (108>f){
           f=108;
         };     
       };

       setprop("/instrumentation/nav[1]/frequencies/selected-mhz",f);

      </script>
     </binding>

   </key>

   <key n="258">
    <name>F2</name>
    <desc>NAV1 +/- 0.05 MHz</desc>
    <repeatable type="bool">true</repeatable>

     <binding>
      <command>nasal</command>
      <script>
       f=getprop("/instrumentation/nav[1]/frequencies/selected-mhz");
       mod=getprop("/devices/status/keyboard/ctrl");

       if(mod==0) {
    f=f+0.05;
         if (f>118){
           f=118;
         };     
       }

       if(mod==1) {
    f=f-0.05;
         if (108>f){
           f=108;
         };     
       };

       setprop("/instrumentation/nav[1]/frequencies/selected-mhz",f);

      </script>
     </binding>
   </key>
</PropertyList>


With F1/Ctrl+F1 You can change frequency in 1 MHz step, with F2/Ctrl+F2 with 0.05 MHz step. Copy and paste this code to file for example kbdrdctrl.xml, load this .nas file from airplane-set.xml file with syntax :

Code: Select all
 <input>
  <keyboard include="kbdrdctrl.xml">
  </keyboard>
 </input>
Last edited by V12 on Sun Nov 10, 2019 11:31 am, edited 1 time in total.
Fly high, fly fast - fly Concorde !
V12
 
Posts: 2757
Joined: Thu Jan 12, 2017 5:27 pm
Location: LZIB
Callsign: BAWV12

Re: Using Keyboard for various Nav,AP, Comms Inputs

Postby Robertfm » Sun Nov 10, 2019 11:20 am

Adding long scripts is beyond me. I am afraid I will break something. I was think more of assignable 'Custom' keys for Calibration tool or the short codes that go into FG settings. Thanks anyway
Robertfm
 
Posts: 1722
Joined: Thu Apr 25, 2019 5:56 pm
Callsign: RFM1
Version: 2020.3.11
OS: W10 v 19041.746

Re: Using Keyboard for various Nav,AP, Comms Inputs

Postby V12 » Mon Nov 11, 2019 9:32 am

If You save that code into standalone file, there is zero risk of break something.
Fly high, fly fast - fly Concorde !
V12
 
Posts: 2757
Joined: Thu Jan 12, 2017 5:27 pm
Location: LZIB
Callsign: BAWV12

Re: Using Keyboard for various Nav,AP, Comms Inputs

Postby Johan G » Tue Nov 12, 2019 1:09 am

Robertfm wrote in Sun Nov 10, 2019 11:20 am:Adding long scripts is beyond me. I am afraid I will break something. I was think more of assignable 'Custom' keys [...]

V12 wrote in Mon Nov 11, 2019 9:32 am:If You save that code into standalone file, there is zero risk of break something.

Indeed. I think these FlightGear wiki articles might be of help:
Low-level flying — It's all fun and games till someone looses an engine. (Paraphrased from a YouTube video)
Improving the Dassault Mirage F1 (Wiki, Forum, GitLab. Work in slow progress)
Some YouTube videos
Johan G
Moderator
 
Posts: 6634
Joined: Fri Aug 06, 2010 6:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 2020.3.4
OS: Windows 10, 64 bit


Return to Hardware

Who is online

Users browsing this forum: No registered users and 2 guests