Fix Equipment-Instrument Settings inconsistency toward Altimeter Indicator.
Altimeter Indicator seems to respect even rounding. So, if on settings appear 29.9299 it shows 29.93. Equipment-Instrument Settings do not and shows 29.92. If user sets 29.93 then settings keep the rest previous digits and shows 29.9399. So, altimeter indicator shows 29.94 but instrument settings keep the difference of 0.01 and shows 29.93. Same phenomenon happens to hpa value too. In code with '+0.05' we create even rounding and because the coversion of one unit to the other many times leaves decimals of values to end to series of 9, thus Instrument Settings keeps showing 29.929999 as 29.92, we add artificial small value 0.00001 so as to make significant digits exact.
This commit is contained in:
parent
7b13c2da25
commit
f5a5ba60ca
1 changed files with 2 additions and 2 deletions
|
@ -7,8 +7,8 @@
|
|||
<nasal>
|
||||
<open><![CDATA[
|
||||
var update = func(){
|
||||
setprop("/instrumentation/altimeter/setting-hpa-formatted", int(getprop("/instrumentation/altimeter/setting-hpa")));
|
||||
setprop("/instrumentation/altimeter/setting-inhg-formatted", int(getprop("/instrumentation/altimeter/setting-inhg")*100.0)/100.0);
|
||||
setprop("/instrumentation/altimeter/setting-hpa-formatted", sprintf("%6.1f", math.round(getprop("/instrumentation/altimeter/setting-hpa"),.1)));
|
||||
setprop("/instrumentation/altimeter/setting-inhg-formatted", sprintf("%5.2f", math.round(getprop("/instrumentation/altimeter/setting-inhg"),0.01)));
|
||||
}
|
||||
var hpaListener = setlistener("/instrumentation/altimeter/setting-hpa", update);
|
||||
var inhgListener = setlistener("/instrumentation/altimeter/setting-inhg", update);
|
||||
|
|
Loading…
Reference in a new issue