Board index FlightGear Development New features

hPa/mb input in instrument options

Discussion and requests for new features. Please note that FlightGear developers are volunteers and may or may not be able to consider these requests.

Re: hPa/mb input in instrument options

Postby Hooray » Wed May 29, 2013 6:03 pm

jam007 wrote in Wed May 29, 2013 5:48 pm:Changing the labels based on the user's preference is easy but getting the values to update when moving the sliders gets more complicated (as they are directly referencing the property with a value in US units) and I have no clear idea how to solve that at the moment.


Don't write the properties directly, but use an intermediate property that you alone control through a corresponding Nasal callback - that way you can handle all logic, and even change the conversion routines as necessary. So just introduce your own "unit-less" property to store the slider value, and then use another property for the units - register a listener to change the computation accordingly, and only THEN update the real property.

http://stackoverflow.com/questions/2886 ... ry-problem
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11603
Joined: Tue Mar 25, 2008 8:40 am

Re: hPa/mb input in instrument options

Postby jam007 » Wed May 29, 2013 6:48 pm

I was thinking along these lines but that means a major rewrite of the dialog's nasal code.
It gets to the point that it might be better to look for a general solution like localization rather than ending up with one hack after another to solve the problem in different gui parts.
jam007
 
Posts: 477
Joined: Sun Dec 16, 2012 10:04 am
Location: Uppsala, Sweden
Version: 2017.3.1
OS: Ubuntu 16.04

Re: hPa/mb input in instrument options

Postby ludomotico » Mon Jun 03, 2013 5:54 am

Omega wrote in Tue May 28, 2013 9:51 pm:I made a small change that adds the "QNH setting" label on the left, just in case this ends up in fgdata at its current state.


I agree with Johan, labeling this field as QNH is misleading since it may be QNH (both from an ATC of estimated by the pilot), QFE, QNE (above transition altitude) or just "a value the pilot set to check something". I prefer a generic label such as "altimeter setting" or even better, no label.

Apart from that, it is amazing how a simple code like this can be that useful. Thank you very much.
User avatar
ludomotico
 
Posts: 1054
Joined: Tue Apr 24, 2012 1:01 pm
Version: git
OS: Debian GNU/Linux

Pressure Instrument setting

Postby I-FABI » Mon Dec 29, 2014 6:36 pm

Hello everybody,
I've a little request, for next release.
Adding Pressure Instrument setting in millibar, too.
Thank You and happy new Year 2015.
I-FABI
 
Posts: 38
Joined: Mon Dec 02, 2013 12:23 pm
Location: Cantù (Italy)
Callsign: I-FABI
IRC name: *
Version: 3.2.0
OS: Windows 8.1

Re: Pressure Instrument setting

Postby daveculp » Mon Dec 29, 2014 7:07 pm

I'm not sure which instrument in particular you are using, but I think it would be pretty easy to modify it to display millibars (or hectopascals) and convert internally to inches (which are the units I assume the back end uses).
User avatar
daveculp
 
Posts: 503
Joined: Sun Feb 24, 2013 1:50 am
Location: Las Vegas, USA
Callsign: DCulp
Version: 2017.3.1
OS: Ubuntu 17.10

Re: hPa/mb input in instrument options

Postby legoboyvdlp » Mon Dec 29, 2014 10:40 pm

Just one thing where is Instrument settimgs? I think this should be included in FG after the feature freeye ends: 3.6 maybe?
User avatar
legoboyvdlp
 
Posts: 7403
Joined: Sat Jul 26, 2014 1:28 am
Callsign: YV-LEGO
Version: next
OS: Windows 10 HP

Re: hPa/mb input in instrument options

Postby sanhozay » Mon Dec 29, 2014 10:59 pm

It's on the Equipment menu Lego.
sanhozay
 
Posts: 1207
Joined: Thu Dec 26, 2013 11:57 am
Location: EGNM
Callsign: G-SHOZ
Version: Git
OS: Ubuntu 16.04

Re: hPa/mb input in instrument options

Postby simbambim » Tue Dec 30, 2014 11:57 am

jam007 wrote in Tue May 28, 2013 9:07 am:Changed gui/dialogs/instruments.xml to:
Code: Select all
<?xml version="1.0"?>

<PropertyList>
<nasal>
    <open><![CDATA[
      setprop("/instrumentation/altimeter/setting-hPa", getprop("/instrumentation/altimeter/setting-inhg")*33.86389);
    ]]></open>

    <close><![CDATA[
    ]]></close>
  </nasal>
 
 <name>instruments</name>
 <modal>false</modal>
 <layout>vbox</layout>

  <group>
    <layout>hbox</layout>
    <empty><stretch>1</stretch></empty>

    <text>
      <label>Instrument Settings</label>
    </text>

    <empty><stretch>1</stretch></empty>

    <button>
      <pref-width>16</pref-width>
      <pref-height>16</pref-height>
      <legend></legend>
      <keynum>27</keynum>
      <border>2</border>
      <binding>
        <command>dialog-close</command>
      </binding>
    </button>
  </group>

  <hrule/>

  <group>
    <layout>table</layout>
    <default-padding>5</default-padding>

    <text>
      <row>0</row>
      <col>0</col>
      <halign>right</halign>
      <label>ALT setting:</label>
    </text>

    <group>
      <row>0</row>
      <col>1</col>
      <layout>hbox</layout>
      <default-padding>0</default-padding>

      <button>
      <width>35</width>
      <height>26</height>
      <border>1</border>
      <legend>&lt;</legend>
      <binding>
        <command>property-adjust</command>
        <property>/instrumentation/altimeter/setting-inhg</property>
        <step type="double">-0.01</step>
      </binding>
      <binding>
        <command>nasal</command>
        <script>setprop("/instrumentation/altimeter/setting-hPa", getprop("/instrumentation/altimeter/setting-inhg")*33.86389);</script>
      </binding>
      <binding>
        <command>dialog-update</command>
      </binding>
      </button>

      <button>
       <width>35</width>
       <height>26</height>
       <border>1</border>
       <legend>&lt;&lt;</legend>
       <binding>
        <command>property-adjust</command>
        <property>/instrumentation/altimeter/setting-inhg</property>
        <step type="double">-0.10</step>
       </binding>
       <binding>
        <command>nasal</command>
        <script>setprop("/instrumentation/altimeter/setting-hPa", getprop("/instrumentation/altimeter/setting-inhg")*33.86389);</script>
      </binding>
       <binding>
        <command>dialog-update</command>
       </binding>
      </button>
    </group>

    <input>
      <row>0</row>
      <col>3</col>
      <width>75</width>
      <height>25</height>
     <live>true</live>
      <property>/instrumentation/altimeter/setting-inhg</property>
      <binding>
        <command>dialog-apply</command>
      </binding>
      <binding>
        <command>nasal</command>
        <script>setprop("/instrumentation/altimeter/setting-hPa", getprop("/instrumentation/altimeter/setting-inhg")*33.86389);</script>
      </binding>
    </input>

    <text>
      <row>0</row>
      <col>4</col>
      <padding>0</padding>
      <halign>left</halign>
      <label>inHg</label>
    </text>

    <group>
      <layout>hbox</layout>
      <row>0</row>
      <col>5</col>
      <default-padding>0</default-padding>

      <button>
       <width>35</width>
       <height>26</height>
       <border>1</border>
       <legend>&gt;&gt;</legend>
       <binding>
        <command>property-adjust</command>
        <property>/instrumentation/altimeter/setting-inhg</property>
        <step type="double">0.10</step>
       </binding>
       <binding>
        <command>nasal</command>
        <script>setprop("/instrumentation/altimeter/setting-hPa", getprop("/instrumentation/altimeter/setting-inhg")*33.86389);</script>
      </binding>
       <binding>
        <command>dialog-update</command>
       </binding>
      </button>

      <button>
        <row>0</row>
        <col>6</col>
        <width>35</width>
        <height>26</height>
        <border>1</border>
        <legend>&gt;</legend>
        <binding>
          <command>property-adjust</command>
          <property>/instrumentation/altimeter/setting-inhg</property>
          <step type="double">0.01</step>
        </binding>
        <binding>
          <command>dialog-update</command>
        </binding>
      </button>
    </group>
<group>

      <row>1</row>
      <col>1</col>
      <layout>hbox</layout>
      <default-padding>0</default-padding>

      <button>
      <width>35</width>
      <height>26</height>
      <border>1</border>
      <legend>&lt;</legend>
      <binding>
        <command>property-adjust</command>
        <property>/instrumentation/altimeter/setting-hPa</property>
        <step type="double">-0.1</step>
      </binding>
      <binding>
        <command>nasal</command>
        <script>setprop("/instrumentation/altimeter/setting-inhg", getprop("/instrumentation/altimeter/setting-hPa")*0.02952998);</script>
      </binding>
      <binding>
        <command>dialog-update</command>
      </binding>
      </button>

      <button>
       <width>35</width>
       <height>26</height>
       <border>1</border>
       <legend>&lt;&lt;</legend>
       <binding>
        <command>property-adjust</command>
        <property>/instrumentation/altimeter/setting-hPa</property>
        <step type="double">-1</step>
       </binding>
      <binding>
        <command>nasal</command>
        <script>setprop("/instrumentation/altimeter/setting-inhg", getprop("/instrumentation/altimeter/setting-hPa")*0.02952998);</script>
      </binding>
       <binding>
        <command>dialog-update</command>
       </binding>
      </button>
    </group>

    <input>
      <row>1</row>
      <col>3</col>
      <width>75</width>
      <height>25</height>
     <live>true</live>
      <property>/instrumentation/altimeter/setting-hPa</property>
      <binding>
        <command>dialog-apply</command>
      </binding>
      <binding>
        <command>nasal</command>
        <script>setprop("/instrumentation/altimeter/setting-inhg", getprop("/instrumentation/altimeter/setting-hPa")*0.02952998);</script>
      </binding>
    </input>

    <text>
      <row>1</row>
      <col>4</col>
      <padding>0</padding>
      <halign>left</halign>
      <label>hPa</label>
    </text>

    <group>
      <layout>hbox</layout>
      <row>1</row>
      <col>5</col>
      <default-padding>0</default-padding>

      <button>
       <width>35</width>
       <height>26</height>
       <border>1</border>
       <legend>&gt;&gt;</legend>
       <binding>
        <command>property-adjust</command>
        <property>/instrumentation/altimeter/setting-hPa</property>
        <step type="double">1</step>
       </binding>
      <binding>
        <command>nasal</command>
        <script>setprop("/instrumentation/altimeter/setting-inhg", getprop("/instrumentation/altimeter/setting-hPa")*0.02952998);</script>
      </binding>
       <binding>
        <command>dialog-update</command>
       </binding>
      </button>

      <button>
        <row>1</row>
        <col>6</col>
        <width>35</width>
        <height>26</height>
        <border>1</border>
        <legend>&gt;</legend>
        <binding>
          <command>property-adjust</command>
          <property>/instrumentation/altimeter/setting-hPa</property>
          <step type="double">0.1</step>
        </binding>
      <binding>
        <command>nasal</command>
        <script>setprop("/instrumentation/altimeter/setting-inhg", getprop("/instrumentation/altimeter/setting-hPa")*0.02952998);</script>
      </binding>
        <binding>
          <command>dialog-update</command>
        </binding>
      </button>
    </group>
   
    <text>
      <row>2</row>
      <col>0</col>
      <halign>right</halign>
      <label>HI offset:</label>
    </text>

    <group>
      <layout>hbox</layout>
      <default-padding>0</default-padding>
      <row>2</row>
      <col>1</col>

      <button>
        <width>35</width>
        <height>26</height>
        <border>1</border>
        <legend>&lt;</legend>
        <binding>
          <command>property-adjust</command>
          <property>/instrumentation/heading-indicator/offset-deg</property>
          <step type="double">-1.0</step>
        </binding>
        <binding>
          <command>dialog-update</command>
        </binding>
      </button>

      <button>
       <width>35</width>
       <height>26</height>
       <border>1</border>
       <legend>&lt;&lt;</legend>
       <binding>
        <command>property-adjust</command>
        <property>/instrumentation/heading-indicator/offset-deg</property>
        <step type="double">-10.0</step>
       </binding>
       <binding>
        <command>dialog-update</command>
       </binding>
      </button>
    </group>

    <input>
      <row>2</row>
      <col>3</col>
      <width>75</width>
      <height>25</height>
     <live>true</live>
      <property>/instrumentation/heading-indicator/offset-deg</property>
      <binding>
        <command>dialog-apply</command>
      </binding>
    </input>

    <text>
      <row>2</row>
      <col>4</col>
      <padding>0</padding>
      <halign>left</halign>
      <label>deg</label>
    </text>

    <group>
      <layout>hbox</layout>
      <default-padding>0</default-padding>
      <row>2</row>
      <col>5</col>

      <button>
       <width>35</width>
       <height>26</height>
       <border>1</border>
       <legend>&gt;&gt;</legend>
       <binding>
        <command>property-adjust</command>
        <property>/instrumentation/heading-indicator/offset-deg</property>
        <step type="double">10.0</step>
       </binding>
       <binding>
        <command>dialog-update</command>
       </binding>
      </button>

      <button>
       <width>35</width>
       <height>26</height>
       <border>1</border>
       <legend>&gt;</legend>
       <binding>
        <command>property-adjust</command>
        <property>/instrumentation/heading-indicator/offset-deg</property>
        <step type="double">1.0</step>
       </binding>
       <binding>
        <command>dialog-update</command>
       </binding>
      </button>
     </group>

  </group>

  <hrule/>

  <button>
    <legend>Close</legend>
    <default>true</default>
    <key>Esc</key>
    <binding>
      <command>dialog-close</command>
    </binding>
  </button>

</PropertyList>


This code doesn't work for me. Is it outdated perhaps? The Instrument Settings dialog doesn't open after changing the file. It says Error parsing dialog Path "C:/FlightGear/data/gui/dialogs/instruments.xml" when starting FG and Dialog instruments not defined when trying to open Instrument settings.
FG 3.2, Win 8.1 64-bit.
Fly on VATSIM and die.
simbambim
 
Posts: 260
Joined: Mon Sep 29, 2014 5:41 pm
Version: 3.2

Re: hPa/mb input in instrument options

Postby F-JJTH » Tue Dec 30, 2014 3:36 pm

Hi,

It's now in GIT with some fixes. It will be available for FG 3.4 (I saw this thread some months ago and planned to commit this change before but finally it came out of my head until now...)
Also I improved the InHg and hPa format output in the property tree:
/instrumentation/altimeter/setting-hpa: was a decimal number, now it's an integer (in real life we know the QNH as "1024" or "1025" but never as "1024.74")
/instrumentation/altimeter/setting-inhg: was a non-limited decimal number, now it's limited to 2 decimal number (same reason as above: in real life we used to know the InHg as "29.92" or "29.93" but never as "29.925478")

Thanks for your contribution !

https://gitorious.org/fg/fgdata/commit/ ... 3daa81f1ac
User avatar
F-JJTH
 
Posts: 697
Joined: Fri Sep 09, 2011 11:02 am

Re: hPa/mb input in instrument options

Postby Johan G » Tue Dec 30, 2014 4:21 pm

That is great! :D I have been missing this at times.

Though if it is ok for you to change one little detail, I personally would prefer to not have the label specifically say "QNH setting:", but rather "Altimeter setting:", "Altimeter:", "Alt setting:" or something along those lines. :wink:

Code: Select all
@@ -38,7 +36,7 @@
       <row>0</row>
       <col>0</col>
       <halign>right</halign>
-      <label>ALT setting:</label>
+      <label>QNH setting:</label>
     </text>
 
     <group>

Johan G wrote in Tue May 28, 2013 10:36 pm:Please keep in mind that while one often sets the altimeter to QNH, which is a calculated sea level pressure, one sometimes sets the altimeter to QFE, which is the actual pressure at the airport, either at the aerodrome or near the threshold. I.e. the altimeter would read 0 ft on touchdown. :wink:

ludomotico wrote in Mon Jun 03, 2013 5:54 am:I agree with Johan, labeling this field as QNH is misleading since it may be QNH (both from an ATC of estimated by the pilot), QFE, QNE (above transition altitude) or just "a value the pilot set to check something". I prefer a generic label such as "altimeter setting" or even better, no label.
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)
Johan G
Moderator
 
Posts: 5634
Joined: Fri Aug 06, 2010 5:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 3.0.0
OS: Windows 7, 32 bit

Re: hPa/mb input in instrument options

Postby sanhozay » Tue Dec 30, 2014 4:28 pm

F-JJTH wrote in Tue Dec 30, 2014 3:36 pm:Also I improved the InHg and hPa format output in the property tree:
/instrumentation/altimeter/setting-hpa: was a decimal number, now it's an integer (in real life we know the QNH as "1024" or "1025" but never as "1024.74")

Were you aware that the Altimeter Setting Procedures in Europe define the Standard Pressure as 1013.2hPa?

This is from the UK documents, but I would assume this is standard across the Eurocontrol region:
http://www.ead.eurocontrol.int/eadbasic/pamslight-D3AC19BF932A979B801A850156850821/7FE5QZZF3FXUS/EN/AIP/ENR/EG_ENR_1_7_en_2014-11-13.pdf

Section 3.4:
"Flight levels are measured with reference to the Standard Pressure datum of 1013.2hPa ..."

Section 5.2.2.3:
"When flying under IFR above the Transition Altitude, pilots must have 1013.2hPa selected on an altimeter ..."

The minority of aircraft that allow the altimeter to be set in hPa currently use integers but those that have a STD button should really set the standard of 1013.2. The "setting-hpa" value can always be converted to an integer but the 0.2 cannot be stored in an integer. It doesn't make much of a difference but, for accurate simulation of real aircraft, I believe the "setting-hpa", should remain as a decimal.
sanhozay
 
Posts: 1207
Joined: Thu Dec 26, 2013 11:57 am
Location: EGNM
Callsign: G-SHOZ
Version: Git
OS: Ubuntu 16.04

Re: hPa/mb input in instrument options

Postby F-JJTH » Tue Dec 30, 2014 5:01 pm

JohanG: "alt setting" is already used for the InHg field, to be honest I'm sure we can live with "QNH" since it's the most commonly term

sanhozay: I reverted the C++ change so you can set decimal value if you want.
For the record last time I travelled (IRL) at 5500ft the ATC asked for "1013", not for "1013.2", but maybe other countries are more restrictive I'm only flying in France.
User avatar
F-JJTH
 
Posts: 697
Joined: Fri Sep 09, 2011 11:02 am

Re: hPa/mb input in instrument options

Postby Johan G » Wed Dec 31, 2014 2:40 am

F-JJTH wrote in Tue Dec 30, 2014 5:01 pm:JohanG: "alt setting" is already used for the InHg field, to be honest I'm sure we can live with "QNH" since it's the most commonly term

That is ok. I can live with that. I had to ask though. :wink:

sanhozay wrote in Tue Dec 30, 2014 4:28 pm:
F-JJTH wrote in Tue Dec 30, 2014 3:36 pm:Also I improved the InHg and hPa format output in the property tree:
/instrumentation/altimeter/setting-hpa: was a decimal number, now it's an integer (in real life we know the QNH as "1024" or "1025" but never as "1024.74")

Were you aware that the Altimeter Setting Procedures in Europe define the Standard Pressure as 1013.2hPa?
...
The minority of aircraft that allow the altimeter to be set in hPa currently use integers but those that have a STD button should really set the standard of 1013.2. The "setting-hpa" value can always be converted to an integer but the 0.2 cannot be stored in an integer. It doesn't make much of a difference but, for accurate simulation of real aircraft, I believe the "setting-hpa", should remain as a decimal.

F-JJTH wrote in Tue Dec 30, 2014 5:01 pm:sanhozay: I reverted the C++ change so you can set decimal value if you want.

I think that doing that (allowing decimal values) is a good thing. Thank you. :D

Aircraft with a digital hPa pressure setting can only be set in integer steps (except of course for the STD button), however looking at images of good old mechanical altimeters, in contrast to those who are connected to an air data computer or something similar, the value can of course be set anywhere between the indexes on the scale in the so called Kollsman window. When doing a Google image search for "Kollsman window" one finds that some inHg scales are only indexed in one decimal steps, though most have two decimals, and that the hPa / mb scales sometimes have an extra index at 1013.25 hPa.
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)
Johan G
Moderator
 
Posts: 5634
Joined: Fri Aug 06, 2010 5:33 pm
Location: Sweden
Callsign: SE-JG
IRC name: Johan_G
Version: 3.0.0
OS: Windows 7, 32 bit

Re: hPa/mb input in instrument options

Postby sanhozay » Thu Jan 15, 2015 7:32 pm

This is a great addition but it doesn't quite work properly. Typing values into the hPa and inHg text boxes doesn't update the "other" value and doesn't adjust the altimeter. It only works properly when using the increment/decrement buttons.

I had a look at the code and it's because the "<input>" tags are associated with the formatted property. The dialog-apply updates the formatted value but this doesn't update the underlying value.

If the "<input>" tag allowed the "<format>" tag that would probably be the most elegant solution but I tried it and it didn't seem to work. I guess more listeners could be added to update the underlying values from the formatted values but that looks a messy way to do it.

Any bright ideas?
sanhozay
 
Posts: 1207
Joined: Thu Dec 26, 2013 11:57 am
Location: EGNM
Callsign: G-SHOZ
Version: Git
OS: Ubuntu 16.04

Re: hPa/mb input in instrument options

Postby Hooray » Thu Jan 15, 2015 7:58 pm

as long as the dialog elements have object names, all values can be updated "live" - there are a few examples on doing that in $FG_ROOT/gui/dialogs
Please don't send support requests by PM, instead post your questions on the forum so that all users can contribute and benefit
Thanks & all the best,
Hooray
Help write next month's newsletter !
pui2canvas | MapStructure | Canvas Development | Programming resources
Hooray
 
Posts: 11603
Joined: Tue Mar 25, 2008 8:40 am

PreviousNext

Return to New features

Who is online

Users browsing this forum: No registered users and 3 guests