Clock code cleanup + added INT/SET mode
This commit is contained in:
parent
cd92d8be02
commit
8efe3b4fb5
4 changed files with 1789 additions and 411 deletions
File diff suppressed because it is too large
Load diff
|
@ -176709,6 +176709,22 @@ refs 4
|
|||
13 0.034037 0.584912
|
||||
kids 0
|
||||
OBJECT poly
|
||||
name "clock_set.axis"
|
||||
data 15
|
||||
clock_set.axis
|
||||
texture "Clock.jpg"
|
||||
texrep 1 1
|
||||
numvert 2
|
||||
-0.5393 0.20018 -0.12967
|
||||
-0.54672 0.19795 -0.12967
|
||||
numsurf 1
|
||||
SURF 0X12
|
||||
mat 18
|
||||
refs 2
|
||||
0 0 0
|
||||
1 0 0
|
||||
kids 0
|
||||
OBJECT poly
|
||||
name "et_knob"
|
||||
data 10
|
||||
clock_knob
|
||||
|
|
|
@ -1,342 +1,697 @@
|
|||
#
|
||||
# Chrono - Clock - ET
|
||||
#
|
||||
var chr = aircraft.timer.new("/instrumentation/chrono[0]/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 chrono_cpt_node = props.globals.getNode("/instrumentation/ndchrono[0]/elapsetime-sec");
|
||||
var chrono_fo_node = props.globals.getNode("/instrumentation/ndchrono[1]/elapsetime-sec");
|
||||
# Chrono - Clock - ET clock
|
||||
|
||||
var cpt_timer = aircraft.timer.new("/instrumentation/ndchrono[0]/elapsetime-sec",1,0);
|
||||
var fo_timer = aircraft.timer.new("/instrumentation/ndchrono[1]/elapsetime-sec",1,0);
|
||||
var clock_timer = aircraft.timer.new("/instrumentation/clock/et/elapsetime-sec",1,0);
|
||||
var clock_int_et = aircraft.timer.new("/instrumentation/clock/internal/elapsetime-sec",1,0);
|
||||
var chrono_timer = aircraft.timer.new("/instrumentation/clock/chrono/elapsetime-sec",1,0);
|
||||
|
||||
var chr_min = nil;
|
||||
var chr_sec = nil;
|
||||
var chr_tmp = nil;
|
||||
var clock2_1 = nil;
|
||||
var clock2_2 = nil;
|
||||
var day = nil;
|
||||
var et_hr = nil;
|
||||
var et_min = nil;
|
||||
var et_tmp = nil;
|
||||
var month = nil;
|
||||
var rudder_val = nil;
|
||||
var tmp = nil;
|
||||
var tmp1 = nil;
|
||||
var UTC_date = nil;
|
||||
var UTC_date1 = nil;
|
||||
var UTC_date2 = nil;
|
||||
var UTC_date3 = nil;
|
||||
var year = nil;
|
||||
var condition = nil;
|
||||
|
||||
var et_selector = props.globals.initNode("/instrumentation/clock/et-selector", 1, "INT");
|
||||
var utc_selector = props.globals.initNode("/instrumentation/clock/utc-selector",0,"INT");
|
||||
var set_knob = props.globals.initNode("/instrumentation/clock/set-knob",0,"INT");
|
||||
var clock_et = {
|
||||
sec: props.globals.initNode("/instrumentation/clock/et/indicated-sec", 0, "STRING"),
|
||||
hrs: props.globals.initNode("/instrumentation/clock/et/indicated-hours", 0, "STRING"),
|
||||
min: props.globals.initNode("/instrumentation/clock/et/indicated-min", 0, "STRING"),
|
||||
elapsedString: props.globals.initNode("/instrumentation/clock/et/elapsed-string", "", "STRING"),
|
||||
et: props.globals.getNode("/instrumentation/clock/et/elapsetime-sec"),
|
||||
et_selector: props.globals.initNode("/instrumentation/clock/et/et-selector", 1, "INT"),
|
||||
visible: props.globals.initNode("/instrumentation/clock/et/visible", 0, "BOOL"),
|
||||
};
|
||||
|
||||
var clock = {
|
||||
elapsedHour: props.globals.initNode("/instrumentation/clock/et-hr", 0, "INT"),
|
||||
elapsedMin: props.globals.initNode("/instrumentation/clock/et-min", 0, "INT"),
|
||||
elapsedString: props.globals.initNode("/instrumentation/clock/elapsed-string", 0, "STRING"),
|
||||
elapsedSec: props.globals.initNode("/instrumentation/clock/elapsetime-sec", 0, "INT"),
|
||||
indicatedSec: props.globals.getNode("/instrumentation/clock/indicated-seconds"),
|
||||
hhMM: props.globals.initNode("/instrumentation/clock/clock_hh_mm", 0, "STRING"),
|
||||
utcDate: [props.globals.initNode("/instrumentation/clock/utc-date", "", "STRING"), props.globals.initNode("/instrumentation/clock/utc-date1", "", "STRING"),
|
||||
props.globals.initNode("/instrumentation/clock/utc-date2", "", "STRING"),props.globals.initNode("/instrumentation/clock/utc-date3", "", "STRING")],
|
||||
hhMM: props.globals.initNode("/instrumentation/clock/indicated-short-string", "", "STRING"),
|
||||
indicated_hh: props.globals.initNode("/instrumentation/clock/indicated-hours", "", "STRING"),
|
||||
indicated_mm: props.globals.initNode("/instrumentation/clock/indicated-minutes", "", "STRING"),
|
||||
indicated_sec: props.globals.initNode("/instrumentation/clock/indicated-seconds", "", "STRING"),
|
||||
utcDate: [props.globals.initNode("/instrumentation/clock/date", "", "STRING"), props.globals.initNode("/instrumentation/clock/date-month", "", "STRING"),
|
||||
props.globals.initNode("/instrumentation/clock/date-day", "", "STRING"), props.globals.initNode("/instrumentation/clock/date-year", "", "STRING")],
|
||||
mode_selector: props.globals.initNode("/instrumentation/clock/utc-selector", 0,"INT"),
|
||||
set_knob: props.globals.initNode("/instrumentation/clock/set-knob", 0,"INT"),
|
||||
set_knb_pos: props.globals.initNode("/instrumentation/clock/set-knb-pos", 0,"INT"),
|
||||
set_knb_count: props.globals.initNode("/instrumentation/clock/set-knb-count", 0,"INT"),
|
||||
};
|
||||
|
||||
var clock_internal = {
|
||||
mode: props.globals.initNode("/instrumentation/clock/internal/mode", 0,"INT"),
|
||||
et: props.globals.initNode("/instrumentation/clock/internal/elapsetime-sec", 0, "DOUBLE"),
|
||||
hrs: props.globals.initNode("/instrumentation/clock/internal/hr", 0, "INT"),
|
||||
min: props.globals.initNode("/instrumentation/clock/internal/min", 0, "INT"),
|
||||
sec: props.globals.initNode("/instrumentation/clock/internal/sec", 0, "INT"),
|
||||
hhMM: props.globals.initNode("/instrumentation/clock/internal/indicated-short-string", "", "STRING"),
|
||||
bisextile_year: props.globals.initNode("/instrumentation/clock/internal/bisextile-year", 0, "BOOL"),
|
||||
date: [props.globals.initNode("/instrumentation/clock/internal/date", "", "STRING"), props.globals.initNode("/instrumentation/clock/internal/date-year", "", "STRING"),
|
||||
props.globals.initNode("/instrumentation/clock/internal/date-month", "", "STRING"), props.globals.initNode("/instrumentation/clock/internal/date-day", "", "STRING")],
|
||||
year: props.globals.initNode("/instrumentation/clock/internal/year", 0, "INT"),
|
||||
month: props.globals.initNode("/instrumentation/clock/internal/month", 0, "INT"),
|
||||
day: props.globals.initNode("/instrumentation/clock/internal/day", 0, "INT"),
|
||||
set_cont: props.globals.initNode("/instrumentation/clock/internal/set-cont", 0,"INT"),
|
||||
elapsedString: props.globals.initNode("/instrumentation/clock/internal/elapsed-string", "", "STRING"),
|
||||
indicated_hh: props.globals.initNode("/instrumentation/clock/internal/indicated-hours", 0, "STRING"),
|
||||
indicated_mm: props.globals.initNode("/instrumentation/clock/internal/indicated-minutes", 0, "STRING"),
|
||||
indicated_sec: props.globals.initNode("/instrumentation/clock/internal/indicated-seconds", 0, "STRING"),
|
||||
blink_hh: props.globals.initNode("/instrumentation/clock/internal/blink-hh", 0, "BOOL"),
|
||||
blink_mm: props.globals.initNode("/instrumentation/clock/internal/blink-mm", 0, "BOOL"),
|
||||
blink_day: props.globals.initNode("/instrumentation/clock/internal/blink-day", 0, "BOOL"),
|
||||
blink_month: props.globals.initNode("/instrumentation/clock/internal/blink-month", 0, "BOOL"),
|
||||
blink_year: props.globals.initNode("/instrumentation/clock/internal/blink-year", 0, "BOOL"),
|
||||
};
|
||||
|
||||
var chrono = {
|
||||
chronoReset: props.globals.initNode("/instrumentation/chrono[0]/chrono-reset", 1, "INT"),
|
||||
elapseTime: props.globals.initNode("/instrumentation/chrono[0]/elapsetime-sec", 0, "INT"),
|
||||
etMin: props.globals.initNode("/instrumentation/chrono[0]/chr-et-min", 0, "INT"),
|
||||
etSec: props.globals.initNode("/instrumentation/chrono[0]/chr-et-sec", 0, "INT"),
|
||||
etString: props.globals.initNode("/instrumentation/chrono[0]/chr-et-string", 0, "STRING"),
|
||||
paused: props.globals.getNode("/instrumentation/chrono[0]/paused"),
|
||||
started: props.globals.getNode("/instrumentation/chrono[0]/started"),
|
||||
reset: props.globals.initNode("/instrumentation/clock/chrono/chrono-reset", 1, "INT"),
|
||||
reset_btn: props.globals.initNode("/instrumentation/clock/chrono/chrono-reset-btn", 0, "INT"),
|
||||
btn: props.globals.initNode("/instrumentation/clock/chrono/chrono-btn", 0, "INT"),
|
||||
et: props.globals.initNode("/instrumentation/clock/chrono/elapsetime-sec", 0, "INT"),
|
||||
etMin: props.globals.initNode("/instrumentation/clock/chrono/chr-et-min", 0, "STRING"),
|
||||
etSec: props.globals.initNode("/instrumentation/clock/chrono/chr-et-sec", 0, "STRING"),
|
||||
etString: props.globals.initNode("/instrumentation/clock/chrono/chr-et-string", "", "STRING"),
|
||||
paused: props.globals.initNode("/instrumentation/clock/chrono/paused", 0, "BOOL"),
|
||||
started: props.globals.initNode("/instrumentation/clock/chrono/started", 0,"BOOL"),
|
||||
};
|
||||
|
||||
#Cpt chrono
|
||||
var cpt_chrono = {
|
||||
var cpttimer = {
|
||||
et: props.globals.initNode("/instrumentation/ndchrono[0]/elapsetime-sec", 0, "INT"),
|
||||
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"),
|
||||
text: props.globals.initNode("/instrumentation/ndchrono[0]/text", "", "STRING"),
|
||||
};
|
||||
|
||||
#Fo chrono
|
||||
var fo_chrono = {
|
||||
var fotimer = {
|
||||
et: props.globals.initNode("/instrumentation/ndchrono[1]/elapsetime-sec", 0, "INT"),
|
||||
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"),
|
||||
text: props.globals.initNode("/instrumentation/ndchrono[1]/text", "", "STRING"),
|
||||
};
|
||||
|
||||
#Rudder Trim Indicator
|
||||
var rudderTrim = {
|
||||
rudderTrimDisplay: props.globals.initNode("/controls/flight/rudder-trim-display", 0, "STRING"),
|
||||
rudderTrimDisplay: props.globals.initNode("/controls/flight/rudder-trim-display", "", "STRING"),
|
||||
rudderTrimDisplayLetter: props.globals.initNode("/controls/flight/rudder-trim-letter-display", "", "STRING"),
|
||||
};
|
||||
|
||||
setlistener("/sim/signals/fdm-initialized", func {
|
||||
chr.stop();
|
||||
chr.reset();
|
||||
clk.stop();
|
||||
clk.reset();
|
||||
chrono_cpt.reset();
|
||||
chrono_fo.reset();
|
||||
chrono_timer.reset();
|
||||
clock_timer.reset();
|
||||
clock_int_et.reset();
|
||||
cpt_timer.reset();
|
||||
fo_timer.reset();
|
||||
rudderTrim.rudderTrimDisplay.setValue(sprintf("%2.1f", pts.Fdm.JSBsim.Hydraulics.Rudder.trimDeg.getValue()));
|
||||
start_loop.start();
|
||||
loop.start();
|
||||
});
|
||||
|
||||
setlistener("/instrumentation/chrono[0]/chrono-reset", func(et){
|
||||
tmp = et.getValue();
|
||||
if (tmp == 2) {
|
||||
if (chrono.started.getBoolValue()) {
|
||||
if (!chrono.paused.getBoolValue()) {
|
||||
chrono.elapseTime.setValue(0);
|
||||
chrono.chronoReset.setBoolValue(0);
|
||||
} else {
|
||||
chr.stop();
|
||||
chr.reset();
|
||||
chrono.chronoReset.setBoolValue(1);
|
||||
chrono.started.setBoolValue(0);
|
||||
chrono.paused.setBoolValue(0);
|
||||
};
|
||||
} else {
|
||||
if (!chrono.paused.getBoolValue()) {
|
||||
# No action required
|
||||
} else {
|
||||
chrono.paused.setBoolValue(0);
|
||||
};
|
||||
};
|
||||
} elsif (tmp == 1) {
|
||||
if (chrono.started.getBoolValue()) {
|
||||
if (!chrono.paused.getBoolValue()) {
|
||||
chr.stop();
|
||||
chrono.paused.setBoolValue(1);
|
||||
} else {
|
||||
chr.stop();
|
||||
};
|
||||
} else {
|
||||
if (!chrono.paused.getBoolValue()) {
|
||||
chr.stop();
|
||||
} else {
|
||||
chr.stop();
|
||||
chrono.paused.setBoolValue(0);
|
||||
};
|
||||
};
|
||||
} elsif (tmp == 0) {
|
||||
if (!chrono.started.getBoolValue()) {
|
||||
if (!chrono.paused.getBoolValue()) {
|
||||
chr.start();
|
||||
chrono.started.setBoolValue(1);
|
||||
} else {
|
||||
chr.start();
|
||||
chrono.paused.setBoolValue(0);
|
||||
};
|
||||
} else {
|
||||
if (!chrono.paused.getBoolValue()) {
|
||||
# No action required
|
||||
} else {
|
||||
chr.start();
|
||||
chrono.paused.setBoolValue(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();
|
||||
chrono_cpt_node.setValue(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();
|
||||
chrono_fo_node.setValue(0);
|
||||
}
|
||||
}, 0, 0);
|
||||
|
||||
setlistener("/instrumentation/clock/et-selector", func(et){
|
||||
tmp1 = et.getValue();
|
||||
if (tmp1 == 2){
|
||||
clk.reset();
|
||||
} elsif (tmp1 == 1){
|
||||
clk.stop();
|
||||
} elsif (tmp1 == 0){
|
||||
clk.start();
|
||||
setlistener("/instrumentation/clock/chrono/chrono-btn", func {
|
||||
if (chrono.btn.getValue() == 1) {
|
||||
chrono.reset.setBoolValue(0);
|
||||
if (chrono.started.getBoolValue()) {
|
||||
#chrono started
|
||||
if (chrono.paused.getBoolValue()) {
|
||||
#chrono paused
|
||||
chrono_timer.start();
|
||||
chrono.paused.setBoolValue(0);
|
||||
} else {
|
||||
#chrono running
|
||||
chrono_timer.stop();
|
||||
chrono.paused.setBoolValue(1);
|
||||
}
|
||||
} else {
|
||||
#chrono not started
|
||||
chrono_timer.start();
|
||||
chrono.paused.setBoolValue(0);
|
||||
chrono.started.setBoolValue(1);
|
||||
}
|
||||
}
|
||||
}, 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);
|
||||
setlistener("/instrumentation/clock/chrono/chrono-reset-btn", func {
|
||||
if (chrono.reset.getValue() == 1) {
|
||||
if (chrono.started.getBoolValue()) {
|
||||
#chrono started
|
||||
if (chrono.paused.getBoolValue()) {
|
||||
#chrono paused
|
||||
chrono_timer.stop();
|
||||
chrono_timer.reset();
|
||||
chrono.started.setBoolValue(0);
|
||||
chrono.paused.setBoolValue(0);
|
||||
} else {
|
||||
#chrono running
|
||||
chrono.et.setValue(0);
|
||||
};
|
||||
} else {
|
||||
#chrono not started
|
||||
chrono_timer.stop();
|
||||
chrono_timer.reset();
|
||||
chrono.started.setBoolValue(0);
|
||||
chrono.paused.setBoolValue(0);
|
||||
chrono.reset.setBoolValue(1);
|
||||
}
|
||||
}, 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);
|
||||
|
||||
var start_loop = maketimer(0.1, func {
|
||||
if (systems.ELEC.Bus.dcEss.getValue() < 25) { return; }
|
||||
|
||||
# Annun-test
|
||||
if (pts.Controls.Switches.annunTest.getBoolValue()) {
|
||||
UTC_date = sprintf("%02d %02d %02d", "88", "88", "88");
|
||||
UTC_date1 = sprintf("%02d", "88");
|
||||
UTC_date2 = sprintf("%02d", "88");
|
||||
UTC_date3 = sprintf("%02d", "88");
|
||||
clock2_1 = "88:88";
|
||||
clock2_2 = sprintf("%02d", 88);
|
||||
|
||||
clock.hhMM.setValue(clock2_1);
|
||||
clock.indicatedSec.setValue(clock2_2);
|
||||
clock.utcDate[0].setValue(UTC_date);
|
||||
clock.utcDate[1].setValue(UTC_date1);
|
||||
clock.utcDate[2].setValue(UTC_date2);
|
||||
clock.utcDate[3].setValue(UTC_date3);
|
||||
|
||||
chrono.etString.setValue("88 88");
|
||||
clock.elapsedString.setValue("88:88");
|
||||
} else {
|
||||
day = pts.Sim.Time.Utc.day.getValue();
|
||||
month = pts.Sim.Time.Utc.month.getValue();
|
||||
year = pts.Sim.Time.Utc.year.getValue();
|
||||
|
||||
# Clock
|
||||
UTC_date = sprintf("%02d %02d %02d", month, day, substr(sprintf("%2d", year),1,2));
|
||||
UTC_date1 = sprintf("%02d", month);
|
||||
UTC_date2 = sprintf("%02d", day);
|
||||
UTC_date3 = substr(sprintf("%2d", year),2,2);
|
||||
clock2_1 = pts.Instrumentation.Clock.indicatedStringShort.getValue();
|
||||
clock2_2 = sprintf("%02d", substr(pts.Instrumentation.Clock.indicatedString.getValue(),6,2));
|
||||
|
||||
clock.hhMM.setValue(clock2_1);
|
||||
clock.indicatedSec.setValue(clock2_2);
|
||||
clock.utcDate[0].setValue(UTC_date);
|
||||
clock.utcDate[1].setValue(UTC_date1);
|
||||
clock.utcDate[2].setValue(UTC_date2);
|
||||
clock.utcDate[3].setValue(UTC_date3);
|
||||
|
||||
if (set_knob.getValue() == "") {
|
||||
set_knob.setValue(0);
|
||||
if (chrono.started.getBoolValue()) {
|
||||
#chrono started
|
||||
if (chrono.paused.getBoolValue()) {
|
||||
#chrono paused
|
||||
chrono_timer.stop();
|
||||
chrono_timer.reset();
|
||||
chrono.started.setBoolValue(0);
|
||||
chrono.paused.setBoolValue(0);
|
||||
} else {
|
||||
#chrono running
|
||||
chrono.et.setValue(0);
|
||||
};
|
||||
} else {
|
||||
#chrono not started
|
||||
chrono_timer.stop();
|
||||
chrono_timer.reset();
|
||||
chrono.started.setBoolValue(0);
|
||||
chrono.paused.setBoolValue(0);
|
||||
chrono.reset.setBoolValue(1);
|
||||
}
|
||||
|
||||
if (utc_selector.getValue() == "") {
|
||||
utc_selector.setValue(0);
|
||||
}
|
||||
|
||||
# if (getprop("/instrumentation/clock/utc-selector") == 0) {
|
||||
# # To do - GPS mode
|
||||
# };
|
||||
# if (getprop("/instrumentation/clock/utc-selector") == 1) {
|
||||
# # To do - INT mode
|
||||
# };
|
||||
# if (getprop("/instrumentation/clock/utc-selector") == 2) {
|
||||
# # To do - SET mode
|
||||
# };
|
||||
}
|
||||
}, 0, 0);
|
||||
|
||||
# Chrono
|
||||
chr_tmp = chrono.elapseTime.getValue();
|
||||
if (chr_tmp >= 6000) {
|
||||
chrono.elapseTime.setValue(chr_tmp - 6000);
|
||||
#ND Chrono - CPT
|
||||
setlistener("/instrumentation/efis[0]/inputs/CHRONO", func {
|
||||
chrono0 = props.globals.getValue("/instrumentation/efis[0]/inputs/CHRONO");
|
||||
if (chrono0 == 1){
|
||||
cpt_timer.start();
|
||||
} elsif (chrono0 == 2) {
|
||||
cpt_timer.stop();
|
||||
} elsif (chrono0 == 0) {
|
||||
cpt_timer.reset();
|
||||
}
|
||||
}, 0, 0);
|
||||
|
||||
#ND Chrono - FO
|
||||
setlistener("/instrumentation/efis[1]/inputs/CHRONO", func {
|
||||
chrono1 = props.globals.getValue("/instrumentation/efis[1]/inputs/CHRONO");
|
||||
if (chrono1 == 1){
|
||||
fo_timer.start();
|
||||
} elsif (chrono1 == 2) {
|
||||
fo_timer.stop();
|
||||
} elsif (chrono1 == 0) {
|
||||
fo_timer.reset();
|
||||
}
|
||||
}, 0, 0);
|
||||
|
||||
#ET Clock
|
||||
setlistener("/instrumentation/clock/et/et-selector", func {
|
||||
tmp1 = clock_et.et_selector.getValue();
|
||||
if (tmp1 == 2){
|
||||
clock_timer.reset();
|
||||
clock_et.visible.setValue(0);
|
||||
attivo=0
|
||||
} elsif (tmp1 == 1){
|
||||
clock_timer.stop();
|
||||
} elsif (tmp1 == 0){
|
||||
clock_timer.start();
|
||||
clock_et.visible.setValue(1);
|
||||
}
|
||||
}, 0, 0);
|
||||
|
||||
#Clock
|
||||
setlistener("/instrumentation/clock/utc-selector", func {
|
||||
if (clock.mode_selector.getValue() != 2) {
|
||||
clock_internal.set_cont.setValue(1);
|
||||
clock.set_knb_count.setValue(0);
|
||||
}
|
||||
if (clock.mode_selector.getValue() == 0){
|
||||
#GPS Clock
|
||||
clock_internal.mode.setValue(0);
|
||||
clock_int_et.reset();
|
||||
clock_int_et.stop();
|
||||
}
|
||||
if (clock.mode_selector.getValue() == 2) {
|
||||
# INT Clock - SET Mode
|
||||
clock_internal.mode.setValue(1);
|
||||
}
|
||||
if (clock.mode_selector.getValue() == 1) {
|
||||
# INT Clock - INT mode");
|
||||
clock_int_et.reset();
|
||||
if (clock_internal.mode.getValue() == 0) {
|
||||
#Start INT Clock from GPS mode
|
||||
clock_internal.year.setValue(props.globals.getValue("sim/time/utc/year"));
|
||||
clock_internal.month.setValue(props.globals.getValue("sim/time/utc/month"));
|
||||
clock_internal.day.setValue(props.globals.getValue("sim/time/utc/day"));
|
||||
clock_internal.hrs.setValue(props.globals.getValue("sim/time/utc/hour"));
|
||||
clock_internal.min.setValue(props.globals.getValue("sim/time/utc/minute"));
|
||||
clock_internal.sec.setValue(props.globals.getValue("sim/time/utc/second"));
|
||||
clock_internal.et.setValue(props.globals.getValue("sim/time/utc/day-seconds"));
|
||||
} else {
|
||||
#Start INT Clock from SET mode
|
||||
clock_internal.et.setValue((clock_internal.hrs.getValue() * 3600) + (clock_internal.min.getValue() * 60));
|
||||
}
|
||||
clock_int_et.start();
|
||||
}
|
||||
}, 0, 0);
|
||||
|
||||
setlistener("/instrumentation/clock/set-knob", func {
|
||||
if (clock.set_knob.getValue() == 1) {
|
||||
if (clock.mode_selector.getValue() == 2) {
|
||||
#Clock SET mode
|
||||
#set custom UTC time
|
||||
if (clock_internal.set_cont.getValue() == 0) {
|
||||
clock_internal.set_cont.setValue(1);
|
||||
}
|
||||
if (clock_internal.set_cont.getValue() < 5) {
|
||||
clock_internal.set_cont.setValue(clock_internal.set_cont.getValue() + 1);
|
||||
} else {
|
||||
clock_internal.set_cont.setValue(clock_internal.set_cont.getValue() - 4);
|
||||
}
|
||||
}
|
||||
if (clock_internal.set_cont.getValue() == 1) {
|
||||
#clock set minutes
|
||||
clock.set_knb_count.setValue(0);
|
||||
} elsif (clock_internal.set_cont.getValue() == 2) {
|
||||
#clock set hours
|
||||
clock.set_knb_count.setValue(0);
|
||||
} elsif (clock_internal.set_cont.getValue() == 3) {
|
||||
#clock set year
|
||||
clock.set_knb_count.setValue(0);
|
||||
} elsif (clock_internal.set_cont.getValue() == 4) {
|
||||
#clock set month
|
||||
clock.set_knb_count.setValue(0);
|
||||
} elsif (clock_internal.set_cont.getValue() == 5) {
|
||||
#clock set day
|
||||
clock.set_knb_count.setValue(0);
|
||||
} else {
|
||||
print('clock custom date/time setting error')
|
||||
}
|
||||
}
|
||||
}, 0, 0);
|
||||
|
||||
var loop = maketimer(0.1, func (){
|
||||
if (systems.ELEC.Bus.dcEss.getValue() < 25) { return; }
|
||||
if (pts.Controls.Switches.annunTest.getBoolValue()) {
|
||||
# Annun-test
|
||||
#date
|
||||
clock.utcDate[0].setValue(sprintf("%02d %02d %02d", "88", "88", "88"));
|
||||
#month
|
||||
clock.utcDate[1].setValue(sprintf("%02d", "88"));
|
||||
#day
|
||||
clock.utcDate[2].setValue(sprintf("%02d", "88"));
|
||||
#year
|
||||
clock.utcDate[3].setValue(sprintf("%02d", "88"));
|
||||
|
||||
#Clock
|
||||
clock.indicated_hh.setValue(sprintf("%02d", "88"));
|
||||
clock.indicated_mm.setValue(sprintf("%02d", "88"));
|
||||
#clock.hhMM.setValue("88:88");
|
||||
clock.indicated_sec.setValue(sprintf("%02d", "88"));
|
||||
|
||||
#Chrono
|
||||
chrono.etString.setValue("88:88");
|
||||
|
||||
#ET Clock
|
||||
clock_et.elapsedString.setValue("88:88");
|
||||
|
||||
} else {
|
||||
#Normal mode (Annun-test off)
|
||||
#Date
|
||||
clock.utcDate[0].setValue(sprintf("%02d %02d %02d", pts.Sim.Time.Utc.month.getValue(), pts.Sim.Time.Utc.day.getValue(), substr(sprintf("%2d", pts.Sim.Time.Utc.year.getValue()),2,2)));
|
||||
clock.utcDate[1].setValue(sprintf("%02d", pts.Sim.Time.Utc.month.getValue()));
|
||||
clock.utcDate[2].setValue(sprintf("%02d", pts.Sim.Time.Utc.day.getValue()));
|
||||
clock.utcDate[3].setValue(substr(sprintf("%02d", pts.Sim.Time.Utc.year.getValue()),2,2));
|
||||
|
||||
#Clock
|
||||
clock.indicated_hh.setValue(sprintf("%02d", substr(pts.Instrumentation.Clock.indicatedString.getValue(),0,2)));
|
||||
clock.indicated_mm.setValue(sprintf("%02d", substr(pts.Instrumentation.Clock.indicatedString.getValue(),3,2)));
|
||||
clock.indicated_sec.setValue(sprintf("%02d", substr(pts.Instrumentation.Clock.indicatedString.getValue(),6,2)));
|
||||
|
||||
# #Clock Internal
|
||||
if (math.fmod(clock_internal.year.getValue(), 4) == 0 or math.fmod(clock_internal.year.getValue(), 400) == 0) {
|
||||
clock_internal.bisextile_year.setValue(1);
|
||||
} else {
|
||||
clock_internal.bisextile_year.setValue(0);
|
||||
}
|
||||
|
||||
clock_internal_tmp = clock_internal.et.getValue();
|
||||
|
||||
if (clock_internal_tmp >= 86400) {
|
||||
clock_internal.et.setValue(clock_internal_tmp - 86400);
|
||||
#Aggiungi un giorno
|
||||
if (clock_internal.month.getValue() == 12) {
|
||||
if (clock_internal.day.getValue() == 31) {
|
||||
#Aggiungi Anno
|
||||
clock_internal.year.setValue(clock_internal.year.getValue() + 1);
|
||||
clock_internal.month.setValue(1);
|
||||
clock_internal.day.setValue(1);
|
||||
} else {
|
||||
clock_internal.day.setValue(clock_internal.day.getValue() + 1);
|
||||
}
|
||||
} else {
|
||||
if ((clock_internal.month.getValue() == 4) or (clock_internal.month.getValue() == 6) or (clock_internal.month.getValue() == 9) or (clock_internal.month.getValue() == 11)) {
|
||||
if (clock_internal.day.getValue() == 30) {
|
||||
clock_internal.month.setValue(clock_internal.month.getValue() + 1);
|
||||
clock_internal.day.setValue(1);
|
||||
} else {
|
||||
clock_internal.day.setValue(clock_internal.day.getValue() + 1);
|
||||
}
|
||||
} else {
|
||||
if (clock_internal.month.getValue() == 2) {
|
||||
if (math.fmod(clock_internal.year.getValue(), 4) == 0 or math.fmod(clock_internal.year.getValue(), 400) == 0) {
|
||||
if (clock_internal.day.getValue() == 29) {
|
||||
clock_internal.day.setValue(1);
|
||||
clock_internal.month.setValue(3);
|
||||
} else {
|
||||
if (clock_internal.day.getValue() == 28) {
|
||||
clock_internal.day.setValue(1);
|
||||
clock_internal.month.setValue(3);
|
||||
}
|
||||
clock_internal.day.setValue(clock_internal.day.getValue() + 1);
|
||||
}
|
||||
} else {
|
||||
clock_internal.day.setValue(clock_internal.day.getValue() + 1);
|
||||
}
|
||||
} else {
|
||||
if (clock_internal.day.getValue() == 31) {
|
||||
clock_internal.month.setValue(clock_internal.month.getValue() + 1);
|
||||
clock_internal.day.setValue(1);
|
||||
} else {
|
||||
clock_internal.day.setValue(clock_internal.day.getValue() + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (clock.mode_selector.getValue() == 1){
|
||||
clock_internal.hrs.setValue(int(clock_internal.et.getValue() * 0.000277777777778));
|
||||
clock_internal.min.setValue((clock_internal.et.getValue() - (clock_internal.hrs.getValue() * 3600)) * 0.0166666666667 );
|
||||
clock_internal.sec.setValue(clock_internal.et.getValue() - ((clock_internal.hrs.getValue() * 3600) + (clock_internal.min.getValue() * 60)));
|
||||
} elsif (clock.mode_selector.getValue() == 2) {
|
||||
#nothing to do
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#Clock internal SET Mode
|
||||
clock_internal.hhMM.setValue(sprintf("%02d", clock_internal.hrs.getValue()) ~ ":" ~ sprintf("%02d", clock_internal.min.getValue()));
|
||||
clock_internal.indicated_hh.setValue(sprintf("%02d", clock_internal.hrs.getValue()));
|
||||
clock_internal.indicated_mm.setValue(sprintf("%02d", clock_internal.min.getValue()));
|
||||
clock_internal.indicated_sec.setValue(sprintf("%02d", clock_internal.sec.getValue()));
|
||||
clock_internal.date[0].setValue(sprintf("%02d", clock_internal.month.getValue()) ~ " " ~ sprintf("%02d",clock_internal.day.getValue()) ~ " " ~ substr(sprintf("%02d",clock_internal.year.getValue()),2,2));
|
||||
clock_internal.date[1].setValue(substr(sprintf("%02d",clock_internal.year.getValue()),2,2));
|
||||
clock_internal.date[2].setValue(sprintf("%02d",clock_internal.month.getValue()));
|
||||
clock_internal.date[3].setValue(sprintf("%02d",clock_internal.day.getValue()));
|
||||
|
||||
condition = (getprop("/sim/time/elapsed-sec") - math.floor(getprop("/sim/time/elapsed-sec"))) < 0.5;
|
||||
|
||||
if (clock.set_knob.getValue() == 0) {
|
||||
if (clock.mode_selector.getValue() == 0) {
|
||||
#show Time
|
||||
clock_internal.blink_hh.setValue(1);
|
||||
clock_internal.blink_mm.setValue(1);
|
||||
clock_internal.blink_day.setValue(1);
|
||||
clock_internal.blink_month.setValue(1);
|
||||
clock_internal.blink_year.setValue(1);
|
||||
} elsif (clock.mode_selector.getValue() == 1) {
|
||||
#show Time
|
||||
clock_internal.blink_hh.setValue(1);
|
||||
clock_internal.blink_mm.setValue(1);
|
||||
clock_internal.blink_day.setValue(1);
|
||||
clock_internal.blink_month.setValue(1);
|
||||
clock_internal.blink_year.setValue(1);
|
||||
} else {
|
||||
if (clock_internal.set_cont.getValue() == 1) {
|
||||
#clock internal SET minutes
|
||||
if (condition) {
|
||||
clock_internal.hhMM.setValue(sprintf("%02d", clock_internal.hrs.getValue()) ~ ":" ~ sprintf("%02d", clock_internal.min.getValue()));
|
||||
clock_internal.blink_hh.setValue(1);
|
||||
clock_internal.blink_mm.setValue(1);
|
||||
clock_internal.blink_day.setValue(1);
|
||||
clock_internal.blink_month.setValue(1);
|
||||
clock_internal.blink_year.setValue(1);
|
||||
} else {
|
||||
clock_internal.hhMM.setValue(sprintf("%02d", clock_internal.hrs.getValue()) ~ ":" ~ " ");
|
||||
clock_internal.blink_hh.setValue(1);
|
||||
clock_internal.blink_mm.setValue(0);
|
||||
clock_internal.blink_day.setValue(1);
|
||||
clock_internal.blink_month.setValue(1);
|
||||
clock_internal.blink_year.setValue(1);
|
||||
}
|
||||
} elsif (clock_internal.set_cont.getValue() == 2) {
|
||||
#clock internal SET hours
|
||||
if (condition) {
|
||||
clock_internal.hhMM.setValue(sprintf("%02d", clock_internal.hrs.getValue()) ~ ":" ~ sprintf("%02d", clock_internal.min.getValue()));
|
||||
clock_internal.blink_hh.setValue(1);
|
||||
clock_internal.blink_mm.setValue(1);
|
||||
clock_internal.blink_day.setValue(1);
|
||||
clock_internal.blink_month.setValue(1);
|
||||
clock_internal.blink_year.setValue(1);
|
||||
} else {
|
||||
clock_internal.hhMM.setValue(" " ~ ":" ~ sprintf("%02d", clock_internal.min.getValue()));
|
||||
clock_internal.blink_hh.setValue(0);
|
||||
clock_internal.blink_mm.setValue(1);
|
||||
clock_internal.blink_day.setValue(1);
|
||||
clock_internal.blink_month.setValue(1);
|
||||
clock_internal.blink_year.setValue(1);
|
||||
}
|
||||
} elsif (clock_internal.set_cont.getValue() == 3) {
|
||||
#clock internal SET year
|
||||
if (condition) {
|
||||
clock_internal.blink_hh.setValue(1);
|
||||
clock_internal.blink_mm.setValue(1);
|
||||
clock_internal.blink_day.setValue(1);
|
||||
clock_internal.blink_month.setValue(1);
|
||||
clock_internal.blink_year.setValue(1);
|
||||
} else {
|
||||
clock_internal.blink_hh.setValue(1);
|
||||
clock_internal.blink_mm.setValue(1);
|
||||
clock_internal.blink_day.setValue(1);
|
||||
clock_internal.blink_month.setValue(1);
|
||||
clock_internal.blink_year.setValue(0);
|
||||
}
|
||||
} elsif (clock_internal.set_cont.getValue() == 4) {
|
||||
#clock internal SET month
|
||||
if (condition) {
|
||||
clock_internal.blink_hh.setValue(1);
|
||||
clock_internal.blink_mm.setValue(1);
|
||||
clock_internal.blink_day.setValue(1);
|
||||
clock_internal.blink_month.setValue(1);
|
||||
clock_internal.blink_year.setValue(1);
|
||||
} else {
|
||||
clock_internal.blink_hh.setValue(1);
|
||||
clock_internal.blink_mm.setValue(1);
|
||||
clock_internal.blink_day.setValue(1);
|
||||
clock_internal.blink_month.setValue(0);
|
||||
clock_internal.blink_year.setValue(1);
|
||||
}
|
||||
} elsif (clock_internal.set_cont.getValue() == 5) {
|
||||
#clock internal SET day
|
||||
if (condition) {
|
||||
clock_internal.blink_hh.setValue(1);
|
||||
clock_internal.blink_mm.setValue(1);
|
||||
clock_internal.blink_day.setValue(1);
|
||||
clock_internal.blink_month.setValue(1);
|
||||
clock_internal.blink_year.setValue(1);
|
||||
} else {
|
||||
clock_internal.blink_hh.setValue(1);
|
||||
clock_internal.blink_mm.setValue(1);
|
||||
clock_internal.blink_day.setValue(0);
|
||||
clock_internal.blink_month.setValue(1);
|
||||
clock_internal.blink_year.setValue(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (clock.mode_selector.getValue() == 0) {
|
||||
#show Date
|
||||
clock_internal.blink_hh.setValue(1);
|
||||
clock_internal.blink_mm.setValue(1);
|
||||
clock_internal.blink_day.setValue(1);
|
||||
clock_internal.blink_month.setValue(1);
|
||||
clock_internal.blink_year.setValue(1);
|
||||
} elsif (clock.mode_selector.getValue() == 1) {
|
||||
#show Date
|
||||
clock_internal.blink_hh.setValue(1);
|
||||
clock_internal.blink_mm.setValue(1);
|
||||
clock_internal.blink_day.setValue(1);
|
||||
clock_internal.blink_month.setValue(1);
|
||||
clock_internal.blink_year.setValue(1);
|
||||
} else {
|
||||
if (clock_internal.set_cont.getValue() == 1) {
|
||||
#clock internal SET minutes
|
||||
if (condition) {
|
||||
clock_internal.blink_hh.setValue(1);
|
||||
clock_internal.blink_mm.setValue(1);
|
||||
clock_internal.blink_day.setValue(1);
|
||||
clock_internal.blink_month.setValue(1);
|
||||
clock_internal.blink_year.setValue(1);
|
||||
} else {
|
||||
clock_internal.blink_hh.setValue(1);
|
||||
clock_internal.blink_mm.setValue(0);
|
||||
clock_internal.blink_day.setValue(1);
|
||||
clock_internal.blink_month.setValue(1);
|
||||
clock_internal.blink_year.setValue(1);
|
||||
}
|
||||
} elsif (clock_internal.set_cont.getValue() == 2) {
|
||||
#clock internal SET hours
|
||||
if (condition) {
|
||||
clock_internal.blink_hh.setValue(1);
|
||||
clock_internal.blink_mm.setValue(1);
|
||||
clock_internal.blink_day.setValue(1);
|
||||
clock_internal.blink_month.setValue(1);
|
||||
clock_internal.blink_year.setValue(1);
|
||||
} else {
|
||||
clock_internal.blink_hh.setValue(0);
|
||||
clock_internal.blink_mm.setValue(1);
|
||||
clock_internal.blink_day.setValue(1);
|
||||
clock_internal.blink_month.setValue(1);
|
||||
clock_internal.blink_year.setValue(1);
|
||||
}
|
||||
} elsif (clock_internal.set_cont.getValue() == 3) {
|
||||
#clock internal SET year
|
||||
if (condition) {
|
||||
clock_internal.blink_hh.setValue(1);
|
||||
clock_internal.blink_mm.setValue(1);
|
||||
clock_internal.blink_day.setValue(1);
|
||||
clock_internal.blink_month.setValue(1);
|
||||
clock_internal.blink_year.setValue(1);
|
||||
} else {
|
||||
clock_internal.blink_hh.setValue(1);
|
||||
clock_internal.blink_mm.setValue(1);
|
||||
clock_internal.blink_day.setValue(1);
|
||||
clock_internal.blink_month.setValue(1);
|
||||
clock_internal.blink_year.setValue(0);
|
||||
}
|
||||
} elsif (clock_internal.set_cont.getValue() == 4) {
|
||||
#clock internal SET month
|
||||
if (condition) {
|
||||
clock_internal.blink_hh.setValue(1);
|
||||
clock_internal.blink_mm.setValue(1);
|
||||
clock_internal.blink_day.setValue(1);
|
||||
clock_internal.blink_month.setValue(1);
|
||||
clock_internal.blink_year.setValue(1);
|
||||
} else {
|
||||
clock_internal.blink_hh.setValue(1);
|
||||
clock_internal.blink_mm.setValue(1);
|
||||
clock_internal.blink_day.setValue(1);
|
||||
clock_internal.blink_month.setValue(0);
|
||||
clock_internal.blink_year.setValue(1);
|
||||
}
|
||||
} elsif (clock_internal.set_cont.getValue() == 5) {
|
||||
#clock internal SET day
|
||||
if (condition) {
|
||||
clock_internal.blink_hh.setValue(1);
|
||||
clock_internal.blink_mm.setValue(1);
|
||||
clock_internal.blink_day.setValue(1);
|
||||
clock_internal.blink_month.setValue(1);
|
||||
clock_internal.blink_year.setValue(1);
|
||||
} else {
|
||||
clock_internal.blink_hh.setValue(1);
|
||||
clock_internal.blink_mm.setValue(1);
|
||||
clock_internal.blink_day.setValue(0);
|
||||
clock_internal.blink_month.setValue(1);
|
||||
clock_internal.blink_year.setValue(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (clock.set_knob.getValue() == "") {
|
||||
clock.set_knob.setValue(0);
|
||||
}
|
||||
|
||||
#Chrono
|
||||
chr_tmp = chrono.et.getValue();
|
||||
if (chr_tmp >= 6000) {
|
||||
chrono.et.setValue(chr_tmp - 6000);
|
||||
}
|
||||
|
||||
chr_min = int(chr_tmp * 0.0166666666667);
|
||||
if (chr_tmp >= 60) {
|
||||
chr_sec = int(chr_tmp - (chr_min * 60));
|
||||
} else {
|
||||
chr_sec = int(chr_tmp);
|
||||
}
|
||||
|
||||
chrono.etMin.setValue(chr_min);
|
||||
chrono.etSec.setValue(chr_sec);
|
||||
chrono.etString.setValue(sprintf("%02d:%02d", chr_min, chr_sec));
|
||||
|
||||
# ET clock
|
||||
et_tmp = clock.elapsedSec.getValue();
|
||||
if (et_tmp >= 360000) {
|
||||
clock.elapsedSec.setValue(et_tmp - 360000);
|
||||
chrono.etMin.setValue(sprintf("%02d", chr_min));
|
||||
chrono.etSec.setValue(sprintf("%02d", chr_sec));
|
||||
if (chrono.paused.getBoolValue()) {
|
||||
chrono.etString.setValue(sprintf("%02d %02d", chr_min, chr_sec));
|
||||
} else {
|
||||
chrono.etString.setValue(sprintf("%02d:%02d", chr_min, chr_sec));
|
||||
}
|
||||
|
||||
|
||||
#ET clock
|
||||
et_tmp = clock_et.et.getValue();
|
||||
if (et_tmp >= 360000) {
|
||||
clock_et.et.setValue(et_tmp - 360000);
|
||||
}
|
||||
|
||||
et_min = int(et_tmp * 0.0166666666667);
|
||||
et_hr = int(et_min * 0.0166666666667);
|
||||
et_min = et_min - (et_hr * 60);
|
||||
|
||||
clock.elapsedHour.setValue(et_hr);
|
||||
clock.elapsedMin.setValue(et_min);
|
||||
clock.elapsedString.setValue(sprintf("%02d:%02d", et_hr, et_min));
|
||||
|
||||
|
||||
clock_et.hrs.setValue(sprintf("%02d", et_hr));
|
||||
clock_et.min.setValue(sprintf("%02d",et_min));
|
||||
if (clock_et.et_selector.getValue()==1) {
|
||||
if (clock_et.et.getValue()==0) {
|
||||
clock_et.elapsedString.setValue("");
|
||||
} else {
|
||||
clock_et.elapsedString.setValue(sprintf("%02d %02d", et_hr, et_min));
|
||||
}
|
||||
} else {
|
||||
clock_et.elapsedString.setValue(sprintf("%02d:%02d", et_hr, et_min));
|
||||
}
|
||||
|
||||
#Rudder Trim update loop
|
||||
foreach (item; update_items) {
|
||||
item.update(nil);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#Cpt Chrono
|
||||
chr0_tmp = chrono_cpt_node.getValue();
|
||||
chr0_tmp = cpttimer.et.getValue();
|
||||
if (chr0_tmp >= 360000) {
|
||||
chrono_cpt_node.setValue(chrono_cpt_node.getValue() - 360000);
|
||||
cpttimer.et.setValue(chr0_tmp - 360000);
|
||||
}
|
||||
|
||||
chr0_hh = int(chr0_tmp * 0.000277777777778);
|
||||
|
||||
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));
|
||||
cpt_chrono.etHh_cpt.setValue(chr0_hh);
|
||||
cpt_chrono.etMin_cpt.setValue(chr0_min);
|
||||
cpt_chrono.etSec_cpt.setValue(chr0_sec);
|
||||
cpttimer.etHh_cpt.setValue(chr0_hh);
|
||||
cpttimer.etMin_cpt.setValue(chr0_min);
|
||||
cpttimer.etSec_cpt.setValue(chr0_sec);
|
||||
if (chr0_tmp >= 3600) {
|
||||
cpt_chrono.text.setValue(sprintf("%02d H %02d'", chr0_hh, chr0_min));
|
||||
cpttimer.text.setValue(sprintf("%2d H %2d'", chr0_hh, chr0_min));
|
||||
} else {
|
||||
cpt_chrono.text.setValue(sprintf("%02d' %02d''", chr0_min, chr0_sec));
|
||||
cpttimer.text.setValue(sprintf("%2d' %2d''", chr0_min, chr0_sec));
|
||||
}
|
||||
|
||||
|
||||
#Fo Chrono
|
||||
chr1_tmp = chrono_fo_node.getValue();
|
||||
chr1_tmp = fotimer.et.getValue();
|
||||
if (chr1_tmp >= 360000) {
|
||||
chrono_fo_node.setValue(chrono_fo_node.getValue() - 360000);
|
||||
fotimer.et.setValue(chr1_tmp - 360000);
|
||||
}
|
||||
|
||||
chr1_hh = int(chr1_tmp * 0.000277777777778);
|
||||
|
||||
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));
|
||||
fo_chrono.etHh_fo.setValue(chr1_hh);
|
||||
fo_chrono.etMin_fo.setValue(chr1_min);
|
||||
fo_chrono.etSec_fo.setValue(chr1_sec);
|
||||
fotimer.etHh_fo.setValue(chr1_hh);
|
||||
fotimer.etMin_fo.setValue(chr1_min);
|
||||
fotimer.etSec_fo.setValue(chr1_sec);
|
||||
if (chr1_tmp >= 3600) {
|
||||
fo_chrono.text.setValue(sprintf("%02d H %02d'", chr1_hh, chr1_min));
|
||||
fotimer.text.setValue(sprintf("%2d H %2d'", chr1_hh, chr1_min));
|
||||
} else {
|
||||
fo_chrono.text.setValue(sprintf("%02d' %02d''", chr1_min, chr1_sec));
|
||||
fotimer.text.setValue(sprintf("%2d' %2d''", chr1_min, chr1_sec));
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
var updateRudderTrim = func() {
|
||||
if (pts.Controls.Switches.annunTest.getBoolValue()) {
|
||||
rudderTrim.rudderTrimDisplay.setValue(sprintf("%3.1f", "88.8"));
|
||||
rudderTrim.rudderTrimDisplay.setValue(sprintf("%2.1f", "88.8"));
|
||||
rudderTrim.rudderTrimDisplayLetter.setValue(sprintf("%1.0f", "8"));
|
||||
} else {
|
||||
rudder_val = pts.Fdm.JSBsim.Hydraulics.Rudder.trimDeg.getValue();
|
||||
|
|
|
@ -251,8 +251,8 @@
|
|||
<c1>20</c1>
|
||||
</lag_filter>
|
||||
|
||||
<lag_filter name="/instrumentation/clock/et-selector-pos">
|
||||
<input>/instrumentation/clock/et-selector</input>
|
||||
<lag_filter name="/instrumentation/clock/et/et-selector-pos">
|
||||
<input>/instrumentation/clock/et/et-selector</input>
|
||||
<c1>20</c1>
|
||||
</lag_filter>
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue