2020-03-27 22:50:02 +00:00
|
|
|
#
|
2020-03-30 20:42:09 +00:00
|
|
|
# Chrono - Clock - ET
|
2020-03-27 22:50:02 +00:00
|
|
|
#
|
2020-03-30 20:42:09 +00:00
|
|
|
var chr_et = aircraft.timer.new("instrumentation/chrono/elapsetime-sec",1);
|
|
|
|
var et = aircraft.timer.new("instrumentation/clock/elapsetime-sec",1);
|
2020-03-27 22:50:02 +00:00
|
|
|
|
|
|
|
setlistener("sim/signals/fdm-initialized", func {
|
2020-03-31 19:35:15 +00:00
|
|
|
chr_et.stop();
|
|
|
|
chr_et.reset();
|
|
|
|
et.reset();
|
2020-03-30 20:42:09 +00:00
|
|
|
et.stop();
|
|
|
|
props.globals.initNode("instrumentation/clock/indicated-string",0,"STRING");
|
|
|
|
props.globals.initNode("instrumentation/clock/elapsed-string",0,"STRING");
|
|
|
|
props.globals.initNode("instrumentation/chrono/elapsed-string",0,"STRING");
|
|
|
|
props.globals.initNode("instrumentation/clock/et-selector",1,"INT");
|
|
|
|
props.globals.initNode("instrumentation/clock/utc-selector",0,"INT");
|
2020-03-27 22:50:02 +00:00
|
|
|
props.globals.initNode("instrumentation/clock/set-knob",0,"INT");
|
2020-03-31 19:35:15 +00:00
|
|
|
props.globals.initNode("instrumentation/chrono/chrono-reset",1,"INT");
|
2020-03-30 20:42:09 +00:00
|
|
|
props.globals.initNode("instrumentation/clock/et-hr",0,"INT");
|
|
|
|
props.globals.initNode("instrumentation/clock/et-min",0,"INT");
|
|
|
|
props.globals.initNode("instrumentation/chrono/et-min",0,"INT");
|
2020-03-30 21:08:42 +00:00
|
|
|
props.globals.initNode("instrumentation/chrono/et-sec",0,"INT");
|
2020-03-30 20:42:09 +00:00
|
|
|
start_loop.start();
|
2020-03-27 22:50:02 +00:00
|
|
|
});
|
|
|
|
|
2020-03-30 20:42:09 +00:00
|
|
|
setlistener("instrumentation/chrono/chrono-reset", func(chrono){
|
|
|
|
var tmp = chrono.getValue();
|
|
|
|
if(tmp == 2){
|
|
|
|
chr_et.stop();
|
|
|
|
chr_et.reset();
|
|
|
|
#setprop("instrumentation/chrono/chrono-reset", 0);
|
2020-03-27 22:50:02 +00:00
|
|
|
}elsif(tmp==1){
|
2020-03-30 20:42:09 +00:00
|
|
|
chr_et.stop();
|
|
|
|
}elsif(tmp==0){
|
|
|
|
chr_et.start();
|
2020-03-27 22:50:02 +00:00
|
|
|
}
|
|
|
|
},0,0);
|
|
|
|
|
2020-03-30 20:42:09 +00:00
|
|
|
setlistener("instrumentation/clock/et-selector", func(clock_et){
|
|
|
|
var tmp1 = clock_et.getValue();
|
|
|
|
if(tmp1 == 2){
|
|
|
|
et.reset();
|
|
|
|
setprop("instrumentation/clock/et-selector", 1);
|
|
|
|
}elsif(tmp1==1){
|
|
|
|
et.stop();
|
|
|
|
}elsif(tmp1==0){
|
|
|
|
et.start();
|
2020-03-27 22:50:02 +00:00
|
|
|
}
|
2020-03-30 20:42:09 +00:00
|
|
|
},0,0);
|
|
|
|
|
|
|
|
|
|
|
|
var start_loop = maketimer(0.1, func {
|
|
|
|
var UTC_date = sprintf("%02d %02d %02d", getprop("sim/time/utc/month"), getprop("sim/time/utc/day"), substr(sprintf("%2d", getprop("sim/time/utc/year")),1,2));
|
|
|
|
setprop("instrumentation/clock/utc-date", UTC_date);
|
|
|
|
var UTC_date1 = sprintf("%02d %02d", getprop("sim/time/utc/month"), getprop("sim/time/utc/day"));
|
|
|
|
var UTC_date2 = substr(sprintf(" %2d", getprop("sim/time/utc/year")),1,2);
|
|
|
|
var clock2_2 = substr(getprop("instrumentation/clock/indicated-string"),6,2);
|
|
|
|
setprop("instrumentation/clock/indicated-seconds", sprintf(":%02d", clock2_2));
|
|
|
|
setprop("instrumentation/clock/utc-date", UTC_date);
|
|
|
|
setprop("instrumentation/clock/utc-date1", UTC_date1);
|
|
|
|
setprop("instrumentation/clock/utc-date2", UTC_date2);
|
|
|
|
if (getprop("instrumentation/clock/set-knob")=="")
|
|
|
|
{
|
|
|
|
setprop("instrumentation/clock/set-knob", 0);
|
|
|
|
};
|
|
|
|
if (getprop("instrumentation/clock/utc-selector")=="")
|
|
|
|
{
|
|
|
|
setprop("instrumentation/clock/utc-selector", 0);
|
|
|
|
};
|
|
|
|
|
|
|
|
# ET clock
|
|
|
|
var et_tmp = getprop("instrumentation/clock/elapsetime-sec");
|
2020-03-27 22:50:02 +00:00
|
|
|
var et_min = int(et_tmp * 0.0166666666667);
|
|
|
|
var et_hr = int(et_min * 0.0166666666667);
|
|
|
|
et_min = et_min - (et_hr * 60);
|
|
|
|
et_tmp = et_hr * 100 + et_min;
|
|
|
|
et_tmp = int(getprop("instrumentation/clock/elapsetime-sec") * 0.0166666666667);
|
|
|
|
et_hr = int(et_tmp * 0.0166666666667);
|
|
|
|
et_min = et_tmp - (et_hr * 60);
|
2020-03-30 20:42:09 +00:00
|
|
|
setprop("instrumentation/clock/et-hr",et_hr);
|
|
|
|
setprop("instrumentation/clock/et-min",et_min);
|
2020-03-27 22:50:02 +00:00
|
|
|
et_tmp = sprintf("%02d:%02d", et_hr, et_min);
|
|
|
|
setprop("instrumentation/clock/elapsed-string", et_tmp);
|
2020-03-30 20:42:09 +00:00
|
|
|
|
|
|
|
# Chrono
|
|
|
|
var et_tmp = getprop("instrumentation/chrono/elapsetime-sec");
|
|
|
|
var et_min = int(et_tmp * 0.0166666666667);
|
|
|
|
var et_hr = int(et_min * 0.0166666666667);
|
2020-03-31 19:35:15 +00:00
|
|
|
var et_sec = et_tmp - (et_min * 60);
|
|
|
|
if (et_tmp = 6000) {
|
|
|
|
chr_et.reset();
|
|
|
|
};
|
2020-03-30 20:42:09 +00:00
|
|
|
setprop("instrumentation/chrono/et-min",et_min);
|
2020-03-30 21:08:42 +00:00
|
|
|
setprop("instrumentation/chrono/et-sec",et_sec);
|
2020-03-30 20:42:09 +00:00
|
|
|
et_tmp = sprintf("%02d %02d", et_min, et_sec);
|
|
|
|
setprop("instrumentation/chrono/elapsed-string", et_tmp);
|
|
|
|
});
|