From da6562bc8a26026e9cc9c85588d7284540ea0175 Mon Sep 17 00:00:00 2001 From: Inuyaksa Date: Wed, 20 Jan 2021 20:32:21 +0100 Subject: [PATCH] preflight --- Models/Instruments/MCDU/MCDU.nas | 120 +++++++++++++++-------- Models/Instruments/MCDU/res/mcdu.svg | 141 +++++++++++++++------------ Nasal/FMGC/FMGC.nas | 12 ++- Nasal/FMGC/SimbriefParser.nas | 31 +++++- Nasal/MCDU/FLIGHTLOG.nas | 44 +++++++-- Nasal/MCDU/INITA.nas | 2 +- Nasal/MCDU/MCDU.nas | 8 +- Nasal/MCDU/ROUTESELECTION.nas | 15 +++ Sounds/A320-common-sound.xml | 40 ++++++-- 9 files changed, 285 insertions(+), 128 deletions(-) diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index 71b97409..a54eb8d9 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -231,7 +231,7 @@ var canvas_MCDU_base = { return me; }, getKeys: func() { - return ["Simple","Simple_Center","Scratchpad","Simple_Title","Simple_PageNum","ArrowLeft","ArrowRight","Simple_L1","Simple_L2","Simple_L3","Simple_L4", + return ["Simple","Simple_Center","Scratchpad","Simple_Title","Simple_Title2","Simple_PageNum","ArrowLeft","ArrowRight","Simple_L1","Simple_L2","Simple_L3","Simple_L4", "Simple_L5","Simple_L6","Simple_L0S","Simple_L1S","Simple_L2S","Simple_L3S","Simple_L4S","Simple_L5S","Simple_L6S","Simple_L1_Arrow", "Simple_L2_Arrow","Simple_L3_Arrow","Simple_L4_Arrow","Simple_L5_Arrow","Simple_L6_Arrow","Simple_R1","Simple_R2","Simple_R3","Simple_R4","Simple_R5", "Simple_R6","Simple_R1S","Simple_R2S","Simple_R3S","Simple_R4S","Simple_R5S","Simple_R6S","Simple_R1_Arrow","Simple_R2_Arrow","Simple_R3_Arrow", @@ -262,6 +262,7 @@ var canvas_MCDU_base = { defaultHide: func() { me["Simple"].show(); me["Simple_Center"].hide(); + me["Simple_Title2"].hide(); me["FPLN"].hide(); me["DIRTO_TMPY_group"].hide(); me["INITA"].hide(); @@ -279,6 +280,7 @@ var canvas_MCDU_base = { defaultHideWithCenter: func() { me["Simple"].show(); me["Simple_Center"].show(); + me["Simple_Title2"].hide(); me["FPLN"].hide(); me["DIRTO_TMPY_group"].hide(); me["INITA"].hide(); @@ -343,7 +345,9 @@ var canvas_MCDU_base = { me.fontRight(default, default, default, default, default, default); me.fontRightS(default, default, default, default, default, default); me.fontSizeLeft(normal, normal, normal, normal, normal, normal); + me.fontSizeLeftS(small, small, small, small, small, small); me.fontSizeRight(normal, normal, normal, normal, normal, normal); + me.fontSizeRightS(small, small, small, small, small, small); }, standardFontColour: func() { me.colorLeft("wht", "wht", "wht", "wht", "wht", "wht"); @@ -387,6 +391,9 @@ var canvas_MCDU_base = { me["PRINTPAGE"].setColor(WHITE); } } + + if (!pageSwitch[i].getBoolValue()) me.defaultHide(); + if (page != "ATIS") { me["ATISSend1"].hide(); me["ATISSend2"].hide(); @@ -620,7 +627,7 @@ var canvas_MCDU_base = { } } else if (page == "FLTLOG") { if (!pageSwitch[i].getBoolValue()) { - me.defaultHideWithCenter(); + me.defaultHideWithCenter(); me["Simple_L0S"].hide(); me["ArrowLeft"].hide(); @@ -718,7 +725,7 @@ var canvas_MCDU_base = { var logpage = mcdu.FlightLogDatabase.getPage(logid); - me["Simple_L1"].setText(sprintf("%8s - ",logpage.fltnum) ~ logpage.date); + me["Simple_L1"].setText(sprintf("%8s- ",logpage.fltnum) ~ logpage.date); me["Simple_R1"].setText(logpage.tofrom ~ " "); me["Simple_L5S"].setText( " " ~ logpage.flttime ); @@ -735,6 +742,7 @@ var canvas_MCDU_base = { } else if (page == "SENSORS") { if (!pageSwitch[i].getBoolValue()) { me.defaultHide(); + me.standardFontSize(); me["Simple_Title"].setText("SENSORS "); me.defaultPageNumbers(); me["Simple_L0S"].hide(); @@ -2769,37 +2777,65 @@ var canvas_MCDU_base = { } else if (page == "ROUTESELECTION") { if (!pageSwitch[i].getBoolValue()) { - me.defaultHideWithCenter(); + me.defaultHide(); + me.standardFontSize(); me["arrowsDepArr"].hide(); me["PERFAPPR"].hide(); me["PERFGA"].hide(); me["Simple_Title"].show(); me["Simple_Title"].setText("ROUTE SELECTION"); - me.defaultPageNumbers(); + me.showPageNumbers(1,1); - 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); + 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.showCenter(-1, -1, -1, -1, -1, -1); - me["Simple_C3B"].hide(); - me["Simple_C4B"].hide(); - me.showCenterS(-1, -1, -1, -1, -1, -1); + #me.showCenter(-1, -1, 1, -1, -1, -1); + #me.showCenterS(-1, -1, 1, -1, -1, -1); + #me["Simple_C3B"].hide(); + #me["Simple_C4B"].hide(); - me.fontLeft(default, 0, 0, 0, 0, default); - - me.fontSizeLeft(normal, 0, 0, 0, 0, normal); - - me.colorLeft("grn", "ack", "ack", "ack", "ack", "wht"); + #me.fontLeft(default, default, default, default, default, default); + #me.fontLeftS(default, default, default, default, default, default); + #me.fontSizeLeft(normal, normal, normal, normal, normal, normal); + me.fontSizeLeftS(normal, normal, normal, normal, normal, normal); + #me.fontRight(default, default, default, default, default, default); + #me.fontRightS(default, default, default, default, default, default); + me.fontSizeRight(0, small, small, small, small, normal); + me.fontSizeRightS(0, small, small, small, small, normal); + me.colorLeft("grn", "grn", "grn", "grn", "grn", "wht"); + me.colorLeftS("grn", "grn", "grn", "grn", "grn", "wht"); + #me.colorCenter("grn", "ack", "amb", "ack", "ack", "wht"); + me.colorRight("ack", "wht", "wht", "wht", "wht", "amb"); + me.colorRightS("ack", "wht", "wht", "wht", "wht", "wht"); + pageSwitch[i].setBoolValue(1); } me["Simple_L1"].setText("NONE"); me["Simple_L6"].setText(" RETURN"); + me["Simple_R6"].setText("INSERT "); + me["PRINTPAGE"].show(); + me["PRINTPAGE"].setColor(AMBER); + + var rows = ["2S","2","3S","3","4S","4","5S","5"]; + + me["Simple_L1"].setText("DUBLHR1"); + + var r = 0; + for ( ; r < 8; r += 1) { + me["Simple_L" ~ rows[r]].setText(sprintf("%11s %11s","SELKA","NUGRA")); + me["Simple_R" ~ rows[r]].setText(sprintf("%-13s %-13s","UL975","UL975")); + } + while (r<8) { + me["Simple_L" ~ rows[r]].setText(""); + me["Simple_R" ~ rows[r]].setText(""); + r+=1; + } if (fmgc.FMGCInternal.toFromSet and !fmgc.FMGCInternal.altSelected) { me["Simple_Title"].setText(sprintf("%s", fmgc.FMGCInternal.depApt ~ "/" ~ fmgc.FMGCInternal.arrApt)); @@ -3551,8 +3587,11 @@ var canvas_MCDU_base = { me["Simple_L6"].setFontSize(small); } - } else if (page == "PROGTO" or page == "PROGCLB" or page == "PROGCRZ" or page == "PROGDES") { - if (fmgc.FMGCInternal.phase == 0 or fmgc.FMGCInternal.phase == 1) { + } else if (page == "PROGPREF" or page == "PROGTO" or page == "PROGCLB" or page == "PROGCRZ" or page == "PROGDES") { + if (fmgc.FMGCInternal.phase == 0) { + setprop("/MCDU[" ~ i ~ "]/page", "PROGPREF"); + page = "PROGPREF"; + } else if (fmgc.FMGCInternal.phase == 1) { setprop("/MCDU[" ~ i ~ "]/page", "PROGTO"); page = "PROGTO"; } else if (fmgc.FMGCInternal.phase == 2) { @@ -3582,30 +3621,29 @@ var canvas_MCDU_base = { me["PERFAPPR"].hide(); me["PERFGA"].hide(); - if (fmgc.FMGCInternal.flightNumSet) { - if (page == "PROGTO") { - me["Simple_Title"].setText(sprintf("TAKE OFF %s", fmgc.FMGCInternal.flightNum)); - } else if (page == "PROGCLB") { - me["Simple_Title"].setText(sprintf("CLIMB %s", fmgc.FMGCInternal.flightNum)); - } else if (page == "PROGCRZ") { - me["Simple_Title"].setText(sprintf("CRUISE %s", fmgc.FMGCInternal.flightNum)); - } else if (page == "PROGDES") { - me["Simple_Title"].setText(sprintf("DESCENT %s", fmgc.FMGCInternal.flightNum)); - } - } else { - if (page == "PROGTO") { - me["Simple_Title"].setText("TAKE OFF"); - } else if (page == "PROGCLB") { - me["Simple_Title"].setText("CLIMB"); - } else if (page == "PROGCRZ") { - me["Simple_Title"].setText("CRUISE"); - } else if (page == "PROGDES") { - me["Simple_Title"].setText("DESCENT"); - } + var colortext = ["",""]; + + if (page == "PROGPREF") { + colortext[0] = "PREFLIGHT"; + } else if (page == "PROGTO") { + colortext[0] = "TAKE OFF"; + } else if (page == "PROGCLB") { + colortext[0] = "CLIMB"; + } else if (page == "PROGCRZ") { + colortext[0] = "CRUISE"; + } else if (page == "PROGDES") { + colortext[0] = "DESCENT"; } + + colortext[1] = (fmgc.FMGCInternal.flightNumSet) ? fmgc.FMGCInternal.flightNum ~ " " : ""; # push title a little left + + me["Simple_Title"].setText(colortext[0] ~ sprintf("%" ~ (size(colortext[1])+1) ~ "s"," ")); + me["Simple_Title2"].setText(sprintf("%" ~ (size(colortext[0])+1) ~ "s"," ") ~ colortext[1]); me["Simple_Title"].show(); me["Simple_Title"].setColor(GREEN); + me["Simple_Title2"].show(); + me["Simple_Title2"].setColor(WHITE); me["Simple_PageNum"].setText("X/X"); me["Simple_PageNum"].hide(); me["ArrowLeft"].hide(); @@ -3644,6 +3682,8 @@ var canvas_MCDU_base = { me.fontSizeCenter(small, small, small, small, small, normal); me.fontSizeCenterS(normal, small, small, small, small, small); + me["Simple_C1S"].setFontSize(small); + me.colorLeft("blu", "wht", "blu", "wht", "wht", "blu"); me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht"); diff --git a/Models/Instruments/MCDU/res/mcdu.svg b/Models/Instruments/MCDU/res/mcdu.svg index 9eb38288..ecda2737 100644 --- a/Models/Instruments/MCDU/res/mcdu.svg +++ b/Models/Instruments/MCDU/res/mcdu.svg @@ -12,7 +12,7 @@ viewBox="0 0 1024 864" version="1.1" id="svg2" - inkscape:version="0.92.4 (5da689c313, 2019-01-14)" + inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)" sodipodi:docname="mcdu.svg"> @@ -37,17 +37,17 @@ guidetolerance="20" inkscape:pageopacity="1" inkscape:pageshadow="2" - inkscape:window-width="1366" - inkscape:window-height="705" + inkscape:window-width="1920" + inkscape:window-height="1017" id="namedview371" showgrid="true" - inkscape:zoom="3.1578866" - inkscape:cx="1122.1906" - inkscape:cy="986.92422" + inkscape:zoom="0.55824076" + inkscape:cx="608.20261" + inkscape:cy="690.7315" inkscape:window-x="-8" inkscape:window-y="-8" inkscape:window-maximized="1" - inkscape:current-layer="svg2" + inkscape:current-layer="Simple" showguides="false" inkscape:snap-global="false" units="px" @@ -306,6 +306,19 @@ y="539.16522" style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:70px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1;stroke-width:1px">TEXT + TITLE + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> @@ -1103,7 +1116,7 @@ x="177.72771" style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#ffff00;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" xml:space="preserve"> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> @@ -1235,7 +1248,7 @@ inkscape:label="arrow5L" id="arrow5L"> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> @@ -2617,7 +2630,7 @@ id="tspan1088" x="478.87796" y="171.04486" - style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:63.99240112px;line-height:1.25;font-family:'Helvetica Medium';-inkscape-font-specification:'Helvetica Medium, Medium';text-align:start;text-anchor:start;fill:#ffffff;fill-opacity:1">= + style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:63.9924px;line-height:1.25;font-family:'Helvetica Medium';-inkscape-font-specification:'Helvetica Medium, Medium';text-align:start;text-anchor:start;fill:#ffffff;fill-opacity:1">= = + style="font-style:normal;font-variant:normal;font-weight:500;font-stretch:normal;font-size:63.9924px;line-height:1.25;font-family:'Helvetica Medium';-inkscape-font-specification:'Helvetica Medium, Medium';text-align:start;text-anchor:start;fill:#ffffff;fill-opacity:1">= @@ -3019,9 +3032,9 @@ inkscape:connector-curvature="0" id="path1273" d="M 998.71909,284.70793 H 970.18944" - style="fill:none;stroke:#179ab7;stroke-width:4.07999992;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#179ab7;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#179ab7;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#179ab7;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#179ab7;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> 0 and getprop("/FMGC/flightplan[2]/active") == 1 and flightPlanController.arrivalDist <= 15 and (modelat == "NAV" or modelat == "LOC" or modelat == "LOC*") and pts.Position.gearAglFt.getValue() < 9500) { #todo decel pseudo waypoint setprop("/FMGC/internal/decel", 1); diff --git a/Nasal/FMGC/SimbriefParser.nas b/Nasal/FMGC/SimbriefParser.nas index 1dc01602..541236bf 100644 --- a/Nasal/FMGC/SimbriefParser.nas +++ b/Nasal/FMGC/SimbriefParser.nas @@ -1,6 +1,6 @@ # A3XX Simbrief Parser # Copyright (c) 2020 Jonathan Redpath (legoboyvdlp) -# enhanceded 12/2020 - parse TOD & TOC psedo waypoints, set computer speeds on fix wps, fake coRoute name +# enhanced 12/2020 - parse TOD & TOC psedo waypoints, set computer speeds on fix wps, fake coRoute name var LBS2KGS = 0.4535924; @@ -14,7 +14,7 @@ var SimbriefParser = { me.inhibit = 1; var stamp = systime(); http.save("https://www.simbrief.com/api/xml.fetcher.php?username=" ~ username, getprop('/sim/fg-home') ~ "/Export/A320-family-simbrief.xml") - .fail(func me.failure(i)) + .fail(func { me.failure(i) }) .done(func { var errs = []; call(me.read, [(getprop('/sim/fg-home') ~ "/Export/A320-family-simbrief.xml"),i], SimbriefParser, {}, errs); @@ -49,6 +49,33 @@ var SimbriefParser = { me.failure(i); } }, + checkValid: func(xml) { + var data = io.readxml(xml); + if (data != nil) { + return (data.getChild("OFP") != nil); + } + return false; + }, + readLegs: func(xml) { # lite OFP parser only for legs = wapoinst + airways + var legs = []; + var data = io.readxml(xml); + if (data != nil) { + var ofp = data.getChild("OFP"); + if (ofp != nil) { + var ofpNavlog = ofp.getNode("navlog"); + var ofpFixes = ofpNavlog.getChildren("fix"); + var ident = ""; + foreach (var ofpFix; ofpFixes) { + if (ofpFix.getNode("is_sid_star").getBoolValue()) continue; + ident = ofpFix.getNode("ident").getValue(); + if (ident == "TOC" or ident == "TOD") continue; + append(legs, [ ofpFix.getNode("ident").getValue() , ofpFix.getNode("via_airway").getValue() ] ); + } + return legs; + } + } + return nil; + }, tryFindByCoord: func(coords, id, type) { var result = nil; if (type == "nav") { diff --git a/Nasal/MCDU/FLIGHTLOG.nas b/Nasal/MCDU/FLIGHTLOG.nas index d2127c8a..818dac51 100644 --- a/Nasal/MCDU/FLIGHTLOG.nas +++ b/Nasal/MCDU/FLIGHTLOG.nas @@ -2,12 +2,17 @@ # Basic OOOI system implementation var OOOIReport = { - new: func(state,fob="",time="") { + new: func(state,time=0,fob="") { 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")); + if (time != 0) { + report.time = formatSecToHHMM(time); + report.elapsed = time; + } else { + report.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 : "----"; @@ -47,8 +52,10 @@ var FlightLogDatabase = { if (report.state == 0 or me.getPageSize()==0) me.addPage(); me.database.append(report); var pg = me.pages.vector[me.pages.size()-1]; - pg.fltnum = report.fltnum; - pg.tofrom = report.tofrom; + if (report.state < 3) { # IN states (3/4) don't update page data + if (report.fltnum != "") pg.fltnum = report.fltnum; + if (report.tofrom != "") pg.tofrom = report.tofrom; + } if (report.state == 0) { pg.fltstate = "OUT"; pg.blkstart = report.elapsed; @@ -67,7 +74,8 @@ var FlightLogDatabase = { } }, reset: func() { - if (me.getPageSize()>0 and me.currpageindex < me.getSize()) me.addPage(); + #Actually reset occurs before IN state - I have no solution for this + #if (me.getPageSize()>0 and me.currpageindex < me.getSize()) me.addPage(); }, getSize: func() { return me.database.size(); @@ -118,7 +126,11 @@ var doorR1_pos = props.globals.getNode("/sim/model/door-positions/doorr1/positio 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 :/ +# Detect OFF without IN +var lastgs0 = 0; +var lastgsrestart = 0; + +# 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; @@ -129,9 +141,10 @@ var waitingOOOIChange = maketimer(1, func(){ # 1sec precision 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? + 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; + lastgear0 = 0; } } } else if (expectedOOOIState == 1) { # OFF @@ -149,14 +162,29 @@ var waitingOOOIChange = maketimer(1, func(){ # 1sec precision if (gear0 and (phase == 7 or phase == 0)) { #done or preflight FlightLogDatabase.addReport(OOOIReport.new(expectedOOOIState)); expectedOOOIState = 3; + lastgear0 = 0; + lastgsrestart = 0; } } else if (expectedOOOIState == 3) { # IN if (gear0 and gs < 1) { + if (lastgs0 == 0) { + lastgs0 = int(getprop("/sim/time/elapsed-sec")); + lastgsrestart = 0; + } 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; } } + else if (!gear0) { # OFF without IN -> To without stop and opening doors + if (lastgear0) FlightLogDatabase.addReport(OOOIReport.new(expectedOOOIState,lastgear0)); # IN (estimated) + FlightLogDatabase.addPage(); + if (lastgsrestart) FlightLogDatabase.addReport(OOOIReport.new(0,lastgsrestart)); # OUT (estimated) + expectedOOOIState = 1; # watch for OFF state + } + else if (gs > 9 and lastgsrestart == 0) { # try to decect OFF without IN + lastgsrestart = int(getprop("/sim/time/elapsed-sec")); + } } }); diff --git a/Nasal/MCDU/INITA.nas b/Nasal/MCDU/INITA.nas index 00e02637..e96f0df2 100644 --- a/Nasal/MCDU/INITA.nas +++ b/Nasal/MCDU/INITA.nas @@ -242,7 +242,7 @@ var initInputA = func(key, i) { #} else if (scratchpad == "") { #fmgc.FMGCInternal.altSelected = 0; #setprop("MCDU[" ~ i ~ "]/page", "ROUTESELECTION"); - } else { + } else { if (!fmgc.flightPlanController.temporaryFlag[i]) { var tfs = size(scratchpad); if (tfs == 9 and find("/", scratchpad) != -1) { diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 81a8b18d..d1fd839d 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -237,6 +237,8 @@ var lskbutton = func(btn, i) { canvas_mcdu.myCRZWIND[i].pushButtonLeft(1); } else if (page == "WINDDES") { canvas_mcdu.myDESWIND[i].pushButtonLeft(1); + } else if (page == "PROGPREF") { + progTOInput("L1",i); # same fn as TO } else if (page == "PROGTO") { progTOInput("L1",i); } else if (page == "PROGCLB") { @@ -1413,14 +1415,16 @@ var pagebutton = func(btn, i) { # 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); + else if (getprop("/MCDU[" ~ i ~ "]/active-system") == "atsu") 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") { - if (fmgc.FMGCInternal.phase == 0 or fmgc.FMGCInternal.phase == 1) { + if (fmgc.FMGCInternal.phase == 0) { + pageNode[i].setValue("PROGPREF"); + } else if (fmgc.FMGCInternal.phase == 1) { pageNode[i].setValue("PROGTO"); } else if (fmgc.FMGCInternal.phase == 2) { pageNode[i].setValue("PROGCLB"); diff --git a/Nasal/MCDU/ROUTESELECTION.nas b/Nasal/MCDU/ROUTESELECTION.nas index 85d1b464..d1b03bff 100644 --- a/Nasal/MCDU/ROUTESELECTION.nas +++ b/Nasal/MCDU/ROUTESELECTION.nas @@ -1,7 +1,22 @@ # Copyright (c) 2020 Matthew Maring (mattmaring) +# enhanced inuyaksa*2021 var initInputROUTESEL = func(key, i) { if (key == "L6") { setprop("MCDU[" ~ i ~ "]/page", "INITA"); } } + +var RouteSelManager = { + + leglist: nil, + + loadFlightplan: func(path) { + if (right(path,4) == ".xml") { # plan from SimBrief? + if (SimBrief.isValid(path)) { + leglist = SimBrief.readLegs(path); + } + } + } + +} \ No newline at end of file diff --git a/Sounds/A320-common-sound.xml b/Sounds/A320-common-sound.xml index 26000189..7029c503 100644 --- a/Sounds/A320-common-sound.xml +++ b/Sounds/A320-common-sound.xml @@ -2137,14 +2137,38 @@ - - /fdm/jsbsim/fcs/left-brake-cmd-norm - 0.95 - - - /fdm/jsbsim/fcs/right-brake-cmd-norm - 0.95 - + + + /fdm/jsbsim/fcs/left-brake-cmd-norm + 0.95 + + + + /gear/gear[0]/wow + 1 + + + /gear/gear[1]/wow + 1 + + + + + + /fdm/jsbsim/fcs/right-brake-cmd-norm + 0.95 + + + + /gear/gear[0]/wow + 1 + + + /gear/gear[2]/wow + 1 + + + /velocities/groundspeed-kt