1
0
Fork 0

Chrono on ND (both sides)

This commit is contained in:
vezza 2021-02-14 00:29:20 +01:00 committed by Andrea Vezzali
parent 171a9296e1
commit 8ba0263978
3 changed files with 116 additions and 3 deletions

View file

@ -8742,6 +8742,40 @@
</condition> </condition>
</animation> </animation>
<!-- ND_L chrono -->
<animation>
<type>pick</type>
<object-name>chrono_cpt</object-name>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>property-cycle</command>
<property>/instrumentation/efis/inputs/CHRONO</property>
<value>0</value>
<value>1</value>
<value>2</value>
</binding>
</action>
</animation>
<!-- ND_R chrono -->
<animation>
<type>pick</type>
<object-name>chrono_fo</object-name>
<action>
<button>0</button>
<repeatable>false</repeatable>
<binding>
<command>property-cycle</command>
<property>/instrumentation/efis[1]/inputs/CHRONO</property>
<value>0</value>
<value>1</value>
<value>2</value>
</binding>
</action>
</animation>
<!-- torch --> <!-- torch -->
<animation> <animation>

View file

@ -72,7 +72,7 @@ canvas.NDStyles["Airbus"] = {
level_off_alt: "/autopilot/route-manager/vnav/level-off-alt", level_off_alt: "/autopilot/route-manager/vnav/level-off-alt",
athr: "/it-autoflight/output/athr", athr: "/it-autoflight/output/athr",
app_mode: "/instrumentation/nd/app-mode", app_mode: "/instrumentation/nd/app-mode",
chrono_node: "/instrumentation/chrono", chrono_node: "/instrumentation/ndchrono",
fpln_offset: "/autopilot/route-manager/offset", fpln_offset: "/autopilot/route-manager/offset",
active_route_color: [0.0509,0.7529,0.2941], active_route_color: [0.0509,0.7529,0.2941],
inactive_route_color: [0.95,0.95,0.21] inactive_route_color: [0.95,0.95,0.21]

View file

@ -1,8 +1,10 @@
# #
# Chrono - Clock - ET # Chrono - Clock - ET
# #
var chr = aircraft.timer.new("instrumentation/chrono[0]/elapsetime-sec",1); var chr = aircraft.timer.new("instrumentation/chrono[0]/elapsetime-sec",1);
var clk = aircraft.timer.new("instrumentation/clock/elapsetime-sec",1); var clk = aircraft.timer.new("instrumentation/clock/elapsetime-sec",1);
var chrono_cpt = aircraft.timer.new("instrumentation/ndchrono[0]/elapsetime-sec",1);
var chrono_fo = aircraft.timer.new("instrumentation/ndchrono[1]/elapsetime-sec",1);
var chr_min = nil; var chr_min = nil;
var chr_sec = nil; var chr_sec = nil;
@ -49,6 +51,22 @@ var chrono = {
started: props.globals.getNode("/instrumentation/chrono[0]/started"), started: props.globals.getNode("/instrumentation/chrono[0]/started"),
}; };
#Cpt chrono
var cpt_chrono = {
etHh_cpt: props.globals.initNode("/instrumentation/ndchrono[0]/etHh_cpt", 0, "INT"),
etMin_cpt: props.globals.initNode("/instrumentation/ndchrono[0]/etMin_cpt", 0, "INT"),
etSec_cpt: props.globals.initNode("/instrumentation/ndchrono[0]/etSec_cpt", 0, "INT"),
text: props.globals.initNode("/instrumentation/ndchrono[0]/text", "0' 00''", "STRING"),
};
#Fo chrono
var fo_chrono = {
etHh_fo: props.globals.initNode("/instrumentation/ndchrono[1]/etHh_fo", 0, "INT"),
etMin_fo: props.globals.initNode("/instrumentation/ndchrono[1]/etMin_fo", 0, "INT"),
etSec_fo: props.globals.initNode("/instrumentation/ndchrono[1]/etSec_fo", 0, "INT"),
text: props.globals.initNode("/instrumentation/ndchrono[1]/text", "0' 00''", "STRING"),
};
var rudderTrim = { var rudderTrim = {
rudderTrimDisplay: props.globals.initNode("/controls/flight/rudder-trim-display", 0, "STRING"), rudderTrimDisplay: props.globals.initNode("/controls/flight/rudder-trim-display", 0, "STRING"),
rudderTrimDisplayLetter: props.globals.initNode("/controls/flight/rudder-trim-letter-display", "", "STRING"), rudderTrimDisplayLetter: props.globals.initNode("/controls/flight/rudder-trim-letter-display", "", "STRING"),
@ -59,6 +77,8 @@ setlistener("sim/signals/fdm-initialized", func {
chr.reset(); chr.reset();
clk.stop(); clk.stop();
clk.reset(); clk.reset();
chrono_cpt.reset();
chrono_fo.reset();
rudderTrim.rudderTrimDisplay.setValue(sprintf("%2.1f", pts.Fdm.JSBsim.Hydraulics.Rudder.trimDeg.getValue())); rudderTrim.rudderTrimDisplay.setValue(sprintf("%2.1f", pts.Fdm.JSBsim.Hydraulics.Rudder.trimDeg.getValue()));
start_loop.start(); start_loop.start();
}); });
@ -120,6 +140,31 @@ setlistener("/instrumentation/chrono[0]/chrono-reset", func(et){
}; };
}, 0, 0); }, 0, 0);
#Chrono
setlistener("instrumentation/efis[0]/inputs/CHRONO", func(et){
chrono0 = et.getValue();
if (chrono0 == 1){
chrono_cpt.start();
} elsif (chrono0 == 2) {
chrono_cpt.stop();
} elsif (chrono0 == 0) {
chrono_cpt.reset();
setprop("instrumentation/ndchrono[0]/elapsetime-sec", 0);
}
}, 0, 0);
setlistener("instrumentation/efis[1]/inputs/CHRONO", func(et){
chrono1 = et.getValue();
if (chrono1 == 1){
chrono_fo.start();
} elsif (chrono1 == 2) {
chrono_fo.stop();
} elsif (chrono1 == 0) {
chrono_fo.reset();
setprop("instrumentation/ndchrono[1]/elapsetime-sec", 0);
}
}, 0, 0);
setlistener("instrumentation/clock/et-selector", func(et){ setlistener("instrumentation/clock/et-selector", func(et){
tmp1 = et.getValue(); tmp1 = et.getValue();
if (tmp1 == 2){ if (tmp1 == 2){
@ -225,6 +270,40 @@ var start_loop = maketimer(0.1, func {
item.update(nil); item.update(nil);
} }
} }
#Cpt Chrono
chr0_tmp = getprop("instrumentation/ndchrono[0]/elapsetime-sec");
if (chr0_tmp >= 360000) {
setprop("instrumentation/ndchrono[0]/elapsetime-sec", getprop("instrumentation/ndchrono[0]/elapsetime-sec") - 360000);
};
chr0_hh = int(chr0_tmp * 0.000277777777778);
chr0_min = int((chr0_tmp * 0.0166666666667) - (chr0_hh * 60));
chr0_sec = int(chr0_tmp - (chr0_min * 60) - (chr0_hh * 3600));
setprop("instrumentation/ndchrono[0]/etHh_cpt", chr0_hh);
setprop("instrumentation/ndchrono[0]/etMin_cpt", chr0_min);
setprop("instrumentation/ndchrono[0]/etSec_cpt", chr0_sec);
if (chr0_tmp >= 3600) {
setprop("instrumentation/ndchrono[0]/text", sprintf("%02d H %02d'", chr0_hh, chr0_min));
} else {
setprop("instrumentation/ndchrono[0]/text", sprintf("%02d' %02d''", chr0_min, chr0_sec));
}
#Fo Chrono
chr1_tmp = getprop("instrumentation/ndchrono[1]/elapsetime-sec");
if (chr1_tmp >= 360000) {
setprop("instrumentation/ndchrono[1]/elapsetime-sec", getprop("instrumentation/ndchrono[1]/elapsetime-sec") - 360000);
};
chr1_hh = int(chr1_tmp * 0.000277777777778);
chr1_min = int(chr1_tmp * 0.0166666666667);
chr1_sec = int(chr1_tmp - (chr1_min * 60) - (chr1_hh * 3600));
setprop("instrumentation/ndchrono[1]/etHh_fo", chr1_hh);
setprop("instrumentation/ndchrono[1]/etMin_fo", chr1_min);
setprop("instrumentation/ndchrono[1]/etSec_fo", chr1_sec);
if (chr1_tmp >= 3600) {
setprop("instrumentation/ndchrono[1]/text", sprintf("%02d H %02d'", chr1_hh, chr1_min));
} else {
setprop("instrumentation/ndchrono[1]/text", sprintf("%02d' %02d''", chr1_min, chr1_sec));
}
}); });
var updateRudderTrim = func() { var updateRudderTrim = func() {