diff --git a/A320-main.xml b/A320-main.xml
index 58bae6e1..fcfe79ae 100644
--- a/A320-main.xml
+++ b/A320-main.xml
@@ -4697,7 +4697,7 @@
Aircraft/A320-family/Nasal/MCDU/ARRIVAL.nas
Aircraft/A320-family/Nasal/MCDU/AIRWAYS.nas
Aircraft/A320-family/Nasal/MCDU/CLOSESTAIRPORT.nas
- Aircraft/A320-family/Nasal/MCDU/RECEIVEDMESSAGES.nas
+ Aircraft/A320-family/Nasal/MCDU/RECEIVEDMESSAGES.nas
Aircraft/A320-family/Nasal/MCDU/PILOTWAYPOINT.nas
Aircraft/A320-family/Nasal/MCDU/HOLD.nas
Aircraft/A320-family/Nasal/MCDU/F-PLN.nas
@@ -4705,7 +4705,8 @@
Aircraft/A320-family/Nasal/MCDU/WINDCRZ.nas
Aircraft/A320-family/Nasal/MCDU/WINDDES.nas
Aircraft/A320-family/Nasal/MCDU/WINDHIST.nas
- Aircraft/A320-family/Nasal/MCDU/ATIS.nas
+ Aircraft/A320-family/Nasal/MCDU/ATIS.nas
+ Aircraft/A320-family/Nasal/MCDU/FLIGHTLOG.nas
Aircraft/A320-family/Nasal/MCDU/MCDU.nas
Aircraft/A320-family/Nasal/MCDU/INITA.nas
Aircraft/A320-family/Nasal/MCDU/IRSINIT.nas
diff --git a/Models/FlightDeck/a320.flightdeck.xml b/Models/FlightDeck/a320.flightdeck.xml
index 17f85d66..f9acd24e 100644
--- a/Models/FlightDeck/a320.flightdeck.xml
+++ b/Models/FlightDeck/a320.flightdeck.xml
@@ -1,4 +1,4 @@
-
+
@@ -138,86 +138,68 @@
- pick
+ knob
ddrmi_vor_adf_select_1
+ instrumentation/ddrmi/vor-adf-1
+
+ ddrmi_vor_adf_select_1.axis
+
-
- false
- property-cycle
+ property-adjust
instrumentation/ddrmi/vor-adf-1
- 0
- 1
- -1
-
-
-
-
- false
-
- property-cycle
- instrumentation/ddrmi/vor-adf-1
- -1
- 1
- 0
+ -1
+ 1
+
- Knob 1 rotate
- ddrmi_vor_adf_select_1
+ DDRMI vor-adf knob 1
rotate
+ ddrmi_vor_adf_select_1
instrumentation/ddrmi/vor-adf-1
- -190
- 045
- 1 0
+ -190
+ 045
+ 1 0
ddrmi_vor_adf_select_1.axis
-
+
- pick
+ knob
ddrmi_vor_adf_select_2
+ instrumentation/ddrmi/vor-adf-2
+
+ ddrmi_vor_adf_select_2.axis
+
-
- false
- property-cycle
+ property-adjust
instrumentation/ddrmi/vor-adf-2
- 0
- 1
- -1
-
-
-
-
- false
-
- property-cycle
- instrumentation/ddrmi/vor-adf-2
- -1
- 1
- 0
+ -1
+ 1
+
- Knob 2 rotate
- ddrmi_vor_adf_select_2
+ DDRMI vor-adf knob 2
rotate
+ ddrmi_vor_adf_select_2
instrumentation/ddrmi/vor-adf-2
- -1-90
- 0-45
- 1 0
+ -1-90
+ 0-45
+ 1 0
ddrmi_vor_adf_select_2.axis
-
+
@@ -227,7 +209,7 @@
rotate
instrumentation/ddrmi/flag-1
- 045
+ 0-45
1 0
@@ -241,7 +223,7 @@
rotate
instrumentation/ddrmi/flag-2
- 0-45
+ 045
1 0
@@ -8347,30 +8329,21 @@
+
- UTC selector rotate
- pick
+ UTC selector animation
+ knob
clock_knob
+ instrumentation/clock/utc-selector
+
+ clock_knob.axis
+
-
- false
- property-cycle
+ property-adjust
instrumentation/clock/utc-selector
- 0
- 1
- 2
-
-
-
-
- false
-
- property-cycle
- instrumentation/clock/utc-selector
- 2
- 1
- 0
+ 0
+ 2
@@ -8381,9 +8354,9 @@
clock_knob
instrumentation/clock/utc-selector
- 00
- 145
- 290
+ 290
+ 145
+ 0 0
clock_knob.axis
diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas
index 7aff331d..1f429180 100644
--- a/Models/Instruments/MCDU/MCDU.nas
+++ b/Models/Instruments/MCDU/MCDU.nas
@@ -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();
@@ -421,7 +444,7 @@ var canvas_MCDU_base = {
} else {
me["FPLN_Callsign"].hide();
}
-
+
me.dynamicPageFunc(myFpln[i].L1, "Simple_L1");
me.dynamicPageFunc(myFpln[i].L2, "Simple_L2");
me.dynamicPageFunc(myFpln[i].L3, "Simple_L3");
@@ -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");
-
- me["Simple_L5"].setText("[ ]");
+ 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_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_L3S"].setText(" SECOND NAV DATA BASE");
me["Simple_L6S"].setText("IDLE/PERF");
me["Simple_R6"].setText("STATUS/XLOAD ");
me["Simple_R6S"].setText("SOFTWARE ");
diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas
index c5fa6567..8b36cd6b 100644
--- a/Nasal/FMGC/FMGC.nas
+++ b/Nasal/FMGC/FMGC.nas
@@ -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);
diff --git a/Nasal/FMGC/mcdu-messages.nas b/Nasal/FMGC/mcdu-messages.nas
index f741725c..3c036d2c 100644
--- a/Nasal/FMGC/mcdu-messages.nas
+++ b/Nasal/FMGC/mcdu-messages.nas
@@ -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
diff --git a/Nasal/MCDU/FLIGHTLOG.nas b/Nasal/MCDU/FLIGHTLOG.nas
new file mode 100644
index 00000000..81af304e
--- /dev/null
+++ b/Nasal/MCDU/FLIGHTLOG.nas
@@ -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 (i9) { # 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);
\ No newline at end of file
diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas
index 7650653f..81a8b18d 100644
--- a/Nasal/MCDU/MCDU.nas
+++ b/Nasal/MCDU/MCDU.nas
@@ -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 {
+ } 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,8 +1410,15 @@ 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");
+ pageNode[i].setValue("RADNAV");
} else if (btn == "prog") {
if (fmgc.FMGCInternal.phase == 0 or fmgc.FMGCInternal.phase == 1) {
pageNode[i].setValue("PROGTO");
@@ -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") {
@@ -1477,10 +1498,10 @@ var pagebutton = func(btn, i) {
settimer(func(){
pageNode[i].setValue("ATCMENU");
mcdu_scratchpad.scratchpads[i].empty();
- setprop("/MCDU[" ~ i ~ "]/atsu-active", 2);
+ setprop("/MCDU[" ~ i ~ "]/atsu-active", 2);
}, 2);
} else {
- pageNode[i].setValue("ATCMENU");
+ pageNode[i].setValue("ATCMENU");
}
}
}