1
0
Fork 0

Merge branch 'dev' into 3D

This commit is contained in:
legoboyvdlp R 2021-01-14 18:01:55 +00:00
commit bd98a8dbbd
7 changed files with 455 additions and 93 deletions

View file

@ -4705,7 +4705,8 @@
<file>Aircraft/A320-family/Nasal/MCDU/WINDCRZ.nas</file>
<file>Aircraft/A320-family/Nasal/MCDU/WINDDES.nas</file>
<file>Aircraft/A320-family/Nasal/MCDU/WINDHIST.nas</file>
<file>Aircraft/A320-family/Nasal/MCDU/ATIS.nas</file> <!-- Last Dynamic Page -->
<file>Aircraft/A320-family/Nasal/MCDU/ATIS.nas</file>
<file>Aircraft/A320-family/Nasal/MCDU/FLIGHTLOG.nas</file> <!-- Last Dynamic Page -->
<file>Aircraft/A320-family/Nasal/MCDU/MCDU.nas</file>
<file>Aircraft/A320-family/Nasal/MCDU/INITA.nas</file>
<file>Aircraft/A320-family/Nasal/MCDU/IRSINIT.nas</file>

View file

@ -1,4 +1,4 @@
<?xml version="1.0"?>
<?xml version="1.0"?>
<!-- Copyright (c) 2020 Josh Davidson (Octal450) -->
@ -138,40 +138,31 @@
<!-- Knobs -->
<animation>
<type>pick</type>
<type>knob</type>
<object-name>ddrmi_vor_adf_select_1</object-name>
<property>instrumentation/ddrmi/vor-adf-1</property>
<axis>
<object-name>ddrmi_vor_adf_select_1.axis</object-name>
</axis>
<action>
<button>0</button>
<repeatable type="bool">false</repeatable>
<binding>
<command>property-cycle</command>
<command>property-adjust</command>
<property>instrumentation/ddrmi/vor-adf-1</property>
<value>0</value> <!-- OFF -->
<value>1</value> <!-- VOR -->
<value>-1</value> <!-- ADF -->
</binding>
</action>
<action>
<button>1</button>
<repeatable type="bool">false</repeatable>
<binding>
<command>property-cycle</command>
<property>instrumentation/ddrmi/vor-adf-1</property>
<value>-1</value> <!-- ADF -->
<value>1</value> <!-- VOR -->
<value>0</value> <!-- OFF -->
<min>-1</min>
<max>1</max>
</binding>
</action>
</animation>
<animation>
<name>Knob 1 rotate</name>
<object-name>ddrmi_vor_adf_select_1</object-name>
<name>DDRMI vor-adf knob 1</name>
<type>rotate</type>
<object-name>ddrmi_vor_adf_select_1</object-name>
<property>instrumentation/ddrmi/vor-adf-1</property>
<interpolation>
<entry><ind>-1</ind><dep>90</dep></entry>
<entry><ind> 0</ind><dep>45</dep></entry>
<entry><ind> 1</ind><dep> 0</dep></entry>
<entry><ind>-1</ind><dep>90</dep></entry> <!-- ADF -->
<entry><ind> 0</ind><dep>45</dep></entry> <!-- OFF -->
<entry><ind> 1</ind><dep> 0</dep></entry> <!-- VOR -->
</interpolation>
<axis>
<object-name>ddrmi_vor_adf_select_1.axis</object-name>
@ -179,40 +170,31 @@
</animation>
<animation>
<type>pick</type>
<type>knob</type>
<object-name>ddrmi_vor_adf_select_2</object-name>
<property>instrumentation/ddrmi/vor-adf-2</property>
<axis>
<object-name>ddrmi_vor_adf_select_2.axis</object-name>
</axis>
<action>
<button>0</button>
<repeatable type="bool">false</repeatable>
<binding>
<command>property-cycle</command>
<command>property-adjust</command>
<property>instrumentation/ddrmi/vor-adf-2</property>
<value>0</value> <!-- OFF -->
<value>1</value> <!-- VOR -->
<value>-1</value> <!-- ADF -->
</binding>
</action>
<action>
<button>1</button>
<repeatable type="bool">false</repeatable>
<binding>
<command>property-cycle</command>
<property>instrumentation/ddrmi/vor-adf-2</property>
<value>-1</value> <!-- ADF -->
<value>1</value> <!-- VOR -->
<value>0</value> <!-- OFF -->
<min>-1</min>
<max>1</max>
</binding>
</action>
</animation>
<animation>
<name>Knob 2 rotate</name>
<object-name>ddrmi_vor_adf_select_2</object-name>
<name>DDRMI vor-adf knob 2</name>
<type>rotate</type>
<object-name>ddrmi_vor_adf_select_2</object-name>
<property>instrumentation/ddrmi/vor-adf-2</property>
<interpolation>
<entry><ind>-1</ind><dep>-90</dep></entry>
<entry><ind> 0</ind><dep>-45</dep></entry>
<entry><ind> 1</ind><dep> 0</dep></entry>
<entry><ind>-1</ind><dep>-90</dep></entry> <!-- ADF -->
<entry><ind> 0</ind><dep>-45</dep></entry> <!-- OFF -->
<entry><ind> 1</ind><dep> 0</dep></entry> <!-- VOR -->
</interpolation>
<axis>
<object-name>ddrmi_vor_adf_select_2.axis</object-name>
@ -227,7 +209,7 @@
<type>rotate</type>
<property>instrumentation/ddrmi/flag-1</property>
<interpolation>
<entry><ind>0</ind><dep>45</dep></entry>
<entry><ind>0</ind><dep>-45</dep></entry>
<entry><ind>1</ind><dep> 0</dep></entry>
</interpolation>
<axis>
@ -241,7 +223,7 @@
<type>rotate</type>
<property>instrumentation/ddrmi/flag-2</property>
<interpolation>
<entry><ind>0</ind><dep>-45</dep></entry>
<entry><ind>0</ind><dep>45</dep></entry>
<entry><ind>1</ind><dep> 0</dep></entry>
</interpolation>
<axis>
@ -8347,30 +8329,21 @@
</action>
</animation>
<animation>
<name>UTC selector rotate</name>
<type>pick</type>
<name>UTC selector animation</name>
<type>knob</type>
<object-name>clock_knob</object-name>
<property>instrumentation/clock/utc-selector</property>
<axis>
<object-name>clock_knob.axis</object-name>
</axis>
<action>
<button>0</button>
<repeatable type="bool">false</repeatable>
<binding>
<command>property-cycle</command>
<command>property-adjust</command>
<property>instrumentation/clock/utc-selector</property>
<value>0</value><!-- GPS -->
<value>1</value><!-- INT -->
<value>2</value><!-- SET -->
</binding>
</action>
<action>
<button>1</button>
<repeatable type="bool">false</repeatable>
<binding>
<command>property-cycle</command>
<property>instrumentation/clock/utc-selector</property>
<value>2</value><!-- SET -->
<value>1</value><!-- INT -->
<value>0</value><!-- GPS -->
<min>0</min>
<max>2</max>
</binding>
</action>
</animation>
@ -8381,9 +8354,9 @@
<object-name>clock_knob</object-name>
<property>instrumentation/clock/utc-selector</property>
<interpolation>
<entry><ind>0</ind><dep>0</dep></entry>
<entry><ind>1</ind><dep>45</dep></entry>
<entry><ind>2</ind><dep>90</dep></entry>
<entry><ind>2</ind><dep>90</dep></entry> <!-- SET -->
<entry><ind>1</ind><dep>45</dep></entry> <!-- INT -->
<entry><ind>0</ind><dep> 0</dep></entry> <!-- GPS -->
</interpolation>
<axis>
<object-name>clock_knob.axis</object-name>

View file

@ -152,10 +152,20 @@ var baro = props.globals.getNode("/FMGC/internal/baro", 1);
# GA PERF
# AOC - SENSORS
var parking_brake = props.globals.getNode("/controls/gear/brake-parking", 1);
var gear0_wow = props.globals.getNode("/gear/gear[0]/wow", 1);
var doorL1_pos = props.globals.getNode("/sim/model/door-positions/doorl1/position-norm", 1); #FWD door
var doorR1_pos = props.globals.getNode("/sim/model/door-positions/doorr1/position-norm", 1); #FWD door
var doorL4_pos = props.globals.getNode("/sim/model/door-positions/doorl4/position-norm", 1); #AFT door
var doorR4_pos = props.globals.getNode("/sim/model/door-positions/doorr4/position-norm", 1); #AFT door
# Fetch nodes into vectors
var pageProp = [props.globals.getNode("/MCDU[0]/page", 1), props.globals.getNode("/MCDU[1]/page", 1)];
var active = [props.globals.getNode("/MCDU[0]/active", 1), props.globals.getNode("/MCDU[1]/active", 1)];
var activeAtsu = [props.globals.getNode("/MCDU[0]/atsu-active", 1), props.globals.getNode("/MCDU[1]/atsu-active", 1)];
props.globals.initNode("/MCDU[0]/active-system", "", "STRING");
props.globals.initNode("/MCDU[1]/active-system", "", "STRING");
# Conversion factor pounds to kilogram
var LBS2KGS = 0.4535924;
@ -288,6 +298,19 @@ var canvas_MCDU_base = {
me["ArrowLeft"].hide();
me["ArrowRight"].hide();
},
showPageNumbers: func(pagno=0,pagcnt=0) {
if (pagno == 0) return me.defaultPageNumbers();
me["Simple_PageNum"].show();
me["Simple_PageNum"].setText((pagcnt>0) ? pagno ~ "/" ~ pagcnt : pagno);
me["ArrowLeft"].show();
me["ArrowRight"].show();
},
showPageNumbersOnly: func(pagno,pagcnt) {
me["Simple_PageNum"].show();
me["Simple_PageNum"].setText(sprintf("%9s",pagno ~ "/" ~ pagcnt));
me["ArrowLeft"].hide();
me["ArrowRight"].hide();
},
hideAllArrows: func() {
me["Simple_L1_Arrow"].hide();
me["Simple_L2_Arrow"].hide();
@ -597,6 +620,178 @@ var canvas_MCDU_base = {
me["Simple_R6"].hide();
me["Simple_R6_Arrow"].hide();
}
} else if (page == "FLTLOG") {
if (!pageSwitch[i].getBoolValue()) {
me.defaultHideWithCenter();
me["Simple_L0S"].hide();
me["ArrowLeft"].hide();
me["ArrowRight"].hide();
me.showLeft(1, 1, 1, 1, 1, -1);
me.showLeftS(1, -1, 1, 1, 1, -1);
me.showLeftArrow(-1, -1, -1, -1, -1, -1);
me.showCenter(-1, 1, 1, 1, 1, -1);
me.showCenterS(-1, 1, 1, 1, 1, -1);
me.showRight(1, 1, 1, 1, 1, -1);
me.showRightS(1, 1, 1, 1, 1, -1);
me.showRightArrow(-1, -1, -1, -1, 1, -1);
me["Simple_C3B"].hide();
me["Simple_C4B"].hide();
me.standardFontSize();
me.standardFontColour();
me.colorCenterS("wht", "wht", "wht", "wht", "wht", "wht");
me.colorCenter("wht", "wht", "wht", "wht", "wht", "wht");
#me["PRINTPAGE"] - TODO missing asterisk at 5L - only useful when printing available
me["Simple_L1S"].setText(" FLT NUM-DATE");
me["Simple_R1S"].setText("ORIG-DEST ");
me["Simple_L1"].setFontSize(small);
me["Simple_R1"].setFontSize(small);
me["Simple_L2"].setFontSize(small);
me["Simple_C2"].setFontSize(small);
me["Simple_R2"].setFontSize(small);
me["Simple_L3"].setFontSize(small);
me["Simple_C3"].setFontSize(small);
me["Simple_R3"].setFontSize(small);
me["Simple_L5"].setText(" PRINT");
me["Simple_L5"].setColor(BLUE);
me["Simple_R5"].setText("SENSORS ");
me["Simple_R5"].setColor(WHITE);
me["Simple_L4"].setFontSize(small);
me["Simple_L4"].setText(" FLIGHT");
me["Simple_C4"].setFontSize(small);
me["Simple_C4"].setText("--TIMES--");
me["Simple_R4"].setFontSize(small);
me["Simple_R4"].setText("BLOCK ");
me["Simple_C2S"].setText("TIME");
me["Simple_R2S"].setText("FOB ");
me["Simple_L2"].setText( " OUT -");
me["Simple_L3S"].setText(" OFF -");
me["Simple_L3"].setText( " ON -");
me["Simple_L4S"].setText(" IN -");
me["Simple_C5"].setFontSize(small);
pageSwitch[i].setBoolValue(1);
}
var logid = 1; #mcdu.FlightLogDatabase.getPageSize(); - one page only - TODO: multi pages
if (logid == 0) logid = 1;
me.showPageNumbersOnly(1,1);
me["Simple_Title"].setText(sprintf("FLT LOG.%04d",logid));
me["Simple_C2"].setText( "--.--"); #TODO - missing ":" char on fontset
me["Simple_C3S"].setText("--.--");
me["Simple_C3"].setText( "--.--");
me["Simple_C4S"].setText("--.--");
me["Simple_R2"].setText( "---.- ");
me["Simple_R3S"].setText("---.- ");
me["Simple_R3"].setText( "---.- ");
me["Simple_R4S"].setText("---.- ");
me.colorCenter("wht", "grn", "grn", "wht", "wht", "wht");
me.colorRight("wht", "grn", "grn", "wht", "wht", "wht");
me.colorLeftS("wht", "wht", "wht", "wht", "grn", "wht");
me.colorCenterS("wht", "wht", "grn", "grn", "grn", "wht");
me.colorRightS("wht", "wht", "grn", "grn", "grn", "wht");
var rowsC = ["Simple_C2","Simple_C3S","Simple_C3","Simple_C4S"];
var rowsR = ["Simple_R2","Simple_R3S","Simple_R3","Simple_R4S"];
var logs = mcdu.FlightLogDatabase.getLogByPage(logid);
var len = size(logs);
var flgtime = 0;
var blktime = 0;
for ( var i = 0; i < len; i = i + 1 ) {
if (logs[i] != nil) { # only valid reports
var p = logs[i].state;
if (p == 4) p = 3; # RETURN-IN
me[rowsC[p]].setText(logs[i].time);
me[rowsR[p]].setText(sprintf("%3.1f ",logs[i].fob));
}
}
var logpage = mcdu.FlightLogDatabase.getPage(logid);
me["Simple_L1"].setText(sprintf("%8s - ",logpage.fltnum) ~ logpage.date);
me["Simple_R1"].setText(logpage.tofrom ~ " ");
me["Simple_L5S"].setText( " " ~ logpage.flttime );
me["Simple_C5S"].setText(sprintf("%02.0f", getprop("/sim/time/utc/hour")) ~ "." ~ sprintf("%02.0f", getprop("/sim/time/utc/minute")) ~ "." ~ sprintf("%02.0f", getprop("/sim/time/utc/second")));
me["Simple_R5S"].setText( logpage.blktime ~ " " );
var fltstate = logpage.fltstate;
if (fltstate == "") {
fltstate = (fmgc.FMGCInternal.toFromSet) ? "BEGIN" : "RESET"; #CHECKME - my best guess, only ready when plan inserted
#TODO Pushback detection -> WPUSH state???
}
me["Simple_C5"].setText(fltstate);
} else if (page == "SENSORS") {
if (!pageSwitch[i].getBoolValue()) {
me.defaultHide();
me["Simple_Title"].setText("SENSORS ");
me.defaultPageNumbers();
me["Simple_L0S"].hide();
me.showLeft(1, 1, 1, 1, 1, 1);
me.showLeftS(1, 1, 1, 1, -1, -1);
me.showLeftArrow(-1, -1, -1, -1, -1, 1);
me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht");
me.showRight(1, 1, 1, 1, -1, -1);
me.showRightS(1, 1, 1, 1, -1, -1);
me.showRightArrow(-1, -1, -1, -1, -1, -1);
#me["PRINTPAGE"] - TODO missing asterisk at 5L - only useful when printing available
me.standardFontSize();
me.standardFontColour();
me["Simple_L1"].setFontSize(small);
me["Simple_R1"].setFontSize(small);
me["Simple_L2"].setFontSize(small);
me["Simple_R2"].setFontSize(small);
me["Simple_L3"].setFontSize(small);
me["Simple_R3"].setFontSize(small);
me["Simple_L4"].setFontSize(small);
me["Simple_R4"].setFontSize(small);
me.colorRight("grn", "grn", "grn", "grn", "grn", "grn");
me.colorRightS("grn", "grn", "grn", "grn", "grn", "grn");
me["Simple_L1S"].setText(" PARK BRAKE");
me["Simple_L1"].setText( " NOSE STRUT");
me["Simple_L2S"].setText( " L FWD DOOR");
me["Simple_L2"].setText( " R FWD DOOR");
me["Simple_L3S"].setText( " L AFT DOOR");
me["Simple_L3"].setText( " R AFT DOOR");
me["Simple_L4S"].setText( " GND SPEED");
me["Simple_L4"].setText( " FOB");
me["Simple_L5"].setText(" PRINT");
me["Simple_L5"].setColor(BLUE);
me["Simple_L6"].setText(" RETURN");
pageSwitch[i].setBoolValue(1);
}
me["Simple_R1S"].setText(sprintf("%-10s",(parking_brake.getValue() == 1) ? "SET" : "RELEASED"));
me["Simple_R1"].setText(sprintf("%-10s",(gear0_wow.getValue() == 1) ? "GROUND" : "FLIGHT"));
me["Simple_R2S"].setText(sprintf("%-10s",(doorL1_pos.getValue() > 0.1) ? "OPEN" : "CLOSED"));
me["Simple_R2"].setText(sprintf("%-10s",(doorR1_pos.getValue() > 0.1) ? "OPEN" : "CLOSED"));
me["Simple_R3S"].setText(sprintf("%-10s",(doorL4_pos.getValue() > 0.1) ? "OPEN" : "CLOSED"));
me["Simple_R3"].setText(sprintf("%-10s",(doorR4_pos.getValue() > 0.1) ? "OPEN" : "CLOSED"));
me["Simple_R4S"].setText(sprintf("%-10s",sprintf("%03.3f",pts.Velocities.groundspeed.getValue())));
me["Simple_R4"].setText(sprintf("%-10s",sprintf("%03.1f",fmgc.FMGCInternal.fob)));
} else if (page == "AOCCONFIG") {
if (!pageSwitch[i].getBoolValue()) {
me.defaultHideWithCenter();
@ -1834,9 +2029,9 @@ var canvas_MCDU_base = {
me["Simple_Title"].setText(sprintf("%s", " " ~ acType.getValue()));
me.defaultPageNumbers();
me.showLeft(1, 1, 1, -1, 1, 1);
me.showLeft(1, 1, 1, -1, -1, 1);
me["Simple_L0S"].hide();
me.showLeftS(1, 1, 1, -1, 1, 1);
me.showLeftS(1, 1, 1, -1, -1, 1);
me.showLeftArrow(-1, -1, 1, -1, -1, -1);
me.showRight(-1, 1, -1, 1, 1, 1);
me.showRightS(-1, -1, -1, 1, 1, 1);
@ -1859,13 +2054,19 @@ var canvas_MCDU_base = {
me.colorRightS("wht", "wht", "wht", "wht", "grn", "wht");
me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht");
if (fmgc.FMGCInternal.phase == 0 or fmgc.FMGCInternal.phase == 7) { # only on preflight and done phases
me["Simple_L5S"].setText("CHG CODE");
me["Simple_L5S"].show();
me["Simple_L5"].setText("[ ]");
me["Simple_L5"].show();
} else {
me["Simple_L5"].hide();
}
me["Simple_L5"].setText("[ ]");
me["Simple_L6"].setText(sprintf("%s/%s",idleFactor.getValue(),perfFactor.getValue()));
me["Simple_L1S"].setText(" ENG");
me["Simple_L2S"].setText(" ACTIVE NAV DATA BASE");
me["Simple_L3S"].setText(" SECOND NAV DATA BASE");
me["Simple_L5S"].setText("CHG CODE");
me["Simple_L6S"].setText("IDLE/PERF");
me["Simple_R6"].setText("STATUS/XLOAD ");
me["Simple_R6S"].setText("SOFTWARE ");

View file

@ -971,6 +971,7 @@ var reset_FMGC = func {
mcdu.MCDU_reset(0);
mcdu.MCDU_reset(1);
mcdu.ReceivedMessagesDatabase.clearDatabase();
mcdu.FlightLogDatabase.clearDatabase();
Input.fd1.setValue(fd1);
Input.fd2.setValue(fd2);

View file

@ -180,12 +180,16 @@ var MessageController = {
TypeIMessage.new("USING COST INDEX N", 1),TypeIMessage.new("WAIT FOR SYSTEM RESPONSE"),TypeIMessage.new("RWY/LS MISMATCH"),
TypeIMessage.new("VHF3 VOICE MSG NOT GEN"),TypeIMessage.new("NO COMM MSG NOT GEN"),TypeIMessage.new("WX UPLINK"),
TypeIMessage.new("SIMBRIEF DOWNLOAD FAILED"),TypeIMessage.new("MISSING USERNAME"),TypeIMessage.new("AOC ACT F-PLN UPLINK"),
TypeIMessage.new("NO ANSWER TO REQUEST"),TypeIMessage.new("NO D-ATIS AVAILABLE"),TypeIMessage.new("BAD SERVER RESPONSE")
TypeIMessage.new("NO ANSWER TO REQUEST"),TypeIMessage.new("NO D-ATIS AVAILABLE"),TypeIMessage.new("BAD SERVER RESPONSE"),
TypeIMessage.new("WIND DATA UPLINK"),TypeIMessage.new("CHECK ALT WIND"),TypeIMessage.new("INVALID WIND UPLINK"),TypeIMessage.new("WIND UPLINK EXISTS"), #p.533
TypeIMessage.new("FM DATALINK UNAVAIL"),TypeIMessage.new("NOT XMITTED TO ACARS"), #p.559
TypeIMessage.new("PRINTER NOT AVAILABLE"),
]),
typeIIMessages: std.Vector.new([
TypeIIMessage.new("LAT DISCONT AHEAD", "amb", 0),TypeIIMessage.new("MORE DRAG"),TypeIIMessage.new("RWY/LS MISMATCH", "amb", 0),TypeIIMessage.new("STEP DELETED"),
TypeIIMessage.new("STEP NOW"),TypeIIMessage.new("TIME TO EXIT", "amb", 0),TypeIIMessage.new("V1/VR/V2 DISAGREE", "amb", 0),
TypeIIMessage.new("TO SPEED TOO LOW", "amb", 0),
TypeIIMessage.new("CHECK DEST DATA", "amb", 0), #p.533
]),
# to speed to low - new on a320, margin against vmcg / vs1g

161
Nasal/MCDU/FLIGHTLOG.nas Normal file
View file

@ -0,0 +1,161 @@
# AOC Flight Log system
# Basic OOOI system implementation
var OOOIReport = {
new: func(state,fob="",time="") {
var report = {parents:[OOOIReport]};
report.state = state;
report.fob = (fob != "") ? fob : fmgc.FMGCInternal.fob;
report.time = (time != "") ? time : sprintf("%02d.%02d", getprop("/sim/time/utc/hour"), getprop("/sim/time/utc/minute"));
report.elapsed = int(getprop("/sim/time/elapsed-sec"));
report.gmt = getprop("/sim/time/gmt-string");
report.date = getprop("/sim/time/utc/day");
report.fltnum = (fmgc.FMGCInternal.flightNumSet == 1) ? fmgc.FMGCInternal.flightNum : "----";
report.tofrom = (fmgc.FMGCInternal.toFromSet) ? fmgc.FMGCInternal.depApt ~ "-" ~ fmgc.FMGCInternal.arrApt : "----/----";
return report;
},
};
# Flight phase states: RESET, BEGIN, WPUSH, OUT, OFF, ON, END
var OOOIReportPage = {
new: func(index) {
var page = {parents:[OOOIReportPage]};
page.index = index;
page.fltstate = ""; #UNDEF state RESET/BEGIN/WPUSH
page.fltnum = (fmgc.FMGCInternal.flightNumSet == 1) ? fmgc.FMGCInternal.flightNum : "";
page.date = getprop("/sim/time/utc/day");
page.tofrom = (fmgc.FMGCInternal.toFromSet) ? fmgc.FMGCInternal.depApt ~ "-" ~ fmgc.FMGCInternal.arrApt : "";
page.fltstart = 0;
page.blkstart = 0;
page.flttime = "--.--";
page.blktime = "--.--";
return page;
},
};
var formatSecToHHMM = func(sec) {
var mn = int(sec / 60);
return sprintf("%02d.%02d",int(mn/60),math.mod(mn,60));
}
var FlightLogDatabase = {
database: std.Vector.new(),
pages: std.Vector.new(),
addReport: func(report) {
if (report.state == 0) me.pages.append( OOOIReportPage.new(me.getSize()) );
me.database.append(report);
var pg = me.pages.vector[me.pages.size()-1];
pg.fltnum = report.fltnum;
pg.tofrom = report.tofrom;
if (report.state == 0) {
pg.fltstate = "OUT";
pg.blkstart = report.elapsed;
}
else if (report.state == 1) {
pg.fltstate = "OFF";
pg.fltstart = report.elapsed;
}
else if (report.state == 2) {
pg.fltstate = "ON";
if (pg.fltstart > 0) pg.flttime = formatSecToHHMM(report.elapsed - pg.fltstart);
}
else if (report.state > 2) {
pg.fltstate = "END";
if (pg.blkstart > 0) pg.blktime = formatSecToHHMM(report.elapsed - pg.blkstart);
}
},
getSize: func() {
return me.database.size();
},
getPageSize: func() {
return me.pages.size();
},
clearDatabase: func() {
me.database.clear();
me.pages.clear();
},
getLogs: func() {
var lst = [];
foreach (var log; me.database) {
append(lst,log);
}
return lst;
},
getPage: func(pg) {
return (pg<=me.getPageSize()) ? me.pages.vector[pg-1] : OOOIReportPage.new(0);
},
getLogByPage: func(no) {
var lst = [nil,nil,nil,nil];
if (me.getPageSize() == 0) return lst;
var i = (me.getPageSize()>=no) ? me.pages.vector[no-1].index : 0;
var len = me.getSize();
var v = 0;
var p = 0;
while (i<len) {
p = me.database.vector[i].state;
if (v == 0 or p != 0) lst[v] = me.database.vector[i];
else i = len;
i+=1;
v+=1;
}
return lst;
},
};
var expectedOOOIState = 0; # OOOI states: 0 = out, 1 = OFF, 2 = ON, 3 = IN, 4 = RETURN-IN
var doorL1_pos = props.globals.getNode("/sim/model/door-positions/doorl1/position-norm", 1);
var doorR1_pos = props.globals.getNode("/sim/model/door-positions/doorr1/position-norm", 1);
var doorL4_pos = props.globals.getNode("/sim/model/door-positions/doorl4/position-norm", 1);
var doorR4_pos = props.globals.getNode("/sim/model/door-positions/doorr4/position-norm", 1);
#check for A/C state change - advice me for a better method, please :/
var waitingOOOIChange = maketimer(1, func(){ # 1sec precision
var phase = fmgc.FMGCInternal.phase;
var gs = pts.Velocities.groundspeed.getValue();
var gear0 = pts.Gear.wow[0].getBoolValue();
#print(sprintf("OOOI check: %d %d %.2f %s",expectedOOOIState,phase,gs,gear0));
if (expectedOOOIState == 0) { # OUT
if (gear0 and phase == 0) {
if (gs>9) { # imho - it's useful few speed tollerance, 10kts min speed on taxiways - CHECKME - better with pushback detection?
FlightLogDatabase.addReport(OOOIReport.new(expectedOOOIState));
expectedOOOIState = 1;
}
}
} else if (expectedOOOIState == 1) { # OFF
if (!gear0) {
FlightLogDatabase.addReport(OOOIReport.new(expectedOOOIState));
expectedOOOIState = 2;
}
else if (gs < 1) { # RETURN-IN ?? - rejected takeoff, A/C back to apron - CHECKME
if (doorL1_pos.getValue()>0 or doorR1_pos.getValue()>0 or doorL4_pos.getValue()>0 or doorR4_pos.getValue()>0) {
FlightLogDatabase.addReport(OOOIReport.new(4)); # RETURN-IN
expectedOOOIState = 0;
}
}
} else if (expectedOOOIState == 2) { # ON
if (gear0 and (phase == 7 or phase == 0)) { #done or preflight
FlightLogDatabase.addReport(OOOIReport.new(expectedOOOIState));
expectedOOOIState = 3;
}
} else if (expectedOOOIState == 3) { # IN
if (gear0 and gs < 1) {
if (doorL1_pos.getValue()>0 or doorR1_pos.getValue()>0 or doorL4_pos.getValue()>0 or doorR4_pos.getValue()>0) {
FlightLogDatabase.addReport(OOOIReport.new(expectedOOOIState));
expectedOOOIState = 0;
}
}
}
});
var engine_one_chk_OOOI = setlistener("/engines/engine[0]/state", func {
if (getprop("/engines/engine[0]/state") == 3) {
removelistener(engine_one_chk_OOOI);
waitingOOOIChange.start();
}
},0,0);

View file

@ -18,6 +18,7 @@ var MCDU_reset = func(i) {
setprop("it-autoflight/settings/togaspd", 157); #aka v2 clone
setprop("/MCDU[" ~ i ~ "]/last-fmgc-page", "STATUS");
setprop("/MCDU[" ~ i ~ "]/last-atsu-page", "ATSUDLINK");
setprop("/MCDU[" ~ i ~ "]/active-system","");
pageNode[i].setValue("MCDU");
setprop("/FMGC/keyboard-left", 0);
@ -218,9 +219,11 @@ var lskbutton = func(btn, i) {
pageNode[i].setValue(getprop("/MCDU[" ~ i ~ "]/last-fmgc-page"));
mcdu_scratchpad.scratchpads[i].empty();
setprop("/MCDU[" ~ i ~ "]/active", 2);
setprop("/MCDU[" ~ i ~ "]/active-system","fmgc");
}, 2);
} else {
pageNode[i].setValue(getprop("/MCDU[" ~ i ~ "]/last-fmgc-page"));
setprop("/MCDU[" ~ i ~ "]/active-system","fmgc");
mcdu_scratchpad.scratchpads[i].empty();
}
}
@ -374,9 +377,11 @@ var lskbutton = func(btn, i) {
pageNode[i].setValue(getprop("/MCDU[" ~ i ~ "]/last-atsu-page"));
mcdu_scratchpad.scratchpads[i].empty();
setprop("/MCDU[" ~ i ~ "]/atsu-active", 2);
setprop("/MCDU[" ~ i ~ "]/active-system","atsu");
}, 2);
} else {
pageNode[i].setValue(getprop("/MCDU[" ~ i ~ "]/last-atsu-page"));
setprop("/MCDU[" ~ i ~ "]/active-system","atsu");
mcdu_scratchpad.scratchpads[i].empty();
}
}
@ -797,6 +802,8 @@ var lskbutton = func(btn, i) {
mcdu_scratchpad.scratchpads[i].empty();
} else if (page == "ATCMENU") {
pageNode[i].setValue("NOTIFICATION");
} else if (page == "FLTLOG") {
mcdu_message(i, "NOT ALLOWED");
} else if (page == "MCDUTEXT") {
atsu.freeTexts[i].selection = 9;
atsu.freeTexts[i].changed = 1;
@ -859,6 +866,8 @@ var lskbutton = func(btn, i) {
canvas_mcdu.myClosestAirport[i].freeze();
} else if (page == "AOCMENU" or page == "ATCMENU" or page == "ATCMENU2") {
pageNode[i].setValue("ATSUDLINK");
} else if (page == "SENSORS") {
pageNode[i].setValue("FLTLOG");
} else if (page == "NOTIFICATION" or page == "CONNECTSTATUS" or page == "MCDUTEXT") {
pageNode[i].setValue("ATCMENU");
} else if (page == "WEATHERREQ" or page == "RECEIVEDMSGS") {
@ -945,6 +954,8 @@ var rskbutton = func(btn, i) {
}
} else if (page == "ATSUDLINK") {
pageNode[i].setValue("AOCMENU");
} else if (page == "AOCMENU") {
pageNode[i].setValue("FLTLOG");
} else if (page == "WEATHERREQ") {
var result = atsu.AOC.newStation(mcdu_scratchpad.scratchpads[i].scratchpad, i);
if (result == 1) {
@ -1205,6 +1216,8 @@ var rskbutton = func(btn, i) {
}
} else if (page == "ATCMENU") {
pageNode[i].setValue("CONNECTSTATUS");
} else if (page == "FLTLOG") {
pageNode[i].setValue("SENSORS");
} else if (page == "WEATHERREQ") {
var result = atsu.AOC.sendReq(i);
if (result == 1) {
@ -1397,6 +1410,13 @@ var pagebutton = func(btn, i) {
page = pageNode[i].getValue();
setprop("/MCDU[" ~ i ~ "]/scratchpad-color", "wht");
if (page != "MCDU") {
# A more flexible system/page tracking for future system expansion
if (getprop("/MCDU[" ~ i ~ "]/active-system") == "fmgc") setprop("/MCDU[" ~ i ~ "]/last-fmgc-page", page);
else setprop("/MCDU[" ~ i ~ "]/last-atsu-page", page);
if (btn == "atc") setprop("/MCDU[" ~ i ~ "]/active-system","atsu");
else setprop("/MCDU[" ~ i ~ "]/active-system","fmgc");
if (btn == "radnav") {
pageNode[i].setValue("RADNAV");
} else if (btn == "prog") {
@ -1433,12 +1453,13 @@ var pagebutton = func(btn, i) {
} else if (btn == "data") {
pageNode[i].setValue("DATA");
} else if (btn == "mcdu") {
var page = page;
if (page != "ATSUDLINK" and page != "AOCMENU" and page != "AOCCONFIG" and page != "WEATHERREQ" and page != "WEATHERTYPE" and page != "RECEIVEDMSGS" and page != "RECEIVEDMSG" and page != "ATCMENU" and page != "ATCMENU2" and page != "MCDUTEXT" and page != "NOTIFICATION" and page != "CONNECTSTATUS" and page != "COMPANYCALL" and page != "VOICEDIRECTORY" and page != "DATAMODE" and page != "COMMMENU" and page != "COMMSTATUS" and page != "COMMINIT" and page != "ATIS" and page != "ATISDETAIL") {
setprop("/MCDU[" ~ i ~ "]/last-fmgc-page", page);
} else {
setprop("/MCDU[" ~ i ~ "]/last-atsu-page", page);
}
#var page = page;
#if (page != "ATSUDLINK" and page != "AOCMENU" and page != "AOCCONFIG" and page != "WEATHERREQ" and page != "WEATHERTYPE" and page != "RECEIVEDMSGS" and page != "RECEIVEDMSG" and page != "ATCMENU" and page != "ATCMENU2" and page != "MCDUTEXT" and page != "NOTIFICATION" and page != "CONNECTSTATUS" and page != "COMPANYCALL" and page != "VOICEDIRECTORY" and page != "DATAMODE" and page != "COMMMENU" and page != "COMMSTATUS" and page != "COMMINIT" and page != "ATIS" and page != "ATISDETAIL") {
#if (getprop("/MCDU[0]/active-system") == "fmgc") {
# setprop("/MCDU[" ~ i ~ "]/last-fmgc-page", page);
#} else {
# #setprop("/MCDU[" ~ i ~ "]/last-atsu-page", page);
#}
mcdu_message(i, "SELECT DESIRED SYSTEM");
pageNode[i].setValue("MCDU");
} else if (btn == "f-pln" or btn == "airport") {