From b678cef6c87079983b23c5570cc7a48aeb41b803 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Sun, 31 May 2020 10:05:44 -0400 Subject: [PATCH 01/53] Skeleton code for winds --- A320-main.xml | 4 + Models/Instruments/MCDU/MCDU.nas | 102 ++++++++++++++++++++++++++ Nasal/MCDU/INITA.nas | 7 ++ Nasal/MCDU/MCDU.nas | 6 +- Nasal/MCDU/WINDCLB.nas | 122 +++++++++++++++++++++++++++++++ Nasal/MCDU/WINDCRZ.nas | 87 ++++++++++++++++++++++ Nasal/MCDU/WINDDES.nas | 97 ++++++++++++++++++++++++ Nasal/MCDU/WINDHIST.nas | 97 ++++++++++++++++++++++++ 8 files changed, 520 insertions(+), 2 deletions(-) create mode 100644 Nasal/MCDU/WINDCLB.nas create mode 100644 Nasal/MCDU/WINDCRZ.nas create mode 100644 Nasal/MCDU/WINDDES.nas create mode 100644 Nasal/MCDU/WINDHIST.nas diff --git a/A320-main.xml b/A320-main.xml index f0a86be2..b4712a4c 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -4053,6 +4053,10 @@ Aircraft/A320-family/Nasal/MCDU/PILOTWAYPOINT.nas Aircraft/A320-family/Nasal/MCDU/HOLD.nas Aircraft/A320-family/Nasal/MCDU/F-PLN.nas + Aircraft/A320-family/Nasal/MCDU/WINDCLB.nas + 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/MCDU.nas Aircraft/A320-family/Nasal/MCDU/INITA.nas Aircraft/A320-family/Nasal/MCDU/IRSINIT.nas diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index 845e3f98..eafee83e 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -18,6 +18,7 @@ var myAirways = [nil, nil]; var myDuplicate = [nil, nil]; var myClosestAirport = [nil, nil]; var myPilotWP = [nil, nil]; +var myCLBWIND = [nil, nil]; var default = "BoeingCDU-Large.ttf"; var symbol = "helvetica_medium.txf"; var normal = 70; @@ -3137,6 +3138,107 @@ var canvas_MCDU_base = { me["Simple_C1S"].setText("FLP RETR"); me["Simple_C2S"].setText("SLT RETR"); me["Simple_C3S"].setText("CLEAN "); + } else if (page == "WINDCLB") { + if (!pageSwitch[i].getBoolValue()) { + me["Simple"].show(); + me["Simple_Center"].hide(); + me["FPLN"].hide(); + me["DIRTO_TMPY_group"].hide(); + me["INITA"].hide(); + me["IRSINIT"].hide(); + me["INITB"].hide(); + me["FUELPRED"].hide(); + me["PROG"].hide(); + me["PERFTO"].hide(); + me["arrowsDepArr"].hide(); + me["Simple_PageNum"].setText("X/X"); + me["Simple_PageNum"].hide(); + me["Simple_Title"].show(); + me["ArrowLeft"].hide(); + me["ArrowRight"].hide(); + + me["Simple_L0S"].hide(); + me["Simple_C3B"].hide(); + me["Simple_C4B"].hide(); + + me.fontLeft(default, default, default, default, default, default); + me.fontLeftS(default, default, default, default, default, default); + 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.fontSizeRight(normal, normal, normal, normal, normal, normal); + + me.colorLeftS("wht", "wht", "wht", "wht", "wht", "amb"); + #me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorRightS("wht", "wht", "amb", "wht", "wht", "amb"); + #me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht"); + + if (myCLBWIND[i] != nil) { + me["Simple_Title"].setText(sprintf("%s", myCLBWIND[i].title)); + + forindex (var matrixArrow; myCLBWIND[i].arrowsMatrix) { + if (matrixArrow == 0) { + var sign = "L"; + } else { + var sign = "R"; + } + forindex (var item; myCLBWIND[i].arrowsMatrix[matrixArrow]) { + if (myCLBWIND[i].arrowsMatrix[matrixArrow][item] == 1) { + me["Simple_" ~ sign ~ (item + 1) ~ "_Arrow"].show(); + } else { + me["Simple_" ~ sign ~ (item + 1) ~ "_Arrow"].hide(); + } + } + } + me.colorLeftArrow(myCLBWIND[i].arrowsColour[0][0],myCLBWIND[i].arrowsColour[0][1],myCLBWIND[i].arrowsColour[0][2],myCLBWIND[i].arrowsColour[0][3],myCLBWIND[i].arrowsColour[0][4],myCLBWIND[i].arrowsColour[0][5]); + + forindex (var matrixFont; myCLBWIND[i].fontMatrix) { + if (matrixFont == 0) { + var sign = "L"; + } else { + var sign = "R"; + } + forindex (var item; myCLBWIND[i].fontMatrix[matrixFont]) { + if (myCLBWIND[i].fontMatrix[matrixFont][item] == 1) { + me["Simple_" ~ sign ~ (item + 1)].setFont(symbol); + me["Simple_" ~ sign ~ (item + 1)].setFontSize(small); + } else { + me["Simple_" ~ sign ~ (item + 1)].setFont(default); + me["Simple_" ~ sign ~ (item + 1)].setFontSize(normal); + } + } + } + + me.dynamicPageFunc(myCLBWIND[i].L1, "Simple_L1"); + me.dynamicPageFunc(myCLBWIND[i].L2, "Simple_L2"); + me.dynamicPageFunc(myCLBWIND[i].L3, "Simple_L3"); + me.dynamicPageFunc(myCLBWIND[i].L4, "Simple_L4"); + me.dynamicPageFunc(myCLBWIND[i].L5, "Simple_L5"); + me.dynamicPageFunc(myCLBWIND[i].L6, "Simple_L6"); + + me.colorLeft(myCLBWIND[i].L1[2],myCLBWIND[i].L2[2],myCLBWIND[i].L3[2],myCLBWIND[i].L4[2],myCLBWIND[i].L5[2],myCLBWIND[i].L6[2]); + + # me.dynamicPageFunc(myCLBWIND[i].C1, "Simple_C1"); +# me.dynamicPageFunc(myCLBWIND[i].C2, "Simple_C2"); +# me.dynamicPageFunc(myCLBWIND[i].C3, "Simple_C3"); +# me.dynamicPageFunc(myCLBWIND[i].C4, "Simple_C4"); +# me.dynamicPageFunc(myCLBWIND[i].C5, "Simple_C5"); +# me.dynamicPageFunc(myCLBWIND[i].C6, "Simple_C6"); +# +# me.colorCenter(myCLBWIND[i].C1[2],myCLBWIND[i].C2[2],myCLBWIND[i].C3[2],myCLBWIND[i].C4[2],myCLBWIND[i].C5[2],myCLBWIND[i].C6[2]); + + me.dynamicPageFunc(myCLBWIND[i].R1, "Simple_R1"); + me.dynamicPageFunc(myCLBWIND[i].R2, "Simple_R2"); + me.dynamicPageFunc(myCLBWIND[i].R3, "Simple_R3"); + me.dynamicPageFunc(myCLBWIND[i].R4, "Simple_R4"); + me.dynamicPageFunc(myCLBWIND[i].R5, "Simple_R5"); + me.dynamicPageFunc(myCLBWIND[i].R6, "Simple_R6"); + + me.colorRight(myCLBWIND[i].R1[2],myCLBWIND[i].R2[2],myCLBWIND[i].R3[2],myCLBWIND[i].R4[2],myCLBWIND[i].R5[2],myCLBWIND[i].R6[2]); + } + pageSwitch[i].setBoolValue(1); + } } else if (page == "LATREV") { if (!pageSwitch[i].getBoolValue()) { me["Simple"].show(); diff --git a/Nasal/MCDU/INITA.nas b/Nasal/MCDU/INITA.nas index 2fb0d757..e5bc7490 100644 --- a/Nasal/MCDU/INITA.nas +++ b/Nasal/MCDU/INITA.nas @@ -222,6 +222,13 @@ var initInputA = func(key, i) { } } else if (key == "R3") { setprop("MCDU[" ~ i ~ "]/page", "IRSINIT"); + } else if (key == "R4") { + if (canvas_mcdu.myCLBWIND[i] != nil) { + canvas_mcdu.myCLBWIND[i].del(); + } + canvas_mcdu.myCLBWIND[i] = nil; + canvas_mcdu.myCLBWIND[i] = windCLBPage.new(i); + setprop("MCDU[" ~ i ~ "]/page", "WINDCLB"); } else if (key == "R5") { if (scratchpad == "CLR") { setprop("/FMGC/internal/tropo", 36090); diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 8eaf94a8..63e3b209 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -473,7 +473,7 @@ var rskbutton = func(btn, i) { } canvas_mcdu.myPilotWP[i] = nil; canvas_mcdu.myPilotWP[i] = pilotWaypointPage.new(i); - setprop("/MCDU[" ~ i ~ "]/page", "PILOTWP"); + setprop("/MCDU[" ~ i ~ "]/page", "PILOTWP"); } else { mcdu_message(i, "NOT ALLOWED"); # todo spawn new waypoints page } @@ -531,7 +531,9 @@ var rskbutton = func(btn, i) { mcdu_message(i, "NOT ALLOWED"); } } else if (btn == "4") { - if (getprop("/MCDU[" ~ i ~ "]/page") == "FUELPRED") { + if (getprop("/MCDU[" ~ i ~ "]/page") == "INITA") { + initInputA("R4",i); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "FUELPRED") { fuelPredInput("R4",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") { perfTOInput("R4",i); diff --git a/Nasal/MCDU/WINDCLB.nas b/Nasal/MCDU/WINDCLB.nas new file mode 100644 index 00000000..1517bdb3 --- /dev/null +++ b/Nasal/MCDU/WINDCLB.nas @@ -0,0 +1,122 @@ +# A3XX mCDU by Joshua Davidson (Octal450), Jonathan Redpath, and Matthew Maring (mattmaring) + +# Copyright (c) 2020 Matthew Maring (mattmaring) + +var windCLBPage = { + title: nil, + fontMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]], + arrowsMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]], + arrowsColour: [["ack", "ack", "ack", "ack", "ack", "ack"],["ack", "ack", "ack", "ack", "ack", "ack"]], + L1: [nil, nil, "ack"], # content, title, colour + L2: [nil, nil, "ack"], + L3: [nil, nil, "ack"], + L4: [nil, nil, "ack"], + L5: [nil, nil, "ack"], + L6: [nil, nil, "ack"], + C1: [nil, nil, "ack"], + C2: [nil, nil, "ack"], + C3: [nil, nil, "ack"], + C4: [nil, nil, "ack"], + C5: [nil, nil, "ack"], + C6: [nil, nil, "ack"], + R1: [nil, nil, "ack"], + R2: [nil, nil, "ack"], + R3: [nil, nil, "ack"], + R4: [nil, nil, "ack"], + R5: [nil, nil, "ack"], + R6: [nil, nil, "ack"], + scroll: 0, + vector: [], + index: nil, + computer: nil, + windList: [], + new: func(computer) { + var wcp = {parents:[windCLBPage]}; + wcp.computer = computer; + wcp.windList = [nil]; + wcp._setupPageWithData(); + wcp.updateTmpy(); + return wcp; + }, + del: func() { + return nil; + }, + _setupPageWithData: func() { + me.title = "CLIMB WIND"; + #me.title = "DRAFT CLIMB WIND"; + me.titleColour = "wht"; + + if (size(me.windList) >= 5) { + me.L5 = ["[ ]/[ ]/[ ]", "", "blu"]; + } else { + me.L5 = [nil, nil, "ack"]; + } + + if (size(me.windList) >= 4) { + me.L4 = ["[ ]/[ ]/[ ]", "", "blu"]; + } else { + me.L4 = [nil, nil, "ack"]; + } + + if (size(me.windList) >= 3) { + me.L3 = ["[ ]/[ ]/[ ]", "", "blu"]; + } else { + me.L3 = [nil, nil, "ack"]; + } + + if (size(me.windList) >= 2) { + me.L2 = ["[ ]/[ ]/[ ]", "", "blu"]; + } else { + me.L2 = [nil, nil, "ack"]; + } + + if (size(me.windList) >= 1) { + me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"]; + } + + me.L6 = [" CANCEL", " WIND", "amb"]; + me.R1 = [" HISTORY ", "WIND ", "wht"]; + me.R3 = [" REQUEST ", "WIND ", "amb"]; + me.R5 = [" PHASE ", "NEXT ", "wht"]; + me.R6 = ["UPDATE ", "WIND ", "amb"]; +# me.L2 = [" R", " TURN", "blu"]; +# if (pts.Instrumentation.Altimeter.indicatedFt.getValue() >= 14000) { +# me.L2 = [" 1.5/----", "TIME/DIST", "blu"]; +# } else { +# me.L2 = [" 1.0/----", "TIME/DIST", "blu"]; +# } +# me.L6 = [" RETURN", nil, "wht"]; +# me.C4 = ["LAST EXIT", nil, "wht"]; +# me.C5 = ["---- ---.-", "UTC FUEL", "wht"]; +# me.R1 = ["COMPUTED ", nil, "wht"]; +# me.R2 = ["DATABASE ", nil, "wht"]; + me.arrowsMatrix = [[0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 1, 0]]; + me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "ack"], ["wht", "ack", "ack", "ack", "wht", "ack"]]; + me.fontMatrix = [[1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0]]; + canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); + }, + makeTmpy: func() { + if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { + fmgc.flightPlanController.createTemporaryFlightPlan(me.computer); + } + }, + updateTmpy: func() { + if (fmgc.flightPlanController.temporaryFlag[me.computer]) { + #me.L1[2] = "yel"; + #me.L2[2] = "yel"; + #me.L6 = [" F-PLN", " TMPY", "yel"]; + #me.R6 = ["INSERT* ", " TMPY", "yel"]; + #me.arrowsColour[0][5] = "yel"; + #me.titleColour = "yel"; + canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); + } else { + #me.L1[2] = "blu"; + #me.L2[2] = "blu"; + #me.L6 = [" RETURN", nil, "wht"]; + #me.R6 = [nil, nil, "ack"]; + #me.arrowsColour[0][5] = "wht"; + #me.titleColour = "wht"; + canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); + } + } +}; \ No newline at end of file diff --git a/Nasal/MCDU/WINDCRZ.nas b/Nasal/MCDU/WINDCRZ.nas new file mode 100644 index 00000000..ae181970 --- /dev/null +++ b/Nasal/MCDU/WINDCRZ.nas @@ -0,0 +1,87 @@ +# A3XX mCDU by Joshua Davidson (Octal450), Jonathan Redpath, and Matthew Maring (mattmaring) + +# Copyright (c) 2020 Matthew Maring (mattmaring) + +var windCRZPage = { + title: [nil, nil, nil], + fontMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]], + arrowsMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]], + arrowsColour: [["ack", "ack", "ack", "ack", "ack", "ack"],["ack", "ack", "ack", "ack", "ack", "ack"]], + L1: [nil, nil, "ack"], # content, title, colour + L2: [nil, nil, "ack"], + L3: [nil, nil, "ack"], + L4: [nil, nil, "ack"], + L5: [nil, nil, "ack"], + L6: [nil, nil, "ack"], + C1: [nil, nil, "ack"], + C2: [nil, nil, "ack"], + C3: [nil, nil, "ack"], + C4: [nil, nil, "ack"], + C5: [nil, nil, "ack"], + C6: [nil, nil, "ack"], + R1: [nil, nil, "ack"], + R2: [nil, nil, "ack"], + R3: [nil, nil, "ack"], + R4: [nil, nil, "ack"], + R5: [nil, nil, "ack"], + R6: [nil, nil, "ack"], + scroll: 0, + vector: [], + index: nil, + computer: nil, + new: func(computer, waypoint) { + var wcp = {parents:[windCRZPage]}; + wcp.computer = computer; + wcp.waypoint = waypoint; + wcp._setupPageWithData(); + wcp.updateTmpy(); + return wcp; + }, + del: func() { + return nil; + }, + _setupPageWithData: func() { + me.title = ["CRZ WIND", " AT ", me.waypoint.wp_name]; + me.titleColour = "wht"; + # me.L1 = [" [ ]", "INB CRS", "blu"]; +# me.L2 = [" R", " TURN", "blu"]; +# if (pts.Instrumentation.Altimeter.indicatedFt.getValue() >= 14000) { +# me.L2 = [" 1.5/----", "TIME/DIST", "blu"]; +# } else { +# me.L2 = [" 1.0/----", "TIME/DIST", "blu"]; +# } +# me.L6 = [" RETURN", nil, "wht"]; +# me.C4 = ["LAST EXIT", nil, "wht"]; +# me.C5 = ["---- ---.-", "UTC FUEL", "wht"]; +# me.R1 = ["COMPUTED ", nil, "wht"]; +# me.R2 = ["DATABASE ", nil, "wht"]; + me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [1, 1, 0, 0, 0, 0]]; + me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["wht", "wht", "ack", "ack", "ack", "ack"]]; + me.fontMatrix = [[1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]; + canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); + }, + makeTmpy: func() { + if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { + fmgc.flightPlanController.createTemporaryFlightPlan(me.computer); + } + }, + updateTmpy: func() { + if (fmgc.flightPlanController.temporaryFlag[me.computer]) { + me.L1[2] = "yel"; + me.L2[2] = "yel"; + me.L6 = [" F-PLN", " TMPY", "yel"]; + me.R6 = ["INSERT* ", " TMPY", "yel"]; + me.arrowsColour[0][5] = "yel"; + me.titleColour = "yel"; + canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); + } else { + me.L1[2] = "blu"; + me.L2[2] = "blu"; + me.L6 = [" RETURN", nil, "wht"]; + me.R6 = [nil, nil, "ack"]; + me.arrowsColour[0][5] = "wht"; + me.titleColour = "wht"; + canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); + } + } +}; \ No newline at end of file diff --git a/Nasal/MCDU/WINDDES.nas b/Nasal/MCDU/WINDDES.nas new file mode 100644 index 00000000..145eb02c --- /dev/null +++ b/Nasal/MCDU/WINDDES.nas @@ -0,0 +1,97 @@ +# A3XX mCDU by Joshua Davidson (Octal450), Jonathan Redpath, and Matthew Maring (mattmaring) + +# Copyright (c) 2020 Matthew Maring (mattmaring) + +var windDESPage = { + title: nil, + fontMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]], + arrowsMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]], + arrowsColour: [["ack", "ack", "ack", "ack", "ack", "ack"],["ack", "ack", "ack", "ack", "ack", "ack"]], + L1: [nil, nil, "ack"], # content, title, colour + L2: [nil, nil, "ack"], + L3: [nil, nil, "ack"], + L4: [nil, nil, "ack"], + L5: [nil, nil, "ack"], + L6: [nil, nil, "ack"], + C1: [nil, nil, "ack"], + C2: [nil, nil, "ack"], + C3: [nil, nil, "ack"], + C4: [nil, nil, "ack"], + C5: [nil, nil, "ack"], + C6: [nil, nil, "ack"], + R1: [nil, nil, "ack"], + R2: [nil, nil, "ack"], + R3: [nil, nil, "ack"], + R4: [nil, nil, "ack"], + R5: [nil, nil, "ack"], + R6: [nil, nil, "ack"], + scroll: 0, + vector: [], + index: nil, + computer: nil, + new: func(computer) { + var wdp = {parents:[windDESPage]}; + wdp.computer = computer; + wdp._setupPageWithData(); + wdp.updateTmpy(); + return wdp; + }, + del: func() { + return nil; + }, + _setupPageWithData: func() { + me.title = "DESCENT WIND"; + #me.title = "DRAFT DESCENT WIND"; + me.titleColour = "wht"; + me.L1 = ["[ ]g/[ ]/FL---", "TRU WIND/ALT", "blu"]; + me.L2 = ["[ ]g/[ ]/FL200", "", "blu"]; + me.L3 = ["[ ]g/[ ]/FL100", "", "blu"]; + me.L4 = ["[ ]g/[ ]/FL050", "", "blu"]; + me.L5 = ["[ ]g/[ ]/GRND", "", "blu"]; + me.L6 = [" CANCEL", " WIND", "amb"]; + me.R1 = ["[ ]g/[ ]", "WIND ", "blu"]; + me.R2 = ["", "FL---", "grn"]; + me.R3 = [" REQUEST ", "WIND ", "wht"]; + me.R4 = [" PHASE ", "PREV ", "wht"]; + me.R6 = ["UPDATE ", "WIND ", "amb"]; +# me.L2 = [" R", " TURN", "blu"]; +# if (pts.Instrumentation.Altimeter.indicatedFt.getValue() >= 14000) { +# me.L2 = [" 1.5/----", "TIME/DIST", "blu"]; +# } else { +# me.L2 = [" 1.0/----", "TIME/DIST", "blu"]; +# } +# me.L6 = [" RETURN", nil, "wht"]; +# me.C4 = ["LAST EXIT", nil, "wht"]; +# me.C5 = ["---- ---.-", "UTC FUEL", "wht"]; +# me.R1 = ["COMPUTED ", nil, "wht"]; +# me.R2 = ["DATABASE ", nil, "wht"]; + me.arrowsMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0]]; + me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "ack"], ["ack", "ack", "ack", "wht", "ack", "ack"]]; + me.fontMatrix = [[1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]; + canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); + }, + makeTmpy: func() { + # if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { +# fmgc.flightPlanController.createTemporaryFlightPlan(me.computer); +# } + }, + updateTmpy: func() { + # if (fmgc.flightPlanController.temporaryFlag[me.computer]) { +# me.L1[2] = "yel"; +# me.L2[2] = "yel"; +# me.L6 = [" F-PLN", " TMPY", "yel"]; +# me.R6 = ["INSERT* ", " TMPY", "yel"]; +# me.arrowsColour[0][5] = "yel"; +# me.titleColour = "yel"; +# canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); +# } else { +# me.L1[2] = "blu"; +# me.L2[2] = "blu"; +# me.L6 = [" RETURN", nil, "wht"]; +# me.R6 = [nil, nil, "ack"]; +# me.arrowsColour[0][5] = "wht"; +# me.titleColour = "wht"; +# canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); +# } + } +}; \ No newline at end of file diff --git a/Nasal/MCDU/WINDHIST.nas b/Nasal/MCDU/WINDHIST.nas new file mode 100644 index 00000000..5142ee02 --- /dev/null +++ b/Nasal/MCDU/WINDHIST.nas @@ -0,0 +1,97 @@ +# A3XX mCDU by Joshua Davidson (Octal450), Jonathan Redpath, and Matthew Maring (mattmaring) + +# Copyright (c) 2020 Matthew Maring (mattmaring) + +var windHistPage = { + title: nil, + fontMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]], + arrowsMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]], + arrowsColour: [["ack", "ack", "ack", "ack", "ack", "ack"],["ack", "ack", "ack", "ack", "ack", "ack"]], + L1: [nil, nil, "ack"], # content, title, colour + L2: [nil, nil, "ack"], + L3: [nil, nil, "ack"], + L4: [nil, nil, "ack"], + L5: [nil, nil, "ack"], + L6: [nil, nil, "ack"], + C1: [nil, nil, "ack"], + C2: [nil, nil, "ack"], + C3: [nil, nil, "ack"], + C4: [nil, nil, "ack"], + C5: [nil, nil, "ack"], + C6: [nil, nil, "ack"], + R1: [nil, nil, "ack"], + R2: [nil, nil, "ack"], + R3: [nil, nil, "ack"], + R4: [nil, nil, "ack"], + R5: [nil, nil, "ack"], + R6: [nil, nil, "ack"], + scroll: 0, + vector: [], + index: nil, + computer: nil, + new: func(computer) { + var whp = {parents:[windHistPage]}; + whp.computer = computer; + whp._setupPageWithData(); + #whp.updateTmpy(); + return whp; + }, + del: func() { + return nil; + }, + _setupPageWithData: func() { + me.title = "HISTROY WIND"; + me.titleColour = "wht"; + me.L1 = ["----g/---", "", "blu"]; + me.L2 = ["----g/---", "", "blu"]; + me.L3 = ["----g/---", "", "blu"]; + me.L4 = ["----g/---", "", "blu"]; + me.L5 = ["----g/---", "", "blu"]; + me.L6 = [" CLIMB WIND", "", "wht"]; + me.C1 = ["FL050", "", "blu"]; + me.C2 = ["FL150", "", "blu"]; + me.C3 = ["FL250", "", "blu"]; + me.C4 = ["FL---", "", "blu"]; + me.C5 = ["FL370", "", "blu"]; + me.R6 = ["SELECT ", "", "amb"]; +# me.L2 = [" R", " TURN", "blu"]; +# if (pts.Instrumentation.Altimeter.indicatedFt.getValue() >= 14000) { +# me.L2 = [" 1.5/----", "TIME/DIST", "blu"]; +# } else { +# me.L2 = [" 1.0/----", "TIME/DIST", "blu"]; +# } +# me.L6 = [" RETURN", nil, "wht"]; +# me.C4 = ["LAST EXIT", nil, "wht"]; +# me.C5 = ["---- ---.-", "UTC FUEL", "wht"]; +# me.R1 = ["COMPUTED ", nil, "wht"]; +# me.R2 = ["DATABASE ", nil, "wht"]; + me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0]]; + me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["ack", "ack", "ack", "ack", "ack", "ack"]]; + me.fontMatrix = [[1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 1]]; + canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); + }, + makeTmpy: func() { + # if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { +# fmgc.flightPlanController.createTemporaryFlightPlan(me.computer); +# } + }, + updateTmpy: func() { + # if (fmgc.flightPlanController.temporaryFlag[me.computer]) { +# me.L1[2] = "yel"; +# me.L2[2] = "yel"; +# me.L6 = [" F-PLN", " TMPY", "yel"]; +# me.R6 = ["INSERT* ", " TMPY", "yel"]; +# me.arrowsColour[0][5] = "yel"; +# me.titleColour = "yel"; +# canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); +# } else { +# me.L1[2] = "blu"; +# me.L2[2] = "blu"; +# me.L6 = [" RETURN", nil, "wht"]; +# me.R6 = [nil, nil, "ack"]; +# me.arrowsColour[0][5] = "wht"; +# me.titleColour = "wht"; +# canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); +# } + } +}; \ No newline at end of file From ba70ec718721759609b4ceccebb8c8261d3604a2 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Sun, 31 May 2020 10:30:33 -0400 Subject: [PATCH 02/53] History wind, implement generic wind --- Models/Instruments/MCDU/MCDU.nas | 94 +++++++++++++++++++------------- Nasal/MCDU/MCDU.nas | 14 +++++ Nasal/MCDU/WINDHIST.nas | 16 +++--- 3 files changed, 79 insertions(+), 45 deletions(-) diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index eafee83e..987ae462 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -18,7 +18,11 @@ var myAirways = [nil, nil]; var myDuplicate = [nil, nil]; var myClosestAirport = [nil, nil]; var myPilotWP = [nil, nil]; +var myWind = [nil, nil]; var myCLBWIND = [nil, nil]; +var myCRZWIND = [nil, nil]; +var myDESWIND = [nil, nil]; +var myHISTWIND = [nil, nil]; var default = "BoeingCDU-Large.ttf"; var symbol = "helvetica_medium.txf"; var normal = 70; @@ -3138,10 +3142,10 @@ var canvas_MCDU_base = { me["Simple_C1S"].setText("FLP RETR"); me["Simple_C2S"].setText("SLT RETR"); me["Simple_C3S"].setText("CLEAN "); - } else if (page == "WINDCLB") { + } else if (page == "WINDCLB" or page == "WINDCRZ" or page == "WINDDES" or page == "WINDHIST") { if (!pageSwitch[i].getBoolValue()) { me["Simple"].show(); - me["Simple_Center"].hide(); + me["Simple_Center"].show(); me["FPLN"].hide(); me["DIRTO_TMPY_group"].hide(); me["INITA"].hide(); @@ -3169,38 +3173,54 @@ var canvas_MCDU_base = { me.fontSizeLeft(normal, normal, normal, normal, normal, normal); me.fontSizeRight(normal, normal, normal, normal, normal, normal); - me.colorLeftS("wht", "wht", "wht", "wht", "wht", "amb"); - #me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorRightS("wht", "wht", "amb", "wht", "wht", "amb"); - #me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht"); - if (myCLBWIND[i] != nil) { - me["Simple_Title"].setText(sprintf("%s", myCLBWIND[i].title)); + if (page == "WINDCLB") { + myWind = myCLBWIND; + me.colorLeftS("wht", "wht", "wht", "wht", "wht", "amb"); + me.colorRightS("wht", "wht", "amb", "wht", "wht", "amb"); + } else if (page == "WINDCRZ") { + myWind = myCRZWIND; + me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht"); + } else if (page == "WINDDES") { + myWind = myDESWIND; + me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht"); + } else if (page == "WINDHIST") { + myWind = myHISTWIND; + me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht"); + } + + if (myWind[i] != nil) { + me["Simple_Title"].setText(sprintf("%s", myWind[i].title)); - forindex (var matrixArrow; myCLBWIND[i].arrowsMatrix) { + forindex (var matrixArrow; myWind[i].arrowsMatrix) { if (matrixArrow == 0) { var sign = "L"; } else { var sign = "R"; } - forindex (var item; myCLBWIND[i].arrowsMatrix[matrixArrow]) { - if (myCLBWIND[i].arrowsMatrix[matrixArrow][item] == 1) { + forindex (var item; myWind[i].arrowsMatrix[matrixArrow]) { + if (myWind[i].arrowsMatrix[matrixArrow][item] == 1) { me["Simple_" ~ sign ~ (item + 1) ~ "_Arrow"].show(); } else { me["Simple_" ~ sign ~ (item + 1) ~ "_Arrow"].hide(); } } } - me.colorLeftArrow(myCLBWIND[i].arrowsColour[0][0],myCLBWIND[i].arrowsColour[0][1],myCLBWIND[i].arrowsColour[0][2],myCLBWIND[i].arrowsColour[0][3],myCLBWIND[i].arrowsColour[0][4],myCLBWIND[i].arrowsColour[0][5]); + me.colorLeftArrow(myWind[i].arrowsColour[0][0],myWind[i].arrowsColour[0][1],myWind[i].arrowsColour[0][2],myWind[i].arrowsColour[0][3],myWind[i].arrowsColour[0][4],myWind[i].arrowsColour[0][5]); - forindex (var matrixFont; myCLBWIND[i].fontMatrix) { + forindex (var matrixFont; myWind[i].fontMatrix) { if (matrixFont == 0) { var sign = "L"; } else { var sign = "R"; } - forindex (var item; myCLBWIND[i].fontMatrix[matrixFont]) { - if (myCLBWIND[i].fontMatrix[matrixFont][item] == 1) { + forindex (var item; myWind[i].fontMatrix[matrixFont]) { + if (myWind[i].fontMatrix[matrixFont][item] == 1) { me["Simple_" ~ sign ~ (item + 1)].setFont(symbol); me["Simple_" ~ sign ~ (item + 1)].setFontSize(small); } else { @@ -3210,32 +3230,32 @@ var canvas_MCDU_base = { } } - me.dynamicPageFunc(myCLBWIND[i].L1, "Simple_L1"); - me.dynamicPageFunc(myCLBWIND[i].L2, "Simple_L2"); - me.dynamicPageFunc(myCLBWIND[i].L3, "Simple_L3"); - me.dynamicPageFunc(myCLBWIND[i].L4, "Simple_L4"); - me.dynamicPageFunc(myCLBWIND[i].L5, "Simple_L5"); - me.dynamicPageFunc(myCLBWIND[i].L6, "Simple_L6"); + me.dynamicPageFunc(myWind[i].L1, "Simple_L1"); + me.dynamicPageFunc(myWind[i].L2, "Simple_L2"); + me.dynamicPageFunc(myWind[i].L3, "Simple_L3"); + me.dynamicPageFunc(myWind[i].L4, "Simple_L4"); + me.dynamicPageFunc(myWind[i].L5, "Simple_L5"); + me.dynamicPageFunc(myWind[i].L6, "Simple_L6"); - me.colorLeft(myCLBWIND[i].L1[2],myCLBWIND[i].L2[2],myCLBWIND[i].L3[2],myCLBWIND[i].L4[2],myCLBWIND[i].L5[2],myCLBWIND[i].L6[2]); + me.colorLeft(myWind[i].L1[2],myWind[i].L2[2],myWind[i].L3[2],myWind[i].L4[2],myWind[i].L5[2],myWind[i].L6[2]); - # me.dynamicPageFunc(myCLBWIND[i].C1, "Simple_C1"); -# me.dynamicPageFunc(myCLBWIND[i].C2, "Simple_C2"); -# me.dynamicPageFunc(myCLBWIND[i].C3, "Simple_C3"); -# me.dynamicPageFunc(myCLBWIND[i].C4, "Simple_C4"); -# me.dynamicPageFunc(myCLBWIND[i].C5, "Simple_C5"); -# me.dynamicPageFunc(myCLBWIND[i].C6, "Simple_C6"); -# -# me.colorCenter(myCLBWIND[i].C1[2],myCLBWIND[i].C2[2],myCLBWIND[i].C3[2],myCLBWIND[i].C4[2],myCLBWIND[i].C5[2],myCLBWIND[i].C6[2]); + me.dynamicPageFunc(myWind[i].C1, "Simple_C1"); + me.dynamicPageFunc(myWind[i].C2, "Simple_C2"); + me.dynamicPageFunc(myWind[i].C3, "Simple_C3"); + me.dynamicPageFunc(myWind[i].C4, "Simple_C4"); + me.dynamicPageFunc(myWind[i].C5, "Simple_C5"); + me.dynamicPageFunc(myWind[i].C6, "Simple_C6"); - me.dynamicPageFunc(myCLBWIND[i].R1, "Simple_R1"); - me.dynamicPageFunc(myCLBWIND[i].R2, "Simple_R2"); - me.dynamicPageFunc(myCLBWIND[i].R3, "Simple_R3"); - me.dynamicPageFunc(myCLBWIND[i].R4, "Simple_R4"); - me.dynamicPageFunc(myCLBWIND[i].R5, "Simple_R5"); - me.dynamicPageFunc(myCLBWIND[i].R6, "Simple_R6"); + me.colorCenter(myWind[i].C1[2],myWind[i].C2[2],myWind[i].C3[2],myWind[i].C4[2],myWind[i].C5[2],myWind[i].C6[2]); - me.colorRight(myCLBWIND[i].R1[2],myCLBWIND[i].R2[2],myCLBWIND[i].R3[2],myCLBWIND[i].R4[2],myCLBWIND[i].R5[2],myCLBWIND[i].R6[2]); + me.dynamicPageFunc(myWind[i].R1, "Simple_R1"); + me.dynamicPageFunc(myWind[i].R2, "Simple_R2"); + me.dynamicPageFunc(myWind[i].R3, "Simple_R3"); + me.dynamicPageFunc(myWind[i].R4, "Simple_R4"); + me.dynamicPageFunc(myWind[i].R5, "Simple_R5"); + me.dynamicPageFunc(myWind[i].R6, "Simple_R6"); + + me.colorRight(myWind[i].R1[2],myWind[i].R2[2],myWind[i].R3[2],myWind[i].R4[2],myWind[i].R5[2],myWind[i].R6[2]); } pageSwitch[i].setBoolValue(1); } diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 63e3b209..4b30b943 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -404,6 +404,13 @@ var lskbutton = func(btn, i) { fuelPredInput("L6",i); } else if (getprop("MCDU[" ~ i ~ "]/page") == "IRSINIT") { initInputIRS("L6",i); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDHIST") { + if (canvas_mcdu.myCLBWIND[i] != nil) { + canvas_mcdu.myCLBWIND[i].del(); + } + canvas_mcdu.myCLBWIND[i] = nil; + canvas_mcdu.myCLBWIND[i] = windCLBPage.new(i); + setprop("MCDU[" ~ i ~ "]/page", "WINDCLB"); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "ROUTESELECTION") { initInputROUTESEL("L6",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFCLB") { @@ -446,6 +453,13 @@ var rskbutton = func(btn, i) { initInputIRS("R1",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "INITB") { initInputB("R1",i); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") { + if (canvas_mcdu.myHISTWIND[i] != nil) { + canvas_mcdu.myHISTWIND[i].del(); + } + canvas_mcdu.myHISTWIND[i] = nil; + canvas_mcdu.myHISTWIND[i] = windHISTPage.new(i); + setprop("MCDU[" ~ i ~ "]/page", "WINDHIST"); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "RADNAV") { radnavInput("R1",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PRINTFUNC") { diff --git a/Nasal/MCDU/WINDHIST.nas b/Nasal/MCDU/WINDHIST.nas index 5142ee02..e902a294 100644 --- a/Nasal/MCDU/WINDHIST.nas +++ b/Nasal/MCDU/WINDHIST.nas @@ -2,7 +2,7 @@ # Copyright (c) 2020 Matthew Maring (mattmaring) -var windHistPage = { +var windHISTPage = { title: nil, fontMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]], arrowsMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]], @@ -30,7 +30,7 @@ var windHistPage = { index: nil, computer: nil, new: func(computer) { - var whp = {parents:[windHistPage]}; + var whp = {parents:[windHISTPage]}; whp.computer = computer; whp._setupPageWithData(); #whp.updateTmpy(); @@ -42,11 +42,11 @@ var windHistPage = { _setupPageWithData: func() { me.title = "HISTROY WIND"; me.titleColour = "wht"; - me.L1 = ["----g/---", "", "blu"]; - me.L2 = ["----g/---", "", "blu"]; - me.L3 = ["----g/---", "", "blu"]; - me.L4 = ["----g/---", "", "blu"]; - me.L5 = ["----g/---", "", "blu"]; + me.L1 = ["[ ]/[ ]", "", "blu"]; + me.L2 = ["[ ]/[ ]", "", "blu"]; + me.L3 = ["[ ]/[ ]", "", "blu"]; + me.L4 = ["[ ]/[ ]", "", "blu"]; + me.L5 = ["[ ]/[ ]", "", "blu"]; me.L6 = [" CLIMB WIND", "", "wht"]; me.C1 = ["FL050", "", "blu"]; me.C2 = ["FL150", "", "blu"]; @@ -67,7 +67,7 @@ var windHistPage = { # me.R2 = ["DATABASE ", nil, "wht"]; me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0]]; me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["ack", "ack", "ack", "ack", "ack", "ack"]]; - me.fontMatrix = [[1, 1, 1, 1, 1, 1], [0, 0, 0, 0, 0, 1]]; + me.fontMatrix = [[1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0]]; canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); }, makeTmpy: func() { From 077ce24361babf2b02ebd888c74665104b59a847 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Sun, 31 May 2020 12:55:32 -0400 Subject: [PATCH 03/53] Cruize wind, temp color change --- Models/Instruments/MCDU/MCDU.nas | 16 +++++-- Nasal/MCDU/MCDU.nas | 14 +++++++ Nasal/MCDU/WINDCLB.nas | 54 +++++++++++------------- Nasal/MCDU/WINDCRZ.nas | 71 +++++++++++++++++++++----------- 4 files changed, 97 insertions(+), 58 deletions(-) diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index 987ae462..0cfdd03e 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -3154,7 +3154,11 @@ var canvas_MCDU_base = { me["FUELPRED"].hide(); me["PROG"].hide(); me["PERFTO"].hide(); - me["arrowsDepArr"].hide(); + # if (page == "WINDCRZ") { +# up/down arrows show +# } else { +# up/down arrows hide +# } me["Simple_PageNum"].setText("X/X"); me["Simple_PageNum"].hide(); me["Simple_Title"].show(); @@ -3182,8 +3186,8 @@ var canvas_MCDU_base = { me.colorRightS("wht", "wht", "amb", "wht", "wht", "amb"); } else if (page == "WINDCRZ") { myWind = myCRZWIND; - me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorLeftS("wht", "wht", "wht", "wht", "wht", "amb"); + me.colorRightS("wht", "amb", "wht", "wht", "wht", "amb"); } else if (page == "WINDDES") { myWind = myDESWIND; me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); @@ -3195,7 +3199,11 @@ var canvas_MCDU_base = { } if (myWind[i] != nil) { - me["Simple_Title"].setText(sprintf("%s", myWind[i].title)); + if (page == "WINDCRZ") { + me["Simple_Title"].setText(sprintf("%s", myWind[i].title[0] ~ myWind[i].title[1] ~ myWind[i].title[2])); + } else { + me["Simple_Title"].setText(sprintf("%s", myWind[i].title)); + } forindex (var matrixArrow; myWind[i].arrowsMatrix) { if (matrixArrow == 0) { diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 4b30b943..76536c70 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -549,6 +549,13 @@ var rskbutton = func(btn, i) { initInputA("R4",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "FUELPRED") { fuelPredInput("R4",i); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") { + if (canvas_mcdu.myCLBWIND[i] == nil) { + canvas_mcdu.myCLBWIND[i].del(); + } + canvas_mcdu.myCLBWIND[i] = nil; + canvas_mcdu.myCLBWIND[i] = windCLBPage.new(i); + setprop("MCDU[" ~ i ~ "]/page", "WINDCLB"); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") { perfTOInput("R4",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") { @@ -571,6 +578,13 @@ var rskbutton = func(btn, i) { initInputA("R5",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "INITB") { initInputB("R5",i); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") { + if (canvas_mcdu.myCRZWIND[i] != nil) { + canvas_mcdu.myCRZWIND[i].del(); + } + canvas_mcdu.myCRZWIND[i] = nil; + canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, ""); + setprop("MCDU[" ~ i ~ "]/page", "WINDCRZ"); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "STATUS") { statusInput("R5",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") { diff --git a/Nasal/MCDU/WINDCLB.nas b/Nasal/MCDU/WINDCLB.nas index 1517bdb3..75b31d1c 100644 --- a/Nasal/MCDU/WINDCLB.nas +++ b/Nasal/MCDU/WINDCLB.nas @@ -47,25 +47,25 @@ var windCLBPage = { me.titleColour = "wht"; if (size(me.windList) >= 5) { - me.L5 = ["[ ]/[ ]/[ ]", "", "blu"]; + me.L5 = ["[ ]/[ ]/[ ]", nil, "blu"]; } else { me.L5 = [nil, nil, "ack"]; } if (size(me.windList) >= 4) { - me.L4 = ["[ ]/[ ]/[ ]", "", "blu"]; + me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"]; } else { me.L4 = [nil, nil, "ack"]; } if (size(me.windList) >= 3) { - me.L3 = ["[ ]/[ ]/[ ]", "", "blu"]; + me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"]; } else { me.L3 = [nil, nil, "ack"]; } if (size(me.windList) >= 2) { - me.L2 = ["[ ]/[ ]/[ ]", "", "blu"]; + me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"]; } else { me.L2 = [nil, nil, "ack"]; } @@ -73,23 +73,11 @@ var windCLBPage = { if (size(me.windList) >= 1) { me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"]; } - - me.L6 = [" CANCEL", " WIND", "amb"]; + me.R1 = [" HISTORY ", "WIND ", "wht"]; me.R3 = [" REQUEST ", "WIND ", "amb"]; me.R5 = [" PHASE ", "NEXT ", "wht"]; - me.R6 = ["UPDATE ", "WIND ", "amb"]; -# me.L2 = [" R", " TURN", "blu"]; -# if (pts.Instrumentation.Altimeter.indicatedFt.getValue() >= 14000) { -# me.L2 = [" 1.5/----", "TIME/DIST", "blu"]; -# } else { -# me.L2 = [" 1.0/----", "TIME/DIST", "blu"]; -# } -# me.L6 = [" RETURN", nil, "wht"]; -# me.C4 = ["LAST EXIT", nil, "wht"]; -# me.C5 = ["---- ---.-", "UTC FUEL", "wht"]; -# me.R1 = ["COMPUTED ", nil, "wht"]; -# me.R2 = ["DATABASE ", nil, "wht"]; + me.arrowsMatrix = [[0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 1, 0]]; me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "ack"], ["wht", "ack", "ack", "ack", "wht", "ack"]]; me.fontMatrix = [[1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0]]; @@ -102,20 +90,26 @@ var windCLBPage = { }, updateTmpy: func() { if (fmgc.flightPlanController.temporaryFlag[me.computer]) { - #me.L1[2] = "yel"; - #me.L2[2] = "yel"; - #me.L6 = [" F-PLN", " TMPY", "yel"]; - #me.R6 = ["INSERT* ", " TMPY", "yel"]; - #me.arrowsColour[0][5] = "yel"; - #me.titleColour = "yel"; + me.L1[2] = "yel"; + me.L2[2] = "yel"; + me.L3[2] = "yel"; + me.L4[2] = "yel"; + me.L5[2] = "yel"; + me.L6 = [" CANCEL", " WIND", "amb"]; + me.R6 = ["UPDATE ", "WIND ", "amb"]; + me.arrowsMatrix[0][5] = 0; + #draft title canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); } else { - #me.L1[2] = "blu"; - #me.L2[2] = "blu"; - #me.L6 = [" RETURN", nil, "wht"]; - #me.R6 = [nil, nil, "ack"]; - #me.arrowsColour[0][5] = "wht"; - #me.titleColour = "wht"; + me.L1[2] = "blu"; + me.L2[2] = "blu"; + me.L3[2] = "blu"; + me.L4[2] = "blu"; + me.L5[2] = "blu"; + me.L6 = [" RETURN", nil, "wht"]; + me.R6 = [nil, nil, "ack"]; + me.arrowsMatrix[0][5] = 1; + #draft title canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); } } diff --git a/Nasal/MCDU/WINDCRZ.nas b/Nasal/MCDU/WINDCRZ.nas index ae181970..92d6d961 100644 --- a/Nasal/MCDU/WINDCRZ.nas +++ b/Nasal/MCDU/WINDCRZ.nas @@ -29,10 +29,12 @@ var windCRZPage = { vector: [], index: nil, computer: nil, - new: func(computer, waypoint) { + windList: [], + new: func(computer) { #, waypoint var wcp = {parents:[windCRZPage]}; wcp.computer = computer; - wcp.waypoint = waypoint; + wcp.windList = [nil]; + #wcp.waypoint = waypoint; wcp._setupPageWithData(); wcp.updateTmpy(); return wcp; @@ -41,23 +43,40 @@ var windCRZPage = { return nil; }, _setupPageWithData: func() { - me.title = ["CRZ WIND", " AT ", me.waypoint.wp_name]; + me.title = ["CRZ WIND", " AT ", "TEMP"]; + #me.title = ["CRZ WIND", " AT ", me.waypoint.wp_name]; me.titleColour = "wht"; - # me.L1 = [" [ ]", "INB CRS", "blu"]; -# me.L2 = [" R", " TURN", "blu"]; -# if (pts.Instrumentation.Altimeter.indicatedFt.getValue() >= 14000) { -# me.L2 = [" 1.5/----", "TIME/DIST", "blu"]; -# } else { -# me.L2 = [" 1.0/----", "TIME/DIST", "blu"]; -# } -# me.L6 = [" RETURN", nil, "wht"]; -# me.C4 = ["LAST EXIT", nil, "wht"]; -# me.C5 = ["---- ---.-", "UTC FUEL", "wht"]; -# me.R1 = ["COMPUTED ", nil, "wht"]; -# me.R2 = ["DATABASE ", nil, "wht"]; - me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [1, 1, 0, 0, 0, 0]]; - me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["wht", "wht", "ack", "ack", "ack", "ack"]]; - me.fontMatrix = [[1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]; + + if (size(me.windList) >= 4) { + me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"]; + } else { + me.L4 = [nil, nil, "ack"]; + } + + if (size(me.windList) >= 3) { + me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"]; + } else { + me.L3 = [nil, nil, "ack"]; + } + + if (size(me.windList) >= 2) { + me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"]; + } else { + me.L2 = [nil, nil, "ack"]; + } + + if (size(me.windList) >= 1) { + me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"]; + } + + me.L5 = ["[ ]/[ ]", "SAT / ALT", "blu"]; + me.R2 = [" REQUEST ", "WIND ", "amb"]; + me.R4 = [" PHASE ", "PREV ", "wht"]; + me.R5 = [" PHASE ", "NEXT ", "wht"]; + + me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 1, 0]]; + me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["ack", "ack", "ack", "wht", "wht", "ack"]]; + me.fontMatrix = [[1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0]]; canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); }, makeTmpy: func() { @@ -69,18 +88,22 @@ var windCRZPage = { if (fmgc.flightPlanController.temporaryFlag[me.computer]) { me.L1[2] = "yel"; me.L2[2] = "yel"; - me.L6 = [" F-PLN", " TMPY", "yel"]; - me.R6 = ["INSERT* ", " TMPY", "yel"]; - me.arrowsColour[0][5] = "yel"; - me.titleColour = "yel"; + me.L3[2] = "yel"; + me.L4[2] = "yel"; + me.L6 = [" CANCEL", "UPDATE", "amb"]; + me.R6 = ["INSERT ", "UPDATE ", "amb"]; + me.arrowsMatrix[0][5] = 0; + #draft title canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); } else { me.L1[2] = "blu"; me.L2[2] = "blu"; + me.L3[2] = "blu"; + me.L4[2] = "blu"; me.L6 = [" RETURN", nil, "wht"]; me.R6 = [nil, nil, "ack"]; - me.arrowsColour[0][5] = "wht"; - me.titleColour = "wht"; + me.arrowsMatrix[0][5] = 1; + #draft title canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); } } From f9f6d301a8cd6ff501b671d40c822c06d915af42 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Sun, 31 May 2020 13:12:43 -0400 Subject: [PATCH 04/53] Descent wind --- Models/Instruments/MCDU/MCDU.nas | 4 +- Nasal/MCDU/MCDU.nas | 14 ++++ Nasal/MCDU/WINDCRZ.nas | 2 + Nasal/MCDU/WINDDES.nas | 126 ++++++++++++++++++------------- 4 files changed, 92 insertions(+), 54 deletions(-) diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index 0cfdd03e..321f2a3c 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -3190,8 +3190,8 @@ var canvas_MCDU_base = { me.colorRightS("wht", "amb", "wht", "wht", "wht", "amb"); } else if (page == "WINDDES") { myWind = myDESWIND; - me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); - me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht"); + me.colorLeftS("wht", "wht", "wht", "wht", "wht", "amb"); + me.colorRightS("wht", "wht", "amb", "wht", "wht", "amb"); } else if (page == "WINDHIST") { myWind = myHISTWIND; me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 76536c70..72b0cbd1 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -556,6 +556,13 @@ var rskbutton = func(btn, i) { canvas_mcdu.myCLBWIND[i] = nil; canvas_mcdu.myCLBWIND[i] = windCLBPage.new(i); setprop("MCDU[" ~ i ~ "]/page", "WINDCLB"); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") { + if (canvas_mcdu.myCRZWIND[i] != nil) { + canvas_mcdu.myCRZWIND[i].del(); + } + canvas_mcdu.myCRZWIND[i] = nil; + canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, ""); + setprop("MCDU[" ~ i ~ "]/page", "WINDCRZ"); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") { perfTOInput("R4",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") { @@ -585,6 +592,13 @@ var rskbutton = func(btn, i) { canvas_mcdu.myCRZWIND[i] = nil; canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, ""); setprop("MCDU[" ~ i ~ "]/page", "WINDCRZ"); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") { + if (canvas_mcdu.myDESWIND[i] != nil) { + canvas_mcdu.myDESWIND[i].del(); + } + canvas_mcdu.myDESWIND[i] = nil; + canvas_mcdu.myDESWIND[i] = windDESPage.new(i, ""); + setprop("MCDU[" ~ i ~ "]/page", "WINDDES"); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "STATUS") { statusInput("R5",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") { diff --git a/Nasal/MCDU/WINDCRZ.nas b/Nasal/MCDU/WINDCRZ.nas index 92d6d961..6e43c848 100644 --- a/Nasal/MCDU/WINDCRZ.nas +++ b/Nasal/MCDU/WINDCRZ.nas @@ -90,6 +90,7 @@ var windCRZPage = { me.L2[2] = "yel"; me.L3[2] = "yel"; me.L4[2] = "yel"; + me.L5[2] = "yel"; me.L6 = [" CANCEL", "UPDATE", "amb"]; me.R6 = ["INSERT ", "UPDATE ", "amb"]; me.arrowsMatrix[0][5] = 0; @@ -100,6 +101,7 @@ var windCRZPage = { me.L2[2] = "blu"; me.L3[2] = "blu"; me.L4[2] = "blu"; + me.L5[2] = "blu"; me.L6 = [" RETURN", nil, "wht"]; me.R6 = [nil, nil, "ack"]; me.arrowsMatrix[0][5] = 1; diff --git a/Nasal/MCDU/WINDDES.nas b/Nasal/MCDU/WINDDES.nas index 145eb02c..8bcfdad9 100644 --- a/Nasal/MCDU/WINDDES.nas +++ b/Nasal/MCDU/WINDDES.nas @@ -29,69 +29,91 @@ var windDESPage = { vector: [], index: nil, computer: nil, - new: func(computer) { - var wdp = {parents:[windDESPage]}; - wdp.computer = computer; - wdp._setupPageWithData(); - wdp.updateTmpy(); - return wdp; + windList: [], + new: func(computer) { #, waypoint + var wcp = {parents:[windDESPage]}; + wcp.computer = computer; + wcp.windList = [nil]; + #wcp.waypoint = waypoint; + wcp._setupPageWithData(); + wcp.updateTmpy(); + return wcp; }, del: func() { return nil; }, _setupPageWithData: func() { - me.title = "DESCENT WIND"; - #me.title = "DRAFT DESCENT WIND"; + me.title = "DES WIND"; + #me.title = ["DES WIND", " AT ", me.waypoint.wp_name]; me.titleColour = "wht"; - me.L1 = ["[ ]g/[ ]/FL---", "TRU WIND/ALT", "blu"]; - me.L2 = ["[ ]g/[ ]/FL200", "", "blu"]; - me.L3 = ["[ ]g/[ ]/FL100", "", "blu"]; - me.L4 = ["[ ]g/[ ]/FL050", "", "blu"]; - me.L5 = ["[ ]g/[ ]/GRND", "", "blu"]; - me.L6 = [" CANCEL", " WIND", "amb"]; - me.R1 = ["[ ]g/[ ]", "WIND ", "blu"]; - me.R2 = ["", "FL---", "grn"]; - me.R3 = [" REQUEST ", "WIND ", "wht"]; + + if (size(me.windList) >= 5) { + me.L5 = ["[ ]/[ ]/[ ]", nil, "blu"]; + } else { + me.L5 = [nil, nil, "ack"]; + } + + if (size(me.windList) >= 4) { + me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"]; + } else { + me.L4 = [nil, nil, "ack"]; + } + + if (size(me.windList) >= 3) { + me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"]; + } else { + me.L3 = [nil, nil, "ack"]; + } + + if (size(me.windList) >= 2) { + me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"]; + } else { + me.L2 = [nil, nil, "ack"]; + } + + if (size(me.windList) >= 1) { + me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"]; + } + + me.R1 = ["[ ]/[ ]", "ALTN WIND ", "blu"]; + me.R3 = [" REQUEST ", "WIND ", "amb"]; me.R4 = [" PHASE ", "PREV ", "wht"]; - me.R6 = ["UPDATE ", "WIND ", "amb"]; -# me.L2 = [" R", " TURN", "blu"]; -# if (pts.Instrumentation.Altimeter.indicatedFt.getValue() >= 14000) { -# me.L2 = [" 1.5/----", "TIME/DIST", "blu"]; -# } else { -# me.L2 = [" 1.0/----", "TIME/DIST", "blu"]; -# } -# me.L6 = [" RETURN", nil, "wht"]; -# me.C4 = ["LAST EXIT", nil, "wht"]; -# me.C5 = ["---- ---.-", "UTC FUEL", "wht"]; -# me.R1 = ["COMPUTED ", nil, "wht"]; -# me.R2 = ["DATABASE ", nil, "wht"]; - me.arrowsMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0]]; - me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "ack"], ["ack", "ack", "ack", "wht", "ack", "ack"]]; - me.fontMatrix = [[1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]; + + me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 0]]; + me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["ack", "ack", "ack", "wht", "ack", "ack"]]; + me.fontMatrix = [[1, 1, 1, 1, 1, 0], [1, 0, 0, 0, 0, 0]]; canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); }, makeTmpy: func() { - # if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { -# fmgc.flightPlanController.createTemporaryFlightPlan(me.computer); -# } + if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { + fmgc.flightPlanController.createTemporaryFlightPlan(me.computer); + } }, updateTmpy: func() { - # if (fmgc.flightPlanController.temporaryFlag[me.computer]) { -# me.L1[2] = "yel"; -# me.L2[2] = "yel"; -# me.L6 = [" F-PLN", " TMPY", "yel"]; -# me.R6 = ["INSERT* ", " TMPY", "yel"]; -# me.arrowsColour[0][5] = "yel"; -# me.titleColour = "yel"; -# canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); -# } else { -# me.L1[2] = "blu"; -# me.L2[2] = "blu"; -# me.L6 = [" RETURN", nil, "wht"]; -# me.R6 = [nil, nil, "ack"]; -# me.arrowsColour[0][5] = "wht"; -# me.titleColour = "wht"; -# canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); -# } + if (fmgc.flightPlanController.temporaryFlag[me.computer]) { + me.L1[2] = "yel"; + me.L2[2] = "yel"; + me.L3[2] = "yel"; + me.L4[2] = "yel"; + me.L5[2] = "yel"; + me.R1[2] = "yel"; + me.L6 = [" CANCEL", " WIND", "amb"]; + me.R6 = ["UPDATE ", "WIND ", "amb"]; + me.arrowsMatrix[0][5] = 0; + #draft title + canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); + } else { + me.L1[2] = "blu"; + me.L2[2] = "blu"; + me.L3[2] = "blu"; + me.L4[2] = "blu"; + me.L5[2] = "blu"; + me.R1[2] = "blu"; + me.L6 = [" RETURN", nil, "wht"]; + me.R6 = [nil, nil, "ack"]; + me.arrowsMatrix[0][5] = 1; + #draft title + canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); + } } }; \ No newline at end of file From 3c8402dbbccfb3fae8cec54b7eb03befbd1c314d Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Sun, 31 May 2020 14:15:53 -0400 Subject: [PATCH 05/53] Basic text entry logic (clb only) --- Nasal/MCDU/INITA.nas | 6 ++-- Nasal/MCDU/MCDU.nas | 44 +++++++++++++-------------- Nasal/MCDU/WINDCLB.nas | 67 +++++++++++++++++++++++++++++++++++------ Nasal/MCDU/WINDHIST.nas | 50 +++++++++++++++++------------- 4 files changed, 110 insertions(+), 57 deletions(-) diff --git a/Nasal/MCDU/INITA.nas b/Nasal/MCDU/INITA.nas index e5bc7490..8e162b3b 100644 --- a/Nasal/MCDU/INITA.nas +++ b/Nasal/MCDU/INITA.nas @@ -223,11 +223,9 @@ var initInputA = func(key, i) { } else if (key == "R3") { setprop("MCDU[" ~ i ~ "]/page", "IRSINIT"); } else if (key == "R4") { - if (canvas_mcdu.myCLBWIND[i] != nil) { - canvas_mcdu.myCLBWIND[i].del(); + if (canvas_mcdu.myCLBWIND[i] == nil) { + canvas_mcdu.myCLBWIND[i] = windCLBPage.new(i); } - canvas_mcdu.myCLBWIND[i] = nil; - canvas_mcdu.myCLBWIND[i] = windCLBPage.new(i); setprop("MCDU[" ~ i ~ "]/page", "WINDCLB"); } else if (key == "R5") { if (scratchpad == "CLR") { diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 72b0cbd1..07161dc3 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -207,6 +207,8 @@ var lskbutton = func(btn, i) { initInputIRS("L1",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "INITB") { initInputB("L1",i); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") { + canvas_mcdu.myCLBWIND[i].pushButtonLeft(1); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PROGTO") { progTOInput("L1",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PROGCLB") { @@ -250,6 +252,8 @@ var lskbutton = func(btn, i) { } else if (btn == "2") { if (getprop("/MCDU[" ~ i ~ "]/page") == "INITA") { initInputA("L2",i); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") { + canvas_mcdu.myCLBWIND[i].pushButtonLeft(2); } else if (getprop("MCDU[" ~ i ~ "]/page") == "PERFTO") { perfTOInput("L2",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") { @@ -288,6 +292,8 @@ var lskbutton = func(btn, i) { initInputB("L3",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "FUELPRED") { fuelPredInput("L3",i); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") { + canvas_mcdu.myCLBWIND[i].pushButtonLeft(3); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") { perfTOInput("L3",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") { @@ -331,6 +337,8 @@ var lskbutton = func(btn, i) { initInputB("L4",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "FUELPRED") { fuelPredInput("L4",i); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") { + canvas_mcdu.myCLBWIND[i].pushButtonLeft(4); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") { perfTOInput("L4",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") { @@ -359,6 +367,8 @@ var lskbutton = func(btn, i) { initInputB("L5",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "FUELPRED") { fuelPredInput("L5",i); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") { + canvas_mcdu.myCLBWIND[i].pushButtonLeft(5); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") { perfTOInput("L5",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFCLB") { @@ -405,11 +415,9 @@ var lskbutton = func(btn, i) { } else if (getprop("MCDU[" ~ i ~ "]/page") == "IRSINIT") { initInputIRS("L6",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDHIST") { - if (canvas_mcdu.myCLBWIND[i] != nil) { - canvas_mcdu.myCLBWIND[i].del(); + if (canvas_mcdu.myCLBWIND[i] == nil) { + canvas_mcdu.myCLBWIND[i] = windCLBPage.new(i); } - canvas_mcdu.myCLBWIND[i] = nil; - canvas_mcdu.myCLBWIND[i] = windCLBPage.new(i); setprop("MCDU[" ~ i ~ "]/page", "WINDCLB"); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "ROUTESELECTION") { initInputROUTESEL("L6",i); @@ -454,11 +462,9 @@ var rskbutton = func(btn, i) { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "INITB") { initInputB("R1",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") { - if (canvas_mcdu.myHISTWIND[i] != nil) { - canvas_mcdu.myHISTWIND[i].del(); + if (canvas_mcdu.myHISTWIND[i] == nil) { + canvas_mcdu.myHISTWIND[i] = windHISTPage.new(i); } - canvas_mcdu.myHISTWIND[i] = nil; - canvas_mcdu.myHISTWIND[i] = windHISTPage.new(i); setprop("MCDU[" ~ i ~ "]/page", "WINDHIST"); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "RADNAV") { radnavInput("R1",i); @@ -551,17 +557,13 @@ var rskbutton = func(btn, i) { fuelPredInput("R4",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") { if (canvas_mcdu.myCLBWIND[i] == nil) { - canvas_mcdu.myCLBWIND[i].del(); + canvas_mcdu.myCLBWIND[i] = windCLBPage.new(i); } - canvas_mcdu.myCLBWIND[i] = nil; - canvas_mcdu.myCLBWIND[i] = windCLBPage.new(i); setprop("MCDU[" ~ i ~ "]/page", "WINDCLB"); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") { - if (canvas_mcdu.myCRZWIND[i] != nil) { - canvas_mcdu.myCRZWIND[i].del(); + if (canvas_mcdu.myCRZWIND[i] == nil) { + canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, ""); } - canvas_mcdu.myCRZWIND[i] = nil; - canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, ""); setprop("MCDU[" ~ i ~ "]/page", "WINDCRZ"); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") { perfTOInput("R4",i); @@ -586,18 +588,14 @@ var rskbutton = func(btn, i) { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "INITB") { initInputB("R5",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") { - if (canvas_mcdu.myCRZWIND[i] != nil) { - canvas_mcdu.myCRZWIND[i].del(); + if (canvas_mcdu.myCRZWIND[i] == nil) { + canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, ""); } - canvas_mcdu.myCRZWIND[i] = nil; - canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, ""); setprop("MCDU[" ~ i ~ "]/page", "WINDCRZ"); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") { - if (canvas_mcdu.myDESWIND[i] != nil) { - canvas_mcdu.myDESWIND[i].del(); + if (canvas_mcdu.myDESWIND[i] == nil) { + canvas_mcdu.myDESWIND[i] = windDESPage.new(i, ""); } - canvas_mcdu.myDESWIND[i] = nil; - canvas_mcdu.myDESWIND[i] = windDESPage.new(i, ""); setprop("MCDU[" ~ i ~ "]/page", "WINDDES"); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "STATUS") { statusInput("R5",i); diff --git a/Nasal/MCDU/WINDCLB.nas b/Nasal/MCDU/WINDCLB.nas index 75b31d1c..9e1bed20 100644 --- a/Nasal/MCDU/WINDCLB.nas +++ b/Nasal/MCDU/WINDCLB.nas @@ -45,42 +45,72 @@ var windCLBPage = { me.title = "CLIMB WIND"; #me.title = "DRAFT CLIMB WIND"; me.titleColour = "wht"; + me.arrowsMatrix = [[0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 1, 0]]; + me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "ack"], ["wht", "ack", "ack", "ack", "wht", "ack"]]; + me.fontMatrix = [[1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0]]; if (size(me.windList) >= 5) { - me.L5 = ["[ ]/[ ]/[ ]", nil, "blu"]; + if (me.windList[4] != nil) { + me.L5 = [me.windList[4][0] ~ "/" ~ me.windList[4][1] ~ "/" ~ me.windList[4][2], nil, "blu"]; + me.fontMatrix[0][4] = 0; + } else { + me.L5 = ["[ ]/[ ]/[ ]", nil, "blu"]; + me.fontMatrix[0][4] = 1; + } } else { me.L5 = [nil, nil, "ack"]; } if (size(me.windList) >= 4) { - me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"]; + if (me.windList[3] != nil) { + me.L4 = [me.windList[3][0] ~ "/" ~ me.windList[3][1] ~ "/" ~ me.windList[3][2], nil, "blu"]; + me.fontMatrix[0][3] = 0; + } else { + me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"]; + me.fontMatrix[0][3] = 1; + } } else { me.L4 = [nil, nil, "ack"]; } if (size(me.windList) >= 3) { - me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"]; + if (me.windList[2] != nil) { + me.L3 = [me.windList[2][0] ~ "/" ~ me.windList[2][1] ~ "/" ~ me.windList[2][2], nil, "blu"]; + me.fontMatrix[0][2] = 0; + } else { + me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"]; + me.fontMatrix[0][2] = 1; + } } else { me.L3 = [nil, nil, "ack"]; } if (size(me.windList) >= 2) { - me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"]; + if (me.windList[1] != nil) { + me.L2 = [me.windList[1][0] ~ "/" ~ me.windList[1][1] ~ "/" ~ me.windList[1][2], nil, "blu"]; + me.fontMatrix[0][1] = 0; + } else { + me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"]; + me.fontMatrix[0][1] = 1; + } } else { me.L2 = [nil, nil, "ack"]; } if (size(me.windList) >= 1) { - me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"]; + if (me.windList[0] != nil) { + me.L1 = [me.windList[0][0] ~ "/" ~ me.windList[0][1] ~ "/" ~ me.windList[0][2], "TRU WIND/ALT", "blu"]; + me.fontMatrix[0][0] = 0; + } else { + me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"]; + me.fontMatrix[0][0] = 1; + } } me.R1 = [" HISTORY ", "WIND ", "wht"]; me.R3 = [" REQUEST ", "WIND ", "amb"]; me.R5 = [" PHASE ", "NEXT ", "wht"]; - - me.arrowsMatrix = [[0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 1, 0]]; - me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "ack"], ["wht", "ack", "ack", "ack", "wht", "ack"]]; - me.fontMatrix = [[1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0]]; + canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); }, makeTmpy: func() { @@ -112,5 +142,24 @@ var windCLBPage = { #draft title canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); } + }, + pushButtonLeft: func(index) { + if (size(me.windList) >= index) { + if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) == 13) { + var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad); + me.windList[index - 1] = [winds[0], winds[1], winds[2]]; + mcdu_scratchpad.scratchpads[me.computer].empty(); + if (index != 5) { + append(me.windList, nil); + } + me._setupPageWithData(); + me.makeTmpy(); + me.updateTmpy(); + } else { + mcdu_message(me.computer, "NOT ALLOWED"); + } + } else { + mcdu_message(me.computer, "NOT ALLOWED"); + } } }; \ No newline at end of file diff --git a/Nasal/MCDU/WINDHIST.nas b/Nasal/MCDU/WINDHIST.nas index e902a294..2f79b9bd 100644 --- a/Nasal/MCDU/WINDHIST.nas +++ b/Nasal/MCDU/WINDHIST.nas @@ -33,7 +33,7 @@ var windHISTPage = { var whp = {parents:[windHISTPage]}; whp.computer = computer; whp._setupPageWithData(); - #whp.updateTmpy(); + whp.updateTmpy(); return whp; }, del: func() { @@ -71,27 +71,35 @@ var windHISTPage = { canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); }, makeTmpy: func() { - # if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { -# fmgc.flightPlanController.createTemporaryFlightPlan(me.computer); -# } + if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { + fmgc.flightPlanController.createTemporaryFlightPlan(me.computer); + } }, updateTmpy: func() { - # if (fmgc.flightPlanController.temporaryFlag[me.computer]) { -# me.L1[2] = "yel"; -# me.L2[2] = "yel"; -# me.L6 = [" F-PLN", " TMPY", "yel"]; -# me.R6 = ["INSERT* ", " TMPY", "yel"]; -# me.arrowsColour[0][5] = "yel"; -# me.titleColour = "yel"; -# canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); -# } else { -# me.L1[2] = "blu"; -# me.L2[2] = "blu"; -# me.L6 = [" RETURN", nil, "wht"]; -# me.R6 = [nil, nil, "ack"]; -# me.arrowsColour[0][5] = "wht"; -# me.titleColour = "wht"; -# canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); -# } + if (fmgc.flightPlanController.temporaryFlag[me.computer]) { + me.L1[2] = "yel"; + me.L2[2] = "yel"; + me.L3[2] = "yel"; + me.L4[2] = "yel"; + me.L5[2] = "yel"; + me.C1[2] = "yel"; + me.C2[2] = "yel"; + me.C3[2] = "yel"; + me.C4[2] = "yel"; + me.C5[2] = "yel"; + canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); + } else { + me.L1[2] = "blu"; + me.L2[2] = "blu"; + me.L3[2] = "blu"; + me.L4[2] = "blu"; + me.L5[2] = "blu"; + me.C1[2] = "blu"; + me.C2[2] = "blu"; + me.C3[2] = "blu"; + me.C4[2] = "blu"; + me.C5[2] = "blu"; + canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); + } } }; \ No newline at end of file From efc771c89e996d723a17d0646cd5f4bf48211430 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Sun, 31 May 2020 14:39:33 -0400 Subject: [PATCH 06/53] Add contraints --- Nasal/MCDU/WINDCLB.nas | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/Nasal/MCDU/WINDCLB.nas b/Nasal/MCDU/WINDCLB.nas index 9e1bed20..c40782c1 100644 --- a/Nasal/MCDU/WINDCLB.nas +++ b/Nasal/MCDU/WINDCLB.nas @@ -147,14 +147,21 @@ var windCLBPage = { if (size(me.windList) >= index) { if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) == 13) { var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad); - me.windList[index - 1] = [winds[0], winds[1], winds[2]]; - mcdu_scratchpad.scratchpads[me.computer].empty(); - if (index != 5) { - append(me.windList, nil); + if (size(winds[0]) == 3 and num(winds[0]) != nil and winds[0] >= 0 and winds[0] <= 360 and + size(winds[1]) == 3 and num(winds[1]) != nil and winds[1] >= 0 and winds[1] <= 200 and + size(winds[2]) == 5 and ((num(winds[2]) != nil and winds[2] >= 1000 and winds[2] <= 39000) or + (num(split("FL", winds[2])[1]) != nil and split("FL", winds[2])[1] >= 10 and split("FL", winds[2])[1] <= 390))) { + me.windList[index - 1] = [winds[0], winds[1], winds[2]]; + mcdu_scratchpad.scratchpads[me.computer].empty(); + if (index != 5) { + append(me.windList, nil); + } + me._setupPageWithData(); + me.makeTmpy(); + me.updateTmpy(); + } else { + mcdu_message(me.computer, "NOT ALLOWED"); } - me._setupPageWithData(); - me.makeTmpy(); - me.updateTmpy(); } else { mcdu_message(me.computer, "NOT ALLOWED"); } From b7f153a601f33025387c2a2c7c904ced0c77db2a Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Sun, 31 May 2020 21:10:47 -0400 Subject: [PATCH 07/53] Enabling cycling through waypoints --- Nasal/FMGC/flightplan.nas | 11 ++++++++++ Nasal/MCDU/INITA.nas | 2 ++ Nasal/MCDU/MCDU.nas | 46 ++++++++++++++++++++++++++++++++++----- Nasal/MCDU/WINDCLB.nas | 4 ++++ Nasal/MCDU/WINDCRZ.nas | 45 +++++++++++++++++++++++++++++++++----- Nasal/MCDU/WINDDES.nas | 4 ++++ Nasal/MCDU/WINDHIST.nas | 4 ++++ 7 files changed, 105 insertions(+), 11 deletions(-) diff --git a/Nasal/FMGC/flightplan.nas b/Nasal/FMGC/flightplan.nas index 4a584789..8b16d6c3 100644 --- a/Nasal/FMGC/flightplan.nas +++ b/Nasal/FMGC/flightplan.nas @@ -527,6 +527,17 @@ var flightPlanController = { return 2; }, + getWaypointList: func(plan) { + var waypointsList = []; + for (var index = 1; index < me.arrivalIndex[plan]; index += 1) { + #print(me.flightplans[plan].getWP(index).wp_name); + if (me.flightplans[plan].getWP(index).wp_name != "DISCONTINUITY" and me.flightplans[plan].getWP(index).wp_type != "vectors" and me.flightplans[plan].getWP(index).wp_type != "hdgToAlt") { + append(waypointsList, me.flightplans[plan].getWP(index)); + } + } + return waypointsList; + }, + # getWPforPBD - parse scratchpad text to find waypoint ghost for PBD # args: text, index, plan # text: scratchpad text diff --git a/Nasal/MCDU/INITA.nas b/Nasal/MCDU/INITA.nas index 8e162b3b..c9a699b5 100644 --- a/Nasal/MCDU/INITA.nas +++ b/Nasal/MCDU/INITA.nas @@ -225,6 +225,8 @@ var initInputA = func(key, i) { } else if (key == "R4") { if (canvas_mcdu.myCLBWIND[i] == nil) { canvas_mcdu.myCLBWIND[i] = windCLBPage.new(i); + } else { + canvas_mcdu.myCLBWIND[i].reload(); } setprop("MCDU[" ~ i ~ "]/page", "WINDCLB"); } else if (key == "R5") { diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 07161dc3..7aaec7a1 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -417,6 +417,8 @@ var lskbutton = func(btn, i) { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDHIST") { if (canvas_mcdu.myCLBWIND[i] == nil) { canvas_mcdu.myCLBWIND[i] = windCLBPage.new(i); + } else { + canvas_mcdu.myCLBWIND[i].reload(); } setprop("MCDU[" ~ i ~ "]/page", "WINDCLB"); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "ROUTESELECTION") { @@ -464,6 +466,8 @@ var rskbutton = func(btn, i) { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") { if (canvas_mcdu.myHISTWIND[i] == nil) { canvas_mcdu.myHISTWIND[i] = windHISTPage.new(i); + } else { + canvas_mcdu.myHISTWIND[i].reload(); } setprop("MCDU[" ~ i ~ "]/page", "WINDHIST"); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "RADNAV") { @@ -558,13 +562,26 @@ var rskbutton = func(btn, i) { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") { if (canvas_mcdu.myCLBWIND[i] == nil) { canvas_mcdu.myCLBWIND[i] = windCLBPage.new(i); + } else { + canvas_mcdu.myCLBWIND[i].reload(); } setprop("MCDU[" ~ i ~ "]/page", "WINDCLB"); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") { - if (canvas_mcdu.myCRZWIND[i] == nil) { - canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, ""); + if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.flightPlanController.getWaypointList(2)) > 0) { + if (canvas_mcdu.myCRZWIND[i] != nil) { + canvas_mcdu.myCRZWIND[i].del(); + } + canvas_mcdu.myCRZWIND[i] = nil; + canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, fmgc.flightPlanController.getWaypointList(2)[0], 0); + setprop("MCDU[" ~ i ~ "]/page", "WINDCRZ"); + } else { + if (canvas_mcdu.myCRZWIND[i] != nil) { + canvas_mcdu.myCRZWIND[i].del(); + } + canvas_mcdu.myCRZWIND[i] = nil; + canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, nil, nil); + setprop("MCDU[" ~ i ~ "]/page", "WINDCRZ"); } - setprop("MCDU[" ~ i ~ "]/page", "WINDCRZ"); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") { perfTOInput("R4",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") { @@ -588,13 +605,26 @@ var rskbutton = func(btn, i) { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "INITB") { initInputB("R5",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") { - if (canvas_mcdu.myCRZWIND[i] == nil) { - canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, ""); + if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.flightPlanController.getWaypointList(2)) > 0) { + if (canvas_mcdu.myCRZWIND[i] != nil) { + canvas_mcdu.myCRZWIND[i].del(); + } + canvas_mcdu.myCRZWIND[i] = nil; + canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, fmgc.flightPlanController.getWaypointList(2)[0], 0); + } else { + if (canvas_mcdu.myCRZWIND[i] != nil) { + canvas_mcdu.myCRZWIND[i].del(); + } + canvas_mcdu.myCRZWIND[i] = nil; + canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, nil, nil); + setprop("MCDU[" ~ i ~ "]/page", "WINDCRZ"); } setprop("MCDU[" ~ i ~ "]/page", "WINDCRZ"); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") { if (canvas_mcdu.myDESWIND[i] == nil) { canvas_mcdu.myDESWIND[i] = windDESPage.new(i, ""); + } else { + canvas_mcdu.myDESWIND[i].reload(); } setprop("MCDU[" ~ i ~ "]/page", "WINDDES"); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "STATUS") { @@ -737,6 +767,8 @@ var arrowbutton = func(btn, i) { canvas_mcdu.myDirTo[i].scrollUp(); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "IRSINIT") { initInputIRS("up",i); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") { + canvas_mcdu.myCRZWIND[i].pushButtonUp(); } } else if (btn == "down") { if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") { @@ -749,7 +781,9 @@ var arrowbutton = func(btn, i) { canvas_mcdu.myDirTo[i].scrollDn(); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "IRSINIT") { initInputIRS("down",i); - } + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") { + canvas_mcdu.myCRZWIND[i].pushButtonDown(); + } } } diff --git a/Nasal/MCDU/WINDCLB.nas b/Nasal/MCDU/WINDCLB.nas index c40782c1..2c4a3abb 100644 --- a/Nasal/MCDU/WINDCLB.nas +++ b/Nasal/MCDU/WINDCLB.nas @@ -143,6 +143,10 @@ var windCLBPage = { canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); } }, + reload: func() { + me._setupPageWithData(); + me.updateTmpy(); + }, pushButtonLeft: func(index) { if (size(me.windList) >= index) { if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) == 13) { diff --git a/Nasal/MCDU/WINDCRZ.nas b/Nasal/MCDU/WINDCRZ.nas index 6e43c848..22468710 100644 --- a/Nasal/MCDU/WINDCRZ.nas +++ b/Nasal/MCDU/WINDCRZ.nas @@ -27,14 +27,20 @@ var windCRZPage = { R6: [nil, nil, "ack"], scroll: 0, vector: [], - index: nil, + #index: nil, computer: nil, + cur_location: 0, windList: [], - new: func(computer) { #, waypoint + singleCRZ: 0, + new: func(computer, waypoint, cur_location) { var wcp = {parents:[windCRZPage]}; wcp.computer = computer; wcp.windList = [nil]; - #wcp.waypoint = waypoint; + wcp.waypoint = waypoint; + wcp.cur_location = cur_location; + if (waypoint == nil) { + wcp.singleCRZ = 1; + } wcp._setupPageWithData(); wcp.updateTmpy(); return wcp; @@ -43,8 +49,11 @@ var windCRZPage = { return nil; }, _setupPageWithData: func() { - me.title = ["CRZ WIND", " AT ", "TEMP"]; - #me.title = ["CRZ WIND", " AT ", me.waypoint.wp_name]; + if (me.singleCRZ == 1) { + me.title = ["","CRZ WIND",""]; + } else { + me.title = ["CRZ WIND", " AT ", me.waypoint.wp_name]; + } me.titleColour = "wht"; if (size(me.windList) >= 4) { @@ -108,5 +117,31 @@ var windCRZPage = { #draft title canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); } + }, + reload: func() { + me._setupPageWithData(); + me.updateTmpy(); + }, + pushButtonUp: func() { + if (me.cur_location < size(fmgc.flightPlanController.getWaypointList(2)) - 1) { + me.cur_location = me.cur_location + 1; + } else { + me.cur_location = 0; + } + me.waypoint = fmgc.flightPlanController.getWaypointList(2)[me.cur_location]; + me.windList = []; + #load stored data here + me.reload(); + }, + pushButtonDown: func() { + if (me.cur_location > 0) { + me.cur_location = me.cur_location - 1; + } else { + me.cur_location = size(fmgc.flightPlanController.getWaypointList(2)) - 1; + } + me.waypoint = fmgc.flightPlanController.getWaypointList(2)[me.cur_location]; + me.windList = []; + #load stored data here + me.reload(); } }; \ No newline at end of file diff --git a/Nasal/MCDU/WINDDES.nas b/Nasal/MCDU/WINDDES.nas index 8bcfdad9..08a9fd2e 100644 --- a/Nasal/MCDU/WINDDES.nas +++ b/Nasal/MCDU/WINDDES.nas @@ -115,5 +115,9 @@ var windDESPage = { #draft title canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); } + }, + reload: func() { + me._setupPageWithData(); + me.updateTmpy(); } }; \ No newline at end of file diff --git a/Nasal/MCDU/WINDHIST.nas b/Nasal/MCDU/WINDHIST.nas index 2f79b9bd..6dace8e6 100644 --- a/Nasal/MCDU/WINDHIST.nas +++ b/Nasal/MCDU/WINDHIST.nas @@ -101,5 +101,9 @@ var windHISTPage = { me.C5[2] = "blu"; canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); } + }, + reload: func() { + me._setupPageWithData(); + me.updateTmpy(); } }; \ No newline at end of file From e05289b324026562c30f45a89f5c72f3ce366466 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Sun, 31 May 2020 21:30:49 -0400 Subject: [PATCH 08/53] Enable text entry on crz/des pages --- Nasal/MCDU/MCDU.nas | 20 ++++++++++++ Nasal/MCDU/WINDCRZ.nas | 72 +++++++++++++++++++++++++++++++++------- Nasal/MCDU/WINDDES.nas | 74 +++++++++++++++++++++++++++++++++++++----- 3 files changed, 146 insertions(+), 20 deletions(-) diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 7aaec7a1..a93b4c84 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -209,6 +209,10 @@ var lskbutton = func(btn, i) { initInputB("L1",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") { canvas_mcdu.myCLBWIND[i].pushButtonLeft(1); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") { + canvas_mcdu.myCRZWIND[i].pushButtonLeft(1); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") { + canvas_mcdu.myDESWIND[i].pushButtonLeft(1); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PROGTO") { progTOInput("L1",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PROGCLB") { @@ -254,6 +258,10 @@ var lskbutton = func(btn, i) { initInputA("L2",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") { canvas_mcdu.myCLBWIND[i].pushButtonLeft(2); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") { + canvas_mcdu.myCRZWIND[i].pushButtonLeft(2); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") { + canvas_mcdu.myDESWIND[i].pushButtonLeft(2); } else if (getprop("MCDU[" ~ i ~ "]/page") == "PERFTO") { perfTOInput("L2",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") { @@ -294,6 +302,10 @@ var lskbutton = func(btn, i) { fuelPredInput("L3",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") { canvas_mcdu.myCLBWIND[i].pushButtonLeft(3); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") { + canvas_mcdu.myCRZWIND[i].pushButtonLeft(3); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") { + canvas_mcdu.myDESWIND[i].pushButtonLeft(3); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") { perfTOInput("L3",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") { @@ -339,6 +351,10 @@ var lskbutton = func(btn, i) { fuelPredInput("L4",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") { canvas_mcdu.myCLBWIND[i].pushButtonLeft(4); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") { + canvas_mcdu.myCRZWIND[i].pushButtonLeft(4); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") { + canvas_mcdu.myDESWIND[i].pushButtonLeft(4); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") { perfTOInput("L4",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") { @@ -369,6 +385,10 @@ var lskbutton = func(btn, i) { fuelPredInput("L5",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") { canvas_mcdu.myCLBWIND[i].pushButtonLeft(5); + # } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") { +# canvas_mcdu.myCRZWIND[i].pushButtonLeft(5); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") { + canvas_mcdu.myDESWIND[i].pushButtonLeft(5); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") { perfTOInput("L5",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFCLB") { diff --git a/Nasal/MCDU/WINDCRZ.nas b/Nasal/MCDU/WINDCRZ.nas index 22468710..017f38c0 100644 --- a/Nasal/MCDU/WINDCRZ.nas +++ b/Nasal/MCDU/WINDCRZ.nas @@ -30,7 +30,7 @@ var windCRZPage = { #index: nil, computer: nil, cur_location: 0, - windList: [], + windList: [nil], singleCRZ: 0, new: func(computer, waypoint, cur_location) { var wcp = {parents:[windCRZPage]}; @@ -55,27 +55,54 @@ var windCRZPage = { me.title = ["CRZ WIND", " AT ", me.waypoint.wp_name]; } me.titleColour = "wht"; - + me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 1, 0]]; + me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["ack", "ack", "ack", "wht", "wht", "ack"]]; + me.fontMatrix = [[1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0]]; + if (size(me.windList) >= 4) { - me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"]; + if (me.windList[3] != nil) { + me.L4 = [me.windList[3][0] ~ "/" ~ me.windList[3][1] ~ "/" ~ me.windList[3][2], nil, "blu"]; + me.fontMatrix[0][3] = 0; + } else { + me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"]; + me.fontMatrix[0][3] = 1; + } } else { me.L4 = [nil, nil, "ack"]; } if (size(me.windList) >= 3) { - me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"]; + if (me.windList[2] != nil) { + me.L3 = [me.windList[2][0] ~ "/" ~ me.windList[2][1] ~ "/" ~ me.windList[2][2], nil, "blu"]; + me.fontMatrix[0][2] = 0; + } else { + me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"]; + me.fontMatrix[0][2] = 1; + } } else { me.L3 = [nil, nil, "ack"]; } if (size(me.windList) >= 2) { - me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"]; + if (me.windList[1] != nil) { + me.L2 = [me.windList[1][0] ~ "/" ~ me.windList[1][1] ~ "/" ~ me.windList[1][2], nil, "blu"]; + me.fontMatrix[0][1] = 0; + } else { + me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"]; + me.fontMatrix[0][1] = 1; + } } else { me.L2 = [nil, nil, "ack"]; } if (size(me.windList) >= 1) { - me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"]; + if (me.windList[0] != nil) { + me.L1 = [me.windList[0][0] ~ "/" ~ me.windList[0][1] ~ "/" ~ me.windList[0][2], "TRU WIND/ALT", "blu"]; + me.fontMatrix[0][0] = 0; + } else { + me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"]; + me.fontMatrix[0][0] = 1; + } } me.L5 = ["[ ]/[ ]", "SAT / ALT", "blu"]; @@ -83,9 +110,6 @@ var windCRZPage = { me.R4 = [" PHASE ", "PREV ", "wht"]; me.R5 = [" PHASE ", "NEXT ", "wht"]; - me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 1, 0]]; - me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["ack", "ack", "ack", "wht", "wht", "ack"]]; - me.fontMatrix = [[1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0]]; canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); }, makeTmpy: func() { @@ -122,6 +146,32 @@ var windCRZPage = { me._setupPageWithData(); me.updateTmpy(); }, + pushButtonLeft: func(index) { + if (size(me.windList) >= index) { + if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) == 13) { + var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad); + if (size(winds[0]) == 3 and num(winds[0]) != nil and winds[0] >= 0 and winds[0] <= 360 and + size(winds[1]) == 3 and num(winds[1]) != nil and winds[1] >= 0 and winds[1] <= 200 and + size(winds[2]) == 5 and ((num(winds[2]) != nil and winds[2] >= 1000 and winds[2] <= 39000) or + (num(split("FL", winds[2])[1]) != nil and split("FL", winds[2])[1] >= 10 and split("FL", winds[2])[1] <= 390))) { + me.windList[index - 1] = [winds[0], winds[1], winds[2]]; + mcdu_scratchpad.scratchpads[me.computer].empty(); + if (index != 4) { + append(me.windList, nil); + } + me._setupPageWithData(); + me.makeTmpy(); + me.updateTmpy(); + } else { + mcdu_message(me.computer, "NOT ALLOWED"); + } + } else { + mcdu_message(me.computer, "NOT ALLOWED"); + } + } else { + mcdu_message(me.computer, "NOT ALLOWED"); + } + }, pushButtonUp: func() { if (me.cur_location < size(fmgc.flightPlanController.getWaypointList(2)) - 1) { me.cur_location = me.cur_location + 1; @@ -129,7 +179,7 @@ var windCRZPage = { me.cur_location = 0; } me.waypoint = fmgc.flightPlanController.getWaypointList(2)[me.cur_location]; - me.windList = []; + me.windList = [nil]; #load stored data here me.reload(); }, @@ -140,7 +190,7 @@ var windCRZPage = { me.cur_location = size(fmgc.flightPlanController.getWaypointList(2)) - 1; } me.waypoint = fmgc.flightPlanController.getWaypointList(2)[me.cur_location]; - me.windList = []; + me.windList = [nil]; #load stored data here me.reload(); } diff --git a/Nasal/MCDU/WINDDES.nas b/Nasal/MCDU/WINDDES.nas index 08a9fd2e..4d369408 100644 --- a/Nasal/MCDU/WINDDES.nas +++ b/Nasal/MCDU/WINDDES.nas @@ -46,42 +46,72 @@ var windDESPage = { me.title = "DES WIND"; #me.title = ["DES WIND", " AT ", me.waypoint.wp_name]; me.titleColour = "wht"; + me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 0]]; + me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["ack", "ack", "ack", "wht", "ack", "ack"]]; + me.fontMatrix = [[1, 1, 1, 1, 1, 0], [1, 0, 0, 0, 0, 0]]; if (size(me.windList) >= 5) { - me.L5 = ["[ ]/[ ]/[ ]", nil, "blu"]; + if (me.windList[4] != nil) { + me.L5 = [me.windList[4][0] ~ "/" ~ me.windList[4][1] ~ "/" ~ me.windList[4][2], nil, "blu"]; + me.fontMatrix[0][4] = 0; + } else { + me.L5 = ["[ ]/[ ]/[ ]", nil, "blu"]; + me.fontMatrix[0][4] = 1; + } } else { me.L5 = [nil, nil, "ack"]; } if (size(me.windList) >= 4) { - me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"]; + if (me.windList[3] != nil) { + me.L4 = [me.windList[3][0] ~ "/" ~ me.windList[3][1] ~ "/" ~ me.windList[3][2], nil, "blu"]; + me.fontMatrix[0][3] = 0; + } else { + me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"]; + me.fontMatrix[0][3] = 1; + } } else { me.L4 = [nil, nil, "ack"]; } if (size(me.windList) >= 3) { - me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"]; + if (me.windList[2] != nil) { + me.L3 = [me.windList[2][0] ~ "/" ~ me.windList[2][1] ~ "/" ~ me.windList[2][2], nil, "blu"]; + me.fontMatrix[0][2] = 0; + } else { + me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"]; + me.fontMatrix[0][2] = 1; + } } else { me.L3 = [nil, nil, "ack"]; } if (size(me.windList) >= 2) { - me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"]; + if (me.windList[1] != nil) { + me.L2 = [me.windList[1][0] ~ "/" ~ me.windList[1][1] ~ "/" ~ me.windList[1][2], nil, "blu"]; + me.fontMatrix[0][1] = 0; + } else { + me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"]; + me.fontMatrix[0][1] = 1; + } } else { me.L2 = [nil, nil, "ack"]; } if (size(me.windList) >= 1) { - me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"]; + if (me.windList[0] != nil) { + me.L1 = [me.windList[0][0] ~ "/" ~ me.windList[0][1] ~ "/" ~ me.windList[0][2], "TRU WIND/ALT", "blu"]; + me.fontMatrix[0][0] = 0; + } else { + me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"]; + me.fontMatrix[0][0] = 1; + } } me.R1 = ["[ ]/[ ]", "ALTN WIND ", "blu"]; me.R3 = [" REQUEST ", "WIND ", "amb"]; me.R4 = [" PHASE ", "PREV ", "wht"]; - - me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 0, 0]]; - me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["ack", "ack", "ack", "wht", "ack", "ack"]]; - me.fontMatrix = [[1, 1, 1, 1, 1, 0], [1, 0, 0, 0, 0, 0]]; + canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); }, makeTmpy: func() { @@ -119,5 +149,31 @@ var windDESPage = { reload: func() { me._setupPageWithData(); me.updateTmpy(); + }, + pushButtonLeft: func(index) { + if (size(me.windList) >= index) { + if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) == 13) { + var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad); + if (size(winds[0]) == 3 and num(winds[0]) != nil and winds[0] >= 0 and winds[0] <= 360 and + size(winds[1]) == 3 and num(winds[1]) != nil and winds[1] >= 0 and winds[1] <= 200 and + size(winds[2]) == 5 and ((num(winds[2]) != nil and winds[2] >= 1000 and winds[2] <= 39000) or + (num(split("FL", winds[2])[1]) != nil and split("FL", winds[2])[1] >= 10 and split("FL", winds[2])[1] <= 390))) { + me.windList[index - 1] = [winds[0], winds[1], winds[2]]; + mcdu_scratchpad.scratchpads[me.computer].empty(); + if (index != 5) { + append(me.windList, nil); + } + me._setupPageWithData(); + me.makeTmpy(); + me.updateTmpy(); + } else { + mcdu_message(me.computer, "NOT ALLOWED"); + } + } else { + mcdu_message(me.computer, "NOT ALLOWED"); + } + } else { + mcdu_message(me.computer, "NOT ALLOWED"); + } } }; \ No newline at end of file From e2153f9281b5ed11c8d5589c58edbb325100f186 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Mon, 1 Jun 2020 18:12:33 -0400 Subject: [PATCH 09/53] Store crz wind data in waypoint --- Nasal/FMGC/flightplan.nas | 64 ++++++++++++++++++++++++++- Nasal/MCDU/MCDU.nas | 72 ++++++++++++++++++++++--------- Nasal/MCDU/WINDCRZ.nas | 91 +++++++++++++++++++++++++++++++++------ 3 files changed, 191 insertions(+), 36 deletions(-) diff --git a/Nasal/FMGC/flightplan.nas b/Nasal/FMGC/flightplan.nas index 8b16d6c3..c90dc075 100644 --- a/Nasal/FMGC/flightplan.nas +++ b/Nasal/FMGC/flightplan.nas @@ -29,6 +29,21 @@ var wpCourse = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/course", 0, " var wpDistance = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/distance", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/distance", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/distance", 0, "DOUBLE")]]; var wpCoursePrev = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/course-from-prev", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/course-from-prev", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/course-from-prev", 0, "DOUBLE")]]; var wpDistancePrev = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/distance-from-prev", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/distance-from-prev", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/distance-from-prev", 0, "DOUBLE")]]; +var wpWindDirection0 = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/wind[0]/direction", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/wind[0]/direction", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/wind[0]/direction", 0, "DOUBLE")]]; +var wpWindMagnitude0 = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/wind[0]/magnitude", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/wind[0]/magnitude", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/wind[0]/magnitude", 0, "DOUBLE")]]; +var wpWindAltitude0 = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/wind[0]/altitude", "", "STRING")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/wind[0]/altitude", "", "STRING")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/wind[0]/altitude", "", "STRING")]]; + +var wpWindDirection1 = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/wind[1]/direction", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/wind[1]/direction", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/wind[1]/direction", 0, "DOUBLE")]]; +var wpWindMagnitude1 = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/wind[1]/magnitude", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/wind[1]/magnitude", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/wind[1]/magnitude", 0, "DOUBLE")]]; +var wpWindAltitude1 = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/wind[1]/altitude", "", "STRING")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/wind[1]/altitude", "", "STRING")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/wind[1]/altitude", "", "STRING")]]; + +var wpWindDirection2 = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/wind[2]/direction", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/wind[2]/direction", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/wind[2]/direction", 0, "DOUBLE")]]; +var wpWindMagnitude2 = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/wind[2]/magnitude", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/wind[2]/magnitude", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/wind[2]/magnitude", 0, "DOUBLE")]]; +var wpWindAltitude2 = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/wind[2]/altitude", "", "STRING")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/wind[2]/altitude", "", "STRING")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/wind[2]/altitude", "", "STRING")]]; + +var wpWindDirection3 = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/wind[3]/direction", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/wind[3]/direction", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/wind[3]/direction", 0, "DOUBLE")]]; +var wpWindMagnitude3 = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/wind[3]/magnitude", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/wind[3]/magnitude", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/wind[3]/magnitude", 0, "DOUBLE")]]; +var wpWindAltitude3 = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/wind[3]/altitude", "", "STRING")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/wind[3]/altitude", "", "STRING")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/wind[3]/altitude", "", "STRING")]]; var flightPlanController = { flightplans: [createFlightplan(), createFlightplan(), createFlightplan(), nil], @@ -113,6 +128,25 @@ var flightPlanController = { me.flightplans[2] = me.flightplans[n].clone(); me.flightPlanChanged(2); flightPlanTimer.start(); + + # copy winds since they are not part of the waypoint object + for (var counter = 0; counter < me.flightplans[n].getPlanSize(); counter += 1) { + wpWindDirection0[2][counter].setValue(wpWindDirection0[n][counter].getValue()); + wpWindMagnitude0[2][counter].setValue(wpWindMagnitude0[n][counter].getValue()); + wpWindAltitude0[2][counter].setValue(wpWindAltitude0[n][counter].getValue()); + + wpWindDirection1[2][counter].setValue(wpWindDirection1[n][counter].getValue()); + wpWindMagnitude1[2][counter].setValue(wpWindMagnitude1[n][counter].getValue()); + wpWindAltitude1[2][counter].setValue(wpWindAltitude1[n][counter].getValue()); + + wpWindDirection2[2][counter].setValue(wpWindDirection2[n][counter].getValue()); + wpWindMagnitude2[2][counter].setValue(wpWindMagnitude2[n][counter].getValue()); + wpWindAltitude2[2][counter].setValue(wpWindAltitude2[n][counter].getValue()); + + wpWindDirection3[2][counter].setValue(wpWindDirection3[n][counter].getValue()); + wpWindMagnitude3[2][counter].setValue(wpWindMagnitude3[n][counter].getValue()); + wpWindAltitude3[2][counter].setValue(wpWindAltitude3[n][counter].getValue()); + } } if (n == 3) { return; } me.resetFlightplan(n); @@ -530,14 +564,23 @@ var flightPlanController = { getWaypointList: func(plan) { var waypointsList = []; for (var index = 1; index < me.arrivalIndex[plan]; index += 1) { - #print(me.flightplans[plan].getWP(index).wp_name); - if (me.flightplans[plan].getWP(index).wp_name != "DISCONTINUITY" and me.flightplans[plan].getWP(index).wp_type != "vectors" and me.flightplans[plan].getWP(index).wp_type != "hdgToAlt") { + if (me.flightplans[plan].getWP(index).wp_name != "DISCONTINUITY" and me.flightplans[plan].getWP(index).wp_type != "vectors" and me.flightplans[plan].getWP(index).wp_type != "hdgToAlt" and me.flightplans[plan].getWP(index).wp_type != "sid" and me.flightplans[plan].getWP(index).wp_type != "star" and me.flightplans[plan].getWP(index).wp_type != "approach") { append(waypointsList, me.flightplans[plan].getWP(index)); } } return waypointsList; }, + getWaypointMapping: func(plan) { + var waypointsMapping = []; + for (var index = 1; index < me.arrivalIndex[plan]; index += 1) { + if (me.flightplans[plan].getWP(index).wp_name != "DISCONTINUITY" and me.flightplans[plan].getWP(index).wp_type != "vectors" and me.flightplans[plan].getWP(index).wp_type != "hdgToAlt" and me.flightplans[plan].getWP(index).wp_type != "sid" and me.flightplans[plan].getWP(index).wp_type != "star" and me.flightplans[plan].getWP(index).wp_type != "approach") { + append(waypointsMapping, index); + } + } + return waypointsMapping; + }, + # getWPforPBD - parse scratchpad text to find waypoint ghost for PBD # args: text, index, plan # text: scratchpad text @@ -674,7 +717,24 @@ var flightPlanController = { append(wpDistance[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/distance", 0, "DOUBLE")); append(wpCoursePrev[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/course-from-prev", 0, "DOUBLE")); append(wpDistancePrev[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/distance-from-prev", 0, "DOUBLE")); + + append(wpWindDirection0[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/wind[0]/direction", 0, "DOUBLE")); + append(wpWindMagnitude0[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/wind[0]/magnitude", 0, "DOUBLE")); + append(wpWindAltitude0[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/wind[0]/altitude", "", "STRING")); + + append(wpWindDirection1[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/wind[1]/direction", 0, "DOUBLE")); + append(wpWindMagnitude1[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/wind[1]/magnitude", 0, "DOUBLE")); + append(wpWindAltitude1[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/wind[1]/altitude", "", "STRING")); + + append(wpWindDirection2[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/wind[2]/direction", 0, "DOUBLE")); + append(wpWindMagnitude2[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/wind[2]/magnitude", 0, "DOUBLE")); + append(wpWindAltitude2[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/wind[2]/altitude", "", "STRING")); + + append(wpWindDirection3[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/wind[3]/direction", 0, "DOUBLE")); + append(wpWindMagnitude3[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/wind[3]/magnitude", 0, "DOUBLE")); + append(wpWindAltitude3[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/wind[3]/altitude", "", "STRING")); } + me.updatePlans(); # push update to fuel if (getprop("/FMGC/internal/block-confirmed")) { diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index a93b4c84..15609c39 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -587,21 +587,36 @@ var rskbutton = func(btn, i) { } setprop("MCDU[" ~ i ~ "]/page", "WINDCLB"); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") { - if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.flightPlanController.getWaypointList(2)) > 0) { - if (canvas_mcdu.myCRZWIND[i] != nil) { - canvas_mcdu.myCRZWIND[i].del(); + if (fmgc.flightPlanController.temporaryFlag[i]) { + if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.flightPlanController.getWaypointList(i)) > 0) { + if (canvas_mcdu.myCRZWIND[i] != nil) { + canvas_mcdu.myCRZWIND[i].del(); + } + canvas_mcdu.myCRZWIND[i] = nil; + canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, fmgc.flightPlanController.getWaypointList(i)[0], 0); + } else { + if (canvas_mcdu.myCRZWIND[i] == nil) { + canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, nil, nil); + } else { + canvas_mcdu.myCRZWIND[i].reload(); + } } - canvas_mcdu.myCRZWIND[i] = nil; - canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, fmgc.flightPlanController.getWaypointList(2)[0], 0); - setprop("MCDU[" ~ i ~ "]/page", "WINDCRZ"); } else { - if (canvas_mcdu.myCRZWIND[i] != nil) { - canvas_mcdu.myCRZWIND[i].del(); + if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.flightPlanController.getWaypointList(2)) > 0) { + if (canvas_mcdu.myCRZWIND[i] != nil) { + canvas_mcdu.myCRZWIND[i].del(); + } + canvas_mcdu.myCRZWIND[i] = nil; + canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, fmgc.flightPlanController.getWaypointList(2)[0], 0); + } else { + if (canvas_mcdu.myCRZWIND[i] == nil) { + canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, nil, nil); + } else { + canvas_mcdu.myCRZWIND[i].reload(); + } } - canvas_mcdu.myCRZWIND[i] = nil; - canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, nil, nil); - setprop("MCDU[" ~ i ~ "]/page", "WINDCRZ"); } + setprop("MCDU[" ~ i ~ "]/page", "WINDCRZ"); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") { perfTOInput("R4",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFAPPR") { @@ -625,19 +640,34 @@ var rskbutton = func(btn, i) { } else if (getprop("/MCDU[" ~ i ~ "]/page") == "INITB") { initInputB("R5",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") { - if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.flightPlanController.getWaypointList(2)) > 0) { - if (canvas_mcdu.myCRZWIND[i] != nil) { - canvas_mcdu.myCRZWIND[i].del(); + if (fmgc.flightPlanController.temporaryFlag[i]) { + if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.flightPlanController.getWaypointList(i)) > 0) { + if (canvas_mcdu.myCRZWIND[i] != nil) { + canvas_mcdu.myCRZWIND[i].del(); + } + canvas_mcdu.myCRZWIND[i] = nil; + canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, fmgc.flightPlanController.getWaypointList(i)[0], 0); + } else { + if (canvas_mcdu.myCRZWIND[i] == nil) { + canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, nil, nil); + } else { + canvas_mcdu.myCRZWIND[i].reload(); + } } - canvas_mcdu.myCRZWIND[i] = nil; - canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, fmgc.flightPlanController.getWaypointList(2)[0], 0); } else { - if (canvas_mcdu.myCRZWIND[i] != nil) { - canvas_mcdu.myCRZWIND[i].del(); + if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.flightPlanController.getWaypointList(2)) > 0) { + if (canvas_mcdu.myCRZWIND[i] != nil) { + canvas_mcdu.myCRZWIND[i].del(); + } + canvas_mcdu.myCRZWIND[i] = nil; + canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, fmgc.flightPlanController.getWaypointList(2)[0], 0); + } else { + if (canvas_mcdu.myCRZWIND[i] == nil) { + canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, nil, nil); + } else { + canvas_mcdu.myCRZWIND[i].reload(); + } } - canvas_mcdu.myCRZWIND[i] = nil; - canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, nil, nil); - setprop("MCDU[" ~ i ~ "]/page", "WINDCRZ"); } setprop("MCDU[" ~ i ~ "]/page", "WINDCRZ"); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") { diff --git a/Nasal/MCDU/WINDCRZ.nas b/Nasal/MCDU/WINDCRZ.nas index 017f38c0..b6856e3c 100644 --- a/Nasal/MCDU/WINDCRZ.nas +++ b/Nasal/MCDU/WINDCRZ.nas @@ -30,6 +30,7 @@ var windCRZPage = { #index: nil, computer: nil, cur_location: 0, + match_location: 0, windList: [nil], singleCRZ: 0, new: func(computer, waypoint, cur_location) { @@ -41,6 +42,7 @@ var windCRZPage = { if (waypoint == nil) { wcp.singleCRZ = 1; } + wcp.match_location = fmgc.flightPlanController.getWaypointMapping(2)[wcp.cur_location]; wcp._setupPageWithData(); wcp.updateTmpy(); return wcp; @@ -58,10 +60,52 @@ var windCRZPage = { me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 1, 1, 0]]; me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["ack", "ack", "ack", "wht", "wht", "ack"]]; me.fontMatrix = [[1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0]]; - + + # load wind list + if (me.singleCRZ == 0) { + if (fmgc.flightPlanController.temporaryFlag[me.computer]) { + #get from 0 + me.windList = [nil]; + if (fmgc.wpWindAltitude0[me.computer][me.match_location].getValue() != "") { + me.windList[0] = [fmgc.wpWindDirection0[me.computer][me.match_location].getValue(), fmgc.wpWindMagnitude0[me.computer][me.match_location].getValue(), fmgc.wpWindAltitude0[me.computer][me.match_location].getValue()]; + append(me.windList, nil); + } + if (fmgc.wpWindAltitude1[me.computer][me.match_location].getValue() != "") { + me.windList[1] = [fmgc.wpWindDirection1[me.computer][me.match_location].getValue(), fmgc.wpWindMagnitude1[me.computer][me.match_location].getValue(), fmgc.wpWindAltitude1[me.computer][me.match_location].getValue()]; + append(me.windList, nil); + } + if (fmgc.wpWindAltitude2[me.computer][me.match_location].getValue() != "") { + me.windList[2] = [fmgc.wpWindDirection2[me.computer][me.match_location].getValue(), fmgc.wpWindMagnitude2[me.computer][me.match_location].getValue(), fmgc.wpWindAltitude2[me.computer][me.match_location].getValue()]; + append(me.windList, nil); + } + if (fmgc.wpWindAltitude3[me.computer][me.match_location].getValue() != "") { + me.windList[3] = [fmgc.wpWindDirection3[me.computer][me.match_location].getValue(), fmgc.wpWindMagnitude3[me.computer][me.match_location].getValue(), fmgc.wpWindAltitude3[me.computer][me.match_location].getValue()]; + } + } else { + #get from 2 + me.windList = [nil]; + if (fmgc.wpWindAltitude0[2][me.match_location].getValue() != "") { + me.windList[0] = [fmgc.wpWindDirection0[2][me.match_location].getValue(), fmgc.wpWindMagnitude0[2][me.match_location].getValue(), fmgc.wpWindAltitude0[2][me.match_location].getValue()]; + append(me.windList, nil); + } + if (fmgc.wpWindAltitude1[2][me.match_location].getValue() != "") { + me.windList[1] = [fmgc.wpWindDirection1[2][me.match_location].getValue(), fmgc.wpWindMagnitude1[2][me.match_location].getValue(), fmgc.wpWindAltitude1[2][me.match_location].getValue()]; + append(me.windList, nil); + } + if (fmgc.wpWindAltitude2[2][me.match_location].getValue() != "") { + me.windList[2] = [fmgc.wpWindDirection2[2][me.match_location].getValue(), fmgc.wpWindMagnitude2[2][me.match_location].getValue(), fmgc.wpWindAltitude2[2][me.match_location].getValue()]; + append(me.windList, nil); + } + if (fmgc.wpWindAltitude3[2][me.match_location].getValue() != "") { + me.windList[3] = [fmgc.wpWindDirection3[2][me.match_location].getValue(), fmgc.wpWindMagnitude3[2][me.match_location].getValue(), fmgc.wpWindAltitude3[2][me.match_location].getValue()]; + } + } + } + + # load data if (size(me.windList) >= 4) { if (me.windList[3] != nil) { - me.L4 = [me.windList[3][0] ~ "/" ~ me.windList[3][1] ~ "/" ~ me.windList[3][2], nil, "blu"]; + me.L4 = [sprintf("%03d", me.windList[3][0]) ~ "/" ~ sprintf("%03d", me.windList[3][1]) ~ "/" ~ me.windList[3][2], nil, "blu"]; me.fontMatrix[0][3] = 0; } else { me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -73,7 +117,7 @@ var windCRZPage = { if (size(me.windList) >= 3) { if (me.windList[2] != nil) { - me.L3 = [me.windList[2][0] ~ "/" ~ me.windList[2][1] ~ "/" ~ me.windList[2][2], nil, "blu"]; + me.L3 = ["%03d", me.windList[2][0]) ~ "/" ~ sprintf("%03d", me.windList[2][1]) ~ "/" ~ me.windList[2][2], nil, "blu"]; me.fontMatrix[0][2] = 0; } else { me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -85,7 +129,7 @@ var windCRZPage = { if (size(me.windList) >= 2) { if (me.windList[1] != nil) { - me.L2 = [me.windList[1][0] ~ "/" ~ me.windList[1][1] ~ "/" ~ me.windList[1][2], nil, "blu"]; + me.L2 = ["%03d", me.windList[1][0]) ~ "/" ~ sprintf("%03d", me.windList[1][1]) ~ "/" ~ me.windList[1][2], nil, "blu"]; me.fontMatrix[0][1] = 0; } else { me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -97,7 +141,7 @@ var windCRZPage = { if (size(me.windList) >= 1) { if (me.windList[0] != nil) { - me.L1 = [me.windList[0][0] ~ "/" ~ me.windList[0][1] ~ "/" ~ me.windList[0][2], "TRU WIND/ALT", "blu"]; + me.L1 = ["%03d", me.windList[0][0]) ~ "/" ~ sprintf("%03d", me.windList[0][1]) ~ "/" ~ me.windList[0][2], "TRU WIND/ALT", "blu"]; me.fontMatrix[0][0] = 0; } else { me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"]; @@ -147,6 +191,7 @@ var windCRZPage = { me.updateTmpy(); }, pushButtonLeft: func(index) { + #destroyTemporaryFlightPlan if (size(me.windList) >= index) { if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) == 13) { var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad); @@ -154,13 +199,33 @@ var windCRZPage = { size(winds[1]) == 3 and num(winds[1]) != nil and winds[1] >= 0 and winds[1] <= 200 and size(winds[2]) == 5 and ((num(winds[2]) != nil and winds[2] >= 1000 and winds[2] <= 39000) or (num(split("FL", winds[2])[1]) != nil and split("FL", winds[2])[1] >= 10 and split("FL", winds[2])[1] <= 390))) { - me.windList[index - 1] = [winds[0], winds[1], winds[2]]; - mcdu_scratchpad.scratchpads[me.computer].empty(); - if (index != 4) { - append(me.windList, nil); - } - me._setupPageWithData(); me.makeTmpy(); + if (me.singleCRZ == 1) { + me.windList[index - 1] = [winds[0], winds[1], winds[2]]; + if (index != 4) { + append(me.windList, nil); + } + } else { + if (index == 1) { + fmgc.wpWindDirection0[me.computer][me.match_location].setValue(num(winds[0])); + fmgc.wpWindMagnitude0[me.computer][me.match_location].setValue(num(winds[1])); + fmgc.wpWindAltitude0[me.computer][me.match_location].setValue(winds[2]); + } else if (index == 2) { + fmgc.wpWindDirection1[me.computer][me.match_location].setValue(num(winds[0])); + fmgc.wpWindMagnitude1[me.computer][me.match_location].setValue(num(winds[1])); + fmgc.wpWindAltitude1[me.computer][me.match_location].setValue(winds[2]); + } else if (index == 3) { + fmgc.wpWindDirection2[me.computer][me.match_location].setValue(num(winds[0])); + fmgc.wpWindMagnitude2[me.computer][me.match_location].setValue(num(winds[1])); + fmgc.wpWindAltitude2[me.computer][me.match_location].setValue(winds[2]); + } else if (index == 4) { + fmgc.wpWindDirection3[me.computer][me.match_location].setValue(num(winds[0])); + fmgc.wpWindMagnitude3[me.computer][me.match_location].setValue(num(winds[1])); + fmgc.wpWindAltitude3[me.computer][me.match_location].setValue(winds[2]); + } + } + mcdu_scratchpad.scratchpads[me.computer].empty(); + me._setupPageWithData(); me.updateTmpy(); } else { mcdu_message(me.computer, "NOT ALLOWED"); @@ -179,7 +244,7 @@ var windCRZPage = { me.cur_location = 0; } me.waypoint = fmgc.flightPlanController.getWaypointList(2)[me.cur_location]; - me.windList = [nil]; + me.match_location = fmgc.flightPlanController.getWaypointMapping(2)[me.cur_location]; #load stored data here me.reload(); }, @@ -190,7 +255,7 @@ var windCRZPage = { me.cur_location = size(fmgc.flightPlanController.getWaypointList(2)) - 1; } me.waypoint = fmgc.flightPlanController.getWaypointList(2)[me.cur_location]; - me.windList = [nil]; + me.match_location = fmgc.flightPlanController.getWaypointMapping(2)[me.cur_location]; #load stored data here me.reload(); } From 2fbdf9622389d052013ee9e8b54fe942ac2f7e92 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Mon, 1 Jun 2020 20:57:58 -0400 Subject: [PATCH 10/53] Make right MCDU work --- Nasal/FMGC/flightplan.nas | 69 ++++++++++++++++++++++++++++++++++++++- Nasal/MCDU/WINDCLB.nas | 8 ++++- Nasal/MCDU/WINDCRZ.nas | 17 +++++++--- Nasal/MCDU/WINDDES.nas | 8 ++++- Nasal/MCDU/WINDHIST.nas | 7 ++++ 5 files changed, 101 insertions(+), 8 deletions(-) diff --git a/Nasal/FMGC/flightplan.nas b/Nasal/FMGC/flightplan.nas index c90dc075..ebfd481e 100644 --- a/Nasal/FMGC/flightplan.nas +++ b/Nasal/FMGC/flightplan.nas @@ -147,6 +147,8 @@ var flightPlanController = { wpWindMagnitude3[2][counter].setValue(wpWindMagnitude3[n][counter].getValue()); wpWindAltitude3[2][counter].setValue(wpWindAltitude3[n][counter].getValue()); } + + me.updateWind(n); } if (n == 3) { return; } me.resetFlightplan(n); @@ -735,7 +737,8 @@ var flightPlanController = { append(wpWindAltitude3[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/wind[3]/altitude", "", "STRING")); } - me.updatePlans(); + me.updatePlans(); + # push update to fuel if (getprop("/FMGC/internal/block-confirmed")) { setprop("/FMGC/internal/fuel-calculating", 0); @@ -743,6 +746,70 @@ var flightPlanController = { } canvas_nd.A3XXRouteDriver.triggerSignal("fp-added"); }, + + updateWind: func(n) { + if (n == 0) { + if (canvas_mcdu.myCLBWIND[0] != nil and canvas_mcdu.myCLBWIND[1] != nil) { + canvas_mcdu.myCLBWIND[1].windList = canvas_mcdu.myCLBWIND[0].windList; + canvas_mcdu.myCLBWIND[1]._setupPageWithData(); + } + + if (canvas_mcdu.myCRZWIND[0] != nil and canvas_mcdu.myCRZWIND[1] != nil) { + if (!getprop("/FMGC/internal/tofrom-set") and size(me.getWaypointList(0)) == 0) { + canvas_mcdu.myCRZWIND[1].windList = canvas_mcdu.myCRZWIND[0].windList; + } else { + canvas_mcdu.myCRZWIND[1].del(); + canvas_mcdu.myCRZWIND[1] = nil; + canvas_mcdu.myCRZWIND[1] = mcdu.windCRZPage.new(1, me.getWaypointList(2)[0], 0); + } + canvas_mcdu.myCRZWIND[1]._setupPageWithData(); + } else if (canvas_mcdu.myCRZWIND[1] != nil and getprop("/FMGC/internal/tofrom-set") and size(me.getWaypointList(0)) > 0) { + canvas_mcdu.myCRZWIND[1].del(); + canvas_mcdu.myCRZWIND[1] = nil; + canvas_mcdu.myCRZWIND[1] = mcdu.windCRZPage.new(1, me.getWaypointList(2)[0], 0); + canvas_mcdu.myCRZWIND[1]._setupPageWithData(); + } + + if (canvas_mcdu.myDESWIND[0] != nil and canvas_mcdu.myDESWIND[1] != nil) { + canvas_mcdu.myDESWIND[1].windList = canvas_mcdu.myDESWIND[0].windList; + canvas_mcdu.myDESWIND[1]._setupPageWithData(); + } + + if (canvas_mcdu.myHISTWIND[1] != nil) { + canvas_mcdu.myHISTWIND[1]._setupPageWithData(); + } + } else { + if (canvas_mcdu.myCLBWIND[0] != nil and canvas_mcdu.myCLBWIND[1] != nil) { + canvas_mcdu.myCLBWIND[0].windList = canvas_mcdu.myCLBWIND[1].windList; + canvas_mcdu.myCLBWIND[0]._setupPageWithData(); + } + + if (canvas_mcdu.myCRZWIND[0] != nil and canvas_mcdu.myCRZWIND[1] != nil) { + if (!getprop("/FMGC/internal/tofrom-set") and size(me.getWaypointList(1)) == 0) { + canvas_mcdu.myCRZWIND[0].windList = canvas_mcdu.myCRZWIND[1].windList; + } else { + canvas_mcdu.myCRZWIND[0].del(); + canvas_mcdu.myCRZWIND[0] = nil; + canvas_mcdu.myCRZWIND[0] = mcdu.windCRZPage.new(0, me.getWaypointList(2)[0], 0); + } + canvas_mcdu.myCRZWIND[0]._setupPageWithData(); + } else if (canvas_mcdu.myCRZWIND[0] != nil and getprop("/FMGC/internal/tofrom-set") and size(me.getWaypointList(1)) > 0) { + canvas_mcdu.myCRZWIND[0].del(); + canvas_mcdu.myCRZWIND[0] = nil; + canvas_mcdu.myCRZWIND[0] = mcdu.windCRZPage.new(0, me.getWaypointList(2)[0], 0); + canvas_mcdu.myCRZWIND[0]._setupPageWithData(); + } + + if (canvas_mcdu.myDESWIND[0] != nil and canvas_mcdu.myDESWIND[1] != nil) { + canvas_mcdu.myDESWIND[0].windList = canvas_mcdu.myDESWIND[1].windList; + canvas_mcdu.myDESWIND[0]._setupPageWithData(); + } + + if (canvas_mcdu.myHISTWIND[0] != nil) { + canvas_mcdu.myHISTWIND[0]._setupPageWithData(); + } + } + }, updatePlans: func() { me.updateCurrentWaypoint(); diff --git a/Nasal/MCDU/WINDCLB.nas b/Nasal/MCDU/WINDCLB.nas index 2c4a3abb..8e21902a 100644 --- a/Nasal/MCDU/WINDCLB.nas +++ b/Nasal/MCDU/WINDCLB.nas @@ -33,7 +33,13 @@ var windCLBPage = { new: func(computer) { var wcp = {parents:[windCLBPage]}; wcp.computer = computer; - wcp.windList = [nil]; + if (computer == 0 and canvas_mcdu.myCLBWIND[1] != nil) { + wcp.windList = canvas_mcdu.myCLBWIND[1].windList; + } else if (computer == 1 and canvas_mcdu.myCLBWIND[0] != nil) { + wcp.windList = canvas_mcdu.myCLBWIND[0].windList; + } else { + wcp.windList = [nil]; + } wcp._setupPageWithData(); wcp.updateTmpy(); return wcp; diff --git a/Nasal/MCDU/WINDCRZ.nas b/Nasal/MCDU/WINDCRZ.nas index b6856e3c..ab620e59 100644 --- a/Nasal/MCDU/WINDCRZ.nas +++ b/Nasal/MCDU/WINDCRZ.nas @@ -36,13 +36,20 @@ var windCRZPage = { new: func(computer, waypoint, cur_location) { var wcp = {parents:[windCRZPage]}; wcp.computer = computer; - wcp.windList = [nil]; + if (computer == 0 and canvas_mcdu.myCRZWIND[1] != nil) { + wcp.windList = canvas_mcdu.myCRZWIND[1].windList; + } else if (computer == 1 and canvas_mcdu.myCRZWIND[0] != nil) { + wcp.windList = canvas_mcdu.myCRZWIND[0].windList; + } else { + wcp.windList = [nil]; + } wcp.waypoint = waypoint; wcp.cur_location = cur_location; if (waypoint == nil) { wcp.singleCRZ = 1; + } else { + wcp.match_location = fmgc.flightPlanController.getWaypointMapping(2)[wcp.cur_location]; } - wcp.match_location = fmgc.flightPlanController.getWaypointMapping(2)[wcp.cur_location]; wcp._setupPageWithData(); wcp.updateTmpy(); return wcp; @@ -117,7 +124,7 @@ var windCRZPage = { if (size(me.windList) >= 3) { if (me.windList[2] != nil) { - me.L3 = ["%03d", me.windList[2][0]) ~ "/" ~ sprintf("%03d", me.windList[2][1]) ~ "/" ~ me.windList[2][2], nil, "blu"]; + me.L3 = [sprintf("%03d", me.windList[2][0]) ~ "/" ~ sprintf("%03d", me.windList[2][1]) ~ "/" ~ me.windList[2][2], nil, "blu"]; me.fontMatrix[0][2] = 0; } else { me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -129,7 +136,7 @@ var windCRZPage = { if (size(me.windList) >= 2) { if (me.windList[1] != nil) { - me.L2 = ["%03d", me.windList[1][0]) ~ "/" ~ sprintf("%03d", me.windList[1][1]) ~ "/" ~ me.windList[1][2], nil, "blu"]; + me.L2 = [sprintf("%03d", me.windList[1][0]) ~ "/" ~ sprintf("%03d", me.windList[1][1]) ~ "/" ~ me.windList[1][2], nil, "blu"]; me.fontMatrix[0][1] = 0; } else { me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -141,7 +148,7 @@ var windCRZPage = { if (size(me.windList) >= 1) { if (me.windList[0] != nil) { - me.L1 = ["%03d", me.windList[0][0]) ~ "/" ~ sprintf("%03d", me.windList[0][1]) ~ "/" ~ me.windList[0][2], "TRU WIND/ALT", "blu"]; + me.L1 = [sprintf("%03d", me.windList[0][0]) ~ "/" ~ sprintf("%03d", me.windList[0][1]) ~ "/" ~ me.windList[0][2], "TRU WIND/ALT", "blu"]; me.fontMatrix[0][0] = 0; } else { me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"]; diff --git a/Nasal/MCDU/WINDDES.nas b/Nasal/MCDU/WINDDES.nas index 4d369408..1f5dc7f0 100644 --- a/Nasal/MCDU/WINDDES.nas +++ b/Nasal/MCDU/WINDDES.nas @@ -33,7 +33,13 @@ var windDESPage = { new: func(computer) { #, waypoint var wcp = {parents:[windDESPage]}; wcp.computer = computer; - wcp.windList = [nil]; + if (computer == 0 and canvas_mcdu.myDESWIND[1] != nil) { + wcp.windList = canvas_mcdu.myDESWIND[1].windList; + } else if (computer == 1 and canvas_mcdu.myDESWIND[0] != nil) { + wcp.windList = canvas_mcdu.myDESWIND[0].windList; + } else { + wcp.windList = [nil]; + } #wcp.waypoint = waypoint; wcp._setupPageWithData(); wcp.updateTmpy(); diff --git a/Nasal/MCDU/WINDHIST.nas b/Nasal/MCDU/WINDHIST.nas index 6dace8e6..410dd46a 100644 --- a/Nasal/MCDU/WINDHIST.nas +++ b/Nasal/MCDU/WINDHIST.nas @@ -105,5 +105,12 @@ var windHISTPage = { reload: func() { me._setupPageWithData(); me.updateTmpy(); + if (me.computer == 0) { + #canvas_mcdu.myHISTWIND[1].windList = me.windList; + canvas_mcdu.myHISTWIND[1]._setupPageWithData(); + } else { + #canvas_mcdu.myHISTWIND[0].windList = me.windList; + canvas_mcdu.myHISTWIND[0]._setupPageWithData(); + } } }; \ No newline at end of file From 79f8c543a11d5f710d8fbf9b47df3fa4fe93c8bd Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Tue, 9 Jun 2020 22:42:30 -0400 Subject: [PATCH 11/53] Completed wind store logic (not implemented in mcdu yet) --- A320-main.xml | 1 + Nasal/FMGC/FMGC.nas | 2 + Nasal/FMGC/flightplan.nas | 189 +++++++---------------- Nasal/FMGC/winds.nas | 282 ++++++++++++++++++++++++++++++++++ Nasal/Libraries/libraries.nas | 2 + Nasal/MCDU/INITA.nas | 2 + Nasal/MCDU/WINDCRZ.nas | 4 +- 7 files changed, 343 insertions(+), 139 deletions(-) create mode 100644 Nasal/FMGC/winds.nas diff --git a/A320-main.xml b/A320-main.xml index b4712a4c..4a6d71a3 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -4040,6 +4040,7 @@ Aircraft/A320-family/Nasal/FMGC/FMGC.nas Aircraft/A320-family/Nasal/FMGC/FMGC-b.nas Aircraft/A320-family/Nasal/FMGC/FMGC-c.nas + Aircraft/A320-family/Nasal/FMGC/winds.nas Aircraft/A320-family/Nasal/MCDU/DUPLICATE.nas diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index efb38c8d..bbc31c76 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -722,6 +722,8 @@ var reset_FMGC = func { ITAF.init(); FMGCinit(); flightPlanController.reset(); + windController.reset(); + mcdu.MCDU_reset(0); mcdu.MCDU_reset(1); setprop("it-autoflight/input/fd1", fd1); diff --git a/Nasal/FMGC/flightplan.nas b/Nasal/FMGC/flightplan.nas index ebfd481e..64747678 100644 --- a/Nasal/FMGC/flightplan.nas +++ b/Nasal/FMGC/flightplan.nas @@ -29,21 +29,6 @@ var wpCourse = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/course", 0, " var wpDistance = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/distance", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/distance", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/distance", 0, "DOUBLE")]]; var wpCoursePrev = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/course-from-prev", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/course-from-prev", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/course-from-prev", 0, "DOUBLE")]]; var wpDistancePrev = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/distance-from-prev", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/distance-from-prev", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/distance-from-prev", 0, "DOUBLE")]]; -var wpWindDirection0 = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/wind[0]/direction", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/wind[0]/direction", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/wind[0]/direction", 0, "DOUBLE")]]; -var wpWindMagnitude0 = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/wind[0]/magnitude", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/wind[0]/magnitude", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/wind[0]/magnitude", 0, "DOUBLE")]]; -var wpWindAltitude0 = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/wind[0]/altitude", "", "STRING")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/wind[0]/altitude", "", "STRING")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/wind[0]/altitude", "", "STRING")]]; - -var wpWindDirection1 = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/wind[1]/direction", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/wind[1]/direction", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/wind[1]/direction", 0, "DOUBLE")]]; -var wpWindMagnitude1 = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/wind[1]/magnitude", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/wind[1]/magnitude", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/wind[1]/magnitude", 0, "DOUBLE")]]; -var wpWindAltitude1 = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/wind[1]/altitude", "", "STRING")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/wind[1]/altitude", "", "STRING")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/wind[1]/altitude", "", "STRING")]]; - -var wpWindDirection2 = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/wind[2]/direction", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/wind[2]/direction", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/wind[2]/direction", 0, "DOUBLE")]]; -var wpWindMagnitude2 = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/wind[2]/magnitude", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/wind[2]/magnitude", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/wind[2]/magnitude", 0, "DOUBLE")]]; -var wpWindAltitude2 = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/wind[2]/altitude", "", "STRING")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/wind[2]/altitude", "", "STRING")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/wind[2]/altitude", "", "STRING")]]; - -var wpWindDirection3 = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/wind[3]/direction", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/wind[3]/direction", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/wind[3]/direction", 0, "DOUBLE")]]; -var wpWindMagnitude3 = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/wind[3]/magnitude", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/wind[3]/magnitude", 0, "DOUBLE")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/wind[3]/magnitude", 0, "DOUBLE")]]; -var wpWindAltitude3 = [[props.globals.initNode("/FMGC/flightplan[0]/wp[0]/wind[3]/altitude", "", "STRING")], [props.globals.initNode("/FMGC/flightplan[1]/wp[0]/wind[3]/altitude", "", "STRING")], [props.globals.initNode("/FMGC/flightplan[2]/wp[0]/wind[3]/altitude", "", "STRING")]]; var flightPlanController = { flightplans: [createFlightplan(), createFlightplan(), createFlightplan(), nil], @@ -108,6 +93,7 @@ var flightPlanController = { canvas_mcdu.myAirways[n].updateTmpy(); } me.flightPlanChanged(n); + fmgc.windController.createTemporaryWinds(n); }, loadFlightPlan: func(path) { @@ -128,27 +114,6 @@ var flightPlanController = { me.flightplans[2] = me.flightplans[n].clone(); me.flightPlanChanged(2); flightPlanTimer.start(); - - # copy winds since they are not part of the waypoint object - for (var counter = 0; counter < me.flightplans[n].getPlanSize(); counter += 1) { - wpWindDirection0[2][counter].setValue(wpWindDirection0[n][counter].getValue()); - wpWindMagnitude0[2][counter].setValue(wpWindMagnitude0[n][counter].getValue()); - wpWindAltitude0[2][counter].setValue(wpWindAltitude0[n][counter].getValue()); - - wpWindDirection1[2][counter].setValue(wpWindDirection1[n][counter].getValue()); - wpWindMagnitude1[2][counter].setValue(wpWindMagnitude1[n][counter].getValue()); - wpWindAltitude1[2][counter].setValue(wpWindAltitude1[n][counter].getValue()); - - wpWindDirection2[2][counter].setValue(wpWindDirection2[n][counter].getValue()); - wpWindMagnitude2[2][counter].setValue(wpWindMagnitude2[n][counter].getValue()); - wpWindAltitude2[2][counter].setValue(wpWindAltitude2[n][counter].getValue()); - - wpWindDirection3[2][counter].setValue(wpWindDirection3[n][counter].getValue()); - wpWindMagnitude3[2][counter].setValue(wpWindMagnitude3[n][counter].getValue()); - wpWindAltitude3[2][counter].setValue(wpWindAltitude3[n][counter].getValue()); - } - - me.updateWind(n); } if (n == 3) { return; } me.resetFlightplan(n); @@ -156,6 +121,7 @@ var flightPlanController = { if (canvas_mcdu.myDirTo[n] != nil) { canvas_mcdu.myDirTo[n].updateTmpy(); } + fmgc.windController.destroyTemporaryWinds(n, a); }, updateAirports: func(dep, arr, plan) { @@ -169,6 +135,7 @@ var flightPlanController = { } me.addDiscontinuity(1, plan); + debug.dump(me.flightplans[2]); # reset mcdu if it exists if (canvas_mcdu.myFpln[0] != nil) { canvas_mcdu.myFpln[0].scroll = 0; } if (canvas_mcdu.myFpln[1] != nil) { canvas_mcdu.myFpln[1].scroll = 0; } @@ -257,14 +224,17 @@ var flightPlanController = { if (DEBUG_DISCONT) { return; } if (force) { me.flightplans[plan].insertWP(createDiscontinuity(), index); + fmgc.windController.insertWind(plan, index, 0, "DISCONTINUITY"); } if (index > 0) { if (me.flightplans[plan].getWP(index).wp_name != "DISCONTINUITY" and me.flightplans[plan].getWP(index - 1).wp_name != "DISCONTINUITY") { me.flightplans[plan].insertWP(createDiscontinuity(), index); + fmgc.windController.insertWind(plan, index, 0, "DISCONTINUITY"); } } else { if (me.flightplans[plan].getWP(index).wp_name != "DISCONTINUITY") { me.flightplans[plan].insertWP(createDiscontinuity(), index); + fmgc.windController.insertWind(plan, index, 0, "DISCONTINUITY"); } } }, @@ -277,10 +247,12 @@ var flightPlanController = { insertTP: func(n, index = 1) { me.flightplans[n].insertWP(createWP(geo.aircraft_position(), "T-P"), index); + fmgc.windController.insertWind(n, index, 0, "T-P"); }, insertPPOS: func(n, index = 0) { me.flightplans[n].insertWP(createWP(geo.aircraft_position(), "PPOS"), index); + fmgc.windController.insertWind(n, index, 0, "PPOS"); }, # childWPBearingDistance - return waypoint at bearing and distance from specified waypoint ghost @@ -310,6 +282,7 @@ var flightPlanController = { # fudge the altitude since we cannot create a hdgtoAlt from nasal. Assume 600 feet per mile - 2.5 miles me.flightplans[n].insertWP(createWP(me.childWPBearingDistance(wptStore, me.flightplans[n].departure_runway.heading, 2.5), "1500", "sid"), 1); + fmgc.windController.insertWind(n, 1, 0, "1500"); } me.flightPlanChanged(n); }, @@ -330,6 +303,7 @@ var flightPlanController = { hdg = hdg - 360; } me.flightplans[n].insertWP(createWP(me.childWPBearingDistance(wptStore, hdg, 5), "CF", "star"), me.arrivalIndex[n]); + fmgc.windController.insertWind(n, me.arrivalIndex[n], 0, "CF"); } me.flightPlanChanged(n); }, @@ -352,6 +326,7 @@ var flightPlanController = { # use createWP here as createWPFrom doesn't accept waypoints # createWPFrom worked before... but be sure! me.flightplans[plan].insertWP(createWP(waypointGhost, waypointGhost.wp_name), 2); + fmgc.windController.insertWind(plan, 2, 0, waypointGhost.wp_name); me.addDiscontinuity(3, plan); } else { # we want to delete the intermediate waypoints up to but not including the waypoint. Leave index 0, we delete it later. @@ -377,6 +352,7 @@ var flightPlanController = { if (((s == 0 and left(wp, 4) != FMGCdep.getValue() and left(wp, 4) != FMGCarr.getValue()) or (s == 1)) and me.flightplans[n].getPlanSize() > 2) { if (me.flightplans[n].getWP(index).id != "DISCONTINUITY" and a == 0) { # if it is a discont, don't make a new one me.flightplans[n].deleteWP(index); + fmgc.windController.deleteWind(n, index); if (me.flightplans[n].getWP(index) != nil and s == 0) { if (me.flightplans[n].getWP(index).id != "DISCONTINUITY") { # else, if the next one isn't a discont, add one me.addDiscontinuity(index, n); @@ -384,6 +360,7 @@ var flightPlanController = { } } else { me.flightplans[n].deleteWP(index); + fmgc.windController.deleteWind(n, index); } me.flightPlanChanged(n); canvas_nd.A3XXRouteDriver.triggerSignal("fp-removed"); @@ -443,6 +420,7 @@ var flightPlanController = { var indexPresent = me.flightplans[plan].indexOfWP(airport[indexToInsert]); if (me.flightplans[plan].indexOfWP(airport[indexToInsert]) == -1) { me.flightplans[plan].insertWP(createWPFrom(airport[indexToInsert]), index); + fmgc.windController.insertWind(plan, index, 0, text); me.addDiscontinuity(index + 1, plan); me.flightPlanChanged(plan); return 2; @@ -476,6 +454,7 @@ var flightPlanController = { var indexPresent = me.flightplans[plan].indexOfWP(fix[indexToInsert]); if (me.flightplans[plan].indexOfWP(fix[indexToInsert]) == -1) { me.flightplans[plan].insertWP(createWPFrom(fix[indexToInsert]), index); + fmgc.windController.insertWind(plan, index, 1, text); me.addDiscontinuity(index + 1, plan); me.flightPlanChanged(plan); return 2; @@ -509,6 +488,7 @@ var flightPlanController = { var indexPresent = me.flightplans[plan].indexOfWP(navaid[indexToInsert]); if (me.flightplans[plan].indexOfWP(navaid[indexToInsert]) == -1) { me.flightplans[plan].insertWP(createWPFrom(navaid[indexToInsert]), index); + fmgc.windController.insertWind(plan, index, 1, text); me.addDiscontinuity(index + 1, plan); me.flightPlanChanged(plan); return 2; @@ -529,6 +509,7 @@ var flightPlanController = { if (me.flightplans[plan].indexOfWP(wpGhost) == -1) { # use createWP here as createWPFrom doesn't accept waypoints me.flightplans[plan].insertWP(createWP(wpGhost, wpGhost.wp_name), index); + fmgc.windController.insertWind(plan, index, 1, wpGhost.wp_name); me.addDiscontinuity(index + 1, plan); me.flightPlanChanged(plan); return 2; @@ -558,31 +539,12 @@ var flightPlanController = { } me.flightplans[plan].insertWP(waypoint.wpGhost, index); + fmgc.windController.insertWind(plan, index, 1, "LL"); me.addDiscontinuity(index + 1, plan); me.flightPlanChanged(plan); return 2; }, - getWaypointList: func(plan) { - var waypointsList = []; - for (var index = 1; index < me.arrivalIndex[plan]; index += 1) { - if (me.flightplans[plan].getWP(index).wp_name != "DISCONTINUITY" and me.flightplans[plan].getWP(index).wp_type != "vectors" and me.flightplans[plan].getWP(index).wp_type != "hdgToAlt" and me.flightplans[plan].getWP(index).wp_type != "sid" and me.flightplans[plan].getWP(index).wp_type != "star" and me.flightplans[plan].getWP(index).wp_type != "approach") { - append(waypointsList, me.flightplans[plan].getWP(index)); - } - } - return waypointsList; - }, - - getWaypointMapping: func(plan) { - var waypointsMapping = []; - for (var index = 1; index < me.arrivalIndex[plan]; index += 1) { - if (me.flightplans[plan].getWP(index).wp_name != "DISCONTINUITY" and me.flightplans[plan].getWP(index).wp_type != "vectors" and me.flightplans[plan].getWP(index).wp_type != "hdgToAlt" and me.flightplans[plan].getWP(index).wp_type != "sid" and me.flightplans[plan].getWP(index).wp_type != "star" and me.flightplans[plan].getWP(index).wp_type != "approach") { - append(waypointsMapping, index); - } - } - return waypointsMapping; - }, - # getWPforPBD - parse scratchpad text to find waypoint ghost for PBD # args: text, index, plan # text: scratchpad text @@ -649,6 +611,37 @@ var flightPlanController = { return me.insertPlaceBearingDistance(wpGhost, textSplit[1] + localMagvar, textSplit[2], index, plan); # magnetic to true? I don't know. But this works! }, + getNavCount: func(plan) { + var count = 0; + for (var wpt = 0; wpt < me.flightplans[plan].getPlanSize(); wpt += 1) { + print(me.flightplans[plan].getWP(wpt).wp_type); + if (me.flightplans[plan].getWP(wpt).wp_type == "navaid") { + count += 1; + } + } + return count; + }, + + getDepartureCount: func(plan) { + var count = 0; + for (var wpt = 0; wpt < me.flightplans[plan].getPlanSize(); wpt += 1) { + print(me.flightplans[plan].getWP(wpt).wp_role); + if (me.flightplans[plan].getWP(wpt).wp_role == "sid") { + count += 1; + } + } + return count; + }, + + getArrivalCount: func(plan) { + var count = 0; + for (var wpt = 0; wpt < me.flightplans[plan].getPlanSize(); wpt += 1) { + if (me.flightplans[plan].getWP(wpt).wp_role == "star" or me.flightplans[plan].getWP(wpt).wp_role == "approach" or me.flightplans[plan].getWP(wpt).wp_role == "missed") { + count += 1; + } + } + return count; + }, # insertPlaceBearingDistance - insert PBD waypoint at specified index, # at some specified bearing, distance from a specified location @@ -665,6 +658,7 @@ var flightPlanController = { } me.flightplans[plan].insertWP(waypoint.wpGhost, index); + fmgc.windController.insertWind(plan, index, 0, "PBD"); me.addDiscontinuity(index + 1, plan); me.flightPlanChanged(plan); return 2; @@ -719,25 +713,10 @@ var flightPlanController = { append(wpDistance[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/distance", 0, "DOUBLE")); append(wpCoursePrev[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/course-from-prev", 0, "DOUBLE")); append(wpDistancePrev[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/distance-from-prev", 0, "DOUBLE")); - - append(wpWindDirection0[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/wind[0]/direction", 0, "DOUBLE")); - append(wpWindMagnitude0[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/wind[0]/magnitude", 0, "DOUBLE")); - append(wpWindAltitude0[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/wind[0]/altitude", "", "STRING")); - - append(wpWindDirection1[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/wind[1]/direction", 0, "DOUBLE")); - append(wpWindMagnitude1[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/wind[1]/magnitude", 0, "DOUBLE")); - append(wpWindAltitude1[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/wind[1]/altitude", "", "STRING")); - - append(wpWindDirection2[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/wind[2]/direction", 0, "DOUBLE")); - append(wpWindMagnitude2[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/wind[2]/magnitude", 0, "DOUBLE")); - append(wpWindAltitude2[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/wind[2]/altitude", "", "STRING")); - - append(wpWindDirection3[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/wind[3]/direction", 0, "DOUBLE")); - append(wpWindMagnitude3[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/wind[3]/magnitude", 0, "DOUBLE")); - append(wpWindAltitude3[n], props.globals.initNode("/FMGC/flightplan[" ~ n ~ "]/wp[" ~ counter ~ "]/wind[3]/altitude", "", "STRING")); } - me.updatePlans(); + me.updatePlans(); + fmgc.windController.updatePlans(); # push update to fuel if (getprop("/FMGC/internal/block-confirmed")) { @@ -746,70 +725,6 @@ var flightPlanController = { } canvas_nd.A3XXRouteDriver.triggerSignal("fp-added"); }, - - updateWind: func(n) { - if (n == 0) { - if (canvas_mcdu.myCLBWIND[0] != nil and canvas_mcdu.myCLBWIND[1] != nil) { - canvas_mcdu.myCLBWIND[1].windList = canvas_mcdu.myCLBWIND[0].windList; - canvas_mcdu.myCLBWIND[1]._setupPageWithData(); - } - - if (canvas_mcdu.myCRZWIND[0] != nil and canvas_mcdu.myCRZWIND[1] != nil) { - if (!getprop("/FMGC/internal/tofrom-set") and size(me.getWaypointList(0)) == 0) { - canvas_mcdu.myCRZWIND[1].windList = canvas_mcdu.myCRZWIND[0].windList; - } else { - canvas_mcdu.myCRZWIND[1].del(); - canvas_mcdu.myCRZWIND[1] = nil; - canvas_mcdu.myCRZWIND[1] = mcdu.windCRZPage.new(1, me.getWaypointList(2)[0], 0); - } - canvas_mcdu.myCRZWIND[1]._setupPageWithData(); - } else if (canvas_mcdu.myCRZWIND[1] != nil and getprop("/FMGC/internal/tofrom-set") and size(me.getWaypointList(0)) > 0) { - canvas_mcdu.myCRZWIND[1].del(); - canvas_mcdu.myCRZWIND[1] = nil; - canvas_mcdu.myCRZWIND[1] = mcdu.windCRZPage.new(1, me.getWaypointList(2)[0], 0); - canvas_mcdu.myCRZWIND[1]._setupPageWithData(); - } - - if (canvas_mcdu.myDESWIND[0] != nil and canvas_mcdu.myDESWIND[1] != nil) { - canvas_mcdu.myDESWIND[1].windList = canvas_mcdu.myDESWIND[0].windList; - canvas_mcdu.myDESWIND[1]._setupPageWithData(); - } - - if (canvas_mcdu.myHISTWIND[1] != nil) { - canvas_mcdu.myHISTWIND[1]._setupPageWithData(); - } - } else { - if (canvas_mcdu.myCLBWIND[0] != nil and canvas_mcdu.myCLBWIND[1] != nil) { - canvas_mcdu.myCLBWIND[0].windList = canvas_mcdu.myCLBWIND[1].windList; - canvas_mcdu.myCLBWIND[0]._setupPageWithData(); - } - - if (canvas_mcdu.myCRZWIND[0] != nil and canvas_mcdu.myCRZWIND[1] != nil) { - if (!getprop("/FMGC/internal/tofrom-set") and size(me.getWaypointList(1)) == 0) { - canvas_mcdu.myCRZWIND[0].windList = canvas_mcdu.myCRZWIND[1].windList; - } else { - canvas_mcdu.myCRZWIND[0].del(); - canvas_mcdu.myCRZWIND[0] = nil; - canvas_mcdu.myCRZWIND[0] = mcdu.windCRZPage.new(0, me.getWaypointList(2)[0], 0); - } - canvas_mcdu.myCRZWIND[0]._setupPageWithData(); - } else if (canvas_mcdu.myCRZWIND[0] != nil and getprop("/FMGC/internal/tofrom-set") and size(me.getWaypointList(1)) > 0) { - canvas_mcdu.myCRZWIND[0].del(); - canvas_mcdu.myCRZWIND[0] = nil; - canvas_mcdu.myCRZWIND[0] = mcdu.windCRZPage.new(0, me.getWaypointList(2)[0], 0); - canvas_mcdu.myCRZWIND[0]._setupPageWithData(); - } - - if (canvas_mcdu.myDESWIND[0] != nil and canvas_mcdu.myDESWIND[1] != nil) { - canvas_mcdu.myDESWIND[0].windList = canvas_mcdu.myDESWIND[1].windList; - canvas_mcdu.myDESWIND[0]._setupPageWithData(); - } - - if (canvas_mcdu.myHISTWIND[0] != nil) { - canvas_mcdu.myHISTWIND[0]._setupPageWithData(); - } - } - }, updatePlans: func() { me.updateCurrentWaypoint(); diff --git a/Nasal/FMGC/winds.nas b/Nasal/FMGC/winds.nas new file mode 100644 index 00000000..6f98e0cc --- /dev/null +++ b/Nasal/FMGC/winds.nas @@ -0,0 +1,282 @@ +# A3XX FMGC Wind Driver +# Copyright (c) 2020 Matthew Maring (mattmaring) + +var wpDep = nil; +var wpArr = nil; +var pos = nil; +var geoPosPrev = geo.Coord.new(); +var currentLegCourseDist = nil; +var courseDistanceFrom = nil; +var courseDistanceFromPrev = nil; +var sizeWP = nil; +var magTrueError = 0; +var storeCourse = nil; + +var DEBUG_DISCONT = 0; + +# Props.getNode +var magHDG = props.globals.getNode("/orientation/heading-magnetic-deg", 1); +var trueHDG = props.globals.getNode("/orientation/heading-deg", 1); +var FMGCdep = props.globals.getNode("/FMGC/internal/dep-arpt", 1); +var FMGCarr = props.globals.getNode("/FMGC/internal/arr-arpt", 1); +var toFromSet = props.globals.getNode("/FMGC/internal/tofrom-set", 1); + +var wind = { + new: func() { + return { + parents: [wind], + heading: 0, + magnitude: 0, + altitude: 0 + }; + } +}; + +var waypoint_winds = { + type: "", #departure, waypoint, arrival + includeWind: 1, + wind1: 0, + wind2: 0, + wind3: 0, + wind4: 0, + wind5: 0, + + new: func(id, type, includeWind) { + me.id = id; + me.type = type; + me.includeWind = includeWind; + return { + id: me.id, + type: me.type, #departure, waypoint, arrival + includeWind: me.includeWind, + wind1: wind.new(), + wind2: wind.new(), + wind3: wind.new(), + wind4: wind.new(), + wind5: wind.new() + }; + } +}; + +var windController = { + winds: [[], [], []], + nav_indicies: [[], [], []], + windSizes: [0, 0, 0], + #temporaryFlag: [0, 0], + + init: func() { + me.resetWind(2); + #me.insertWind(2, 0, 1); + #me.insertWind(2, 1, 0); + # temp = waypoint_winds.new("KCVG", "waypoint", 1); +# print(temp.wind2.magnitude); +# temp.wind2.magnitude = 200; +# print(temp.wind2.magnitude); + }, + + reset: func() { + #me.temporaryFlag[0] = 0; + #me.temporaryFlag[1] = 0; + me.resetWind(0); + me.resetWind(1); + me.resetWind(2); + }, + + resetWind: func(n) { + me.winds[n] = []; + me.nav_indicies[n] = []; + me.windSizes[n] = 0; + }, + + createTemporaryWinds: func(n) { + me.resetWind(n); + me.winds[n] = me.winds[2]; + me.nav_indicies[n] = me.nav_indicies[2]; + me.windSizes[n] = me.windSizes[2]; + #me.temporaryFlag[n] = 1; + }, + + destroyTemporaryWinds: func(n, a) { # a = 1 activate, a = 0 erase + me.updatePlans(); + if (a == 1) { + me.resetWind(2); + me.winds[2] = me.winds[n]; + me.nav_indicies[2] = me.nav_indicies[n]; + me.windSizes[2] = me.windSizes[n]; + } + if (n == 3) { return; } + me.resetWind(n); + #me.temporaryFlag[n] = 0; + }, + + insertWind: func(plan, index, value, id) { + if (me.windSizes[plan] == index) { + if (value == 3) { + append(me.winds[plan], waypoint_winds.new(id, "arrival", 0)); + } else if (value == 2) { + append(me.winds[plan], waypoint_winds.new(id, "departure", 0)); + } else if (value == 1) { + append(me.winds[plan], waypoint_winds.new(id, "waypoint", 1)); + } else { + append(me.winds[plan], waypoint_winds.new(id, "waypoint", 0)); + } + me.windSizes[plan] += 1; + } else if (me.windSizes[plan] > index and index >= 0) { + append(me.winds[plan], waypoint_winds.new(id, "waypoint", 0)); + me.windSizes[plan] += 1; + for (i = me.windSizes[plan] - 1; i > index; i -= 1) { + me.winds[plan][i] = me.winds[plan][i - 1]; + } + if (value == 3) { + me.winds[plan][index] = waypoint_winds.new(id, "arrival", 0); + } else if (value == 2) { + me.winds[plan][index] = waypoint_winds.new(id, "departure", 0); + } else if (value == 1) { + me.winds[plan][index] = waypoint_winds.new(id, "waypoint", 1); + } else { + me.winds[plan][index] = waypoint_winds.new(id, "waypoint", 0); + } + } else { + print("insert invalid id: ", id, ", plan: ", plan, ", index: ", index, ", size: ", me.windSizes[plan]); + debug.dump(me.winds); + debug.dump(me.windSizes); + return; + } + print("insert plan: ", plan, ", index: ", index); + debug.dump(me.winds); + debug.dump(me.windSizes); + }, + + deleteWind: func(plan, index) { + if (me.windSizes[plan] == index) { + pop(me.winds[plan]); + me.windSizes[plan] -= 1; + } else if (me.windSizes[plan] > index and index >= 0) { + for (i = index; i < me.windSizes[plan] - 1; i += 1) { + me.winds[plan][i] = me.winds[plan][i + 1]; + } + pop(me.winds[plan]); + me.windSizes[plan] -= 1; + } else { + print("delete invalid plan: ", plan, ", index: ", index, ", size: ", me.windSizes[plan]); + debug.dump(me.winds); + debug.dump(me.windSizes); + return; + } + print("delete plan: ", plan, ", index: ", index); + debug.dump(me.winds); + debug.dump(me.windSizes); + }, + + updatePlans: func() { + var winds_copy = me.winds; + var windSizes_copy = me.windSizes; + me.winds = [[], [], []]; + me.nav_indicies = [[], [], []]; + me.windSizes = [0, 0, 0]; + # loop through waypoints + for (plan = 0; plan <= 2; plan += 1) { + for (i = 0; i < fmgc.flightPlanController.flightplans[plan].getPlanSize(); i += 1) { + var waypoint = fmgc.flightPlanController.flightplans[plan].getWP(i); + print(waypoint.wp_role, "| : |", waypoint.wp_type); + if (waypoint.wp_role == "sid") { + append(me.winds[plan], waypoint_winds.new(waypoint.id, "departure", 0)); + me.windSizes[plan] += 1; + } else if (waypoint.wp_role == "star" or waypoint.wp_role == "arrival" or waypoint.wp_role == "missed") { + append(me.winds[plan], waypoint_winds.new(waypoint.id, "arrival", 0)); + me.windSizes[plan] += 1; + } else if (waypoint.wp_role == nil and waypoint.wp_type == "navaid") { + var found = 0; + for (index = 0; index < windSizes_copy[plan]; index += 1) { + print(waypoint.id, " : ", winds_copy[plan][index].id); + if (waypoint.id == winds_copy[plan][index].id) { + append(me.winds[plan], waypoint_winds.new(waypoint.id, "waypoint", 1)); + append(me.nav_indicies[plan], i); + me.windSizes[plan] += 1; + found = 1; + } + } + if (found != 1) { + append(me.winds[plan], waypoint_winds.new(waypoint.id, "waypoint", 0)); + me.windSizes[plan] += 1; + } + } else { + append(me.winds[plan], waypoint_winds.new(waypoint.id, "waypoint", 0)); + me.windSizes[plan] += 1; + } + print("insert plan: ", plan, ", index: ", i); + debug.dump(me.winds); + debug.dump(me.nav_indicies); + debug.dump(me.windSizes); + } + } + + me.updateWind(0); + me.updateWind(1); + me.updateWind(2); + }, + + updateWind: func(n) { + if (n == 0) { + if (canvas_mcdu.myCLBWIND[0] != nil and canvas_mcdu.myCLBWIND[1] != nil) { + canvas_mcdu.myCLBWIND[1].windList = canvas_mcdu.myCLBWIND[0].windList; + canvas_mcdu.myCLBWIND[1]._setupPageWithData(); + } + + if (canvas_mcdu.myCRZWIND[0] != nil and canvas_mcdu.myCRZWIND[1] != nil) { + if (!getprop("/FMGC/internal/tofrom-set") and size(me.getWaypointList(0)) == 0) { + canvas_mcdu.myCRZWIND[1].windList = canvas_mcdu.myCRZWIND[0].windList; + } else { + canvas_mcdu.myCRZWIND[1].del(); + canvas_mcdu.myCRZWIND[1] = nil; + canvas_mcdu.myCRZWIND[1] = mcdu.windCRZPage.new(1, me.getWaypointList(2)[0], 0); + } + canvas_mcdu.myCRZWIND[1]._setupPageWithData(); + } else if (canvas_mcdu.myCRZWIND[1] != nil and getprop("/FMGC/internal/tofrom-set") and size(me.getWaypointList(0)) > 0) { + canvas_mcdu.myCRZWIND[1].del(); + canvas_mcdu.myCRZWIND[1] = nil; + canvas_mcdu.myCRZWIND[1] = mcdu.windCRZPage.new(1, me.getWaypointList(2)[0], 0); + canvas_mcdu.myCRZWIND[1]._setupPageWithData(); + } + + if (canvas_mcdu.myDESWIND[0] != nil and canvas_mcdu.myDESWIND[1] != nil) { + canvas_mcdu.myDESWIND[1].windList = canvas_mcdu.myDESWIND[0].windList; + canvas_mcdu.myDESWIND[1]._setupPageWithData(); + } + + if (canvas_mcdu.myHISTWIND[1] != nil) { + canvas_mcdu.myHISTWIND[1]._setupPageWithData(); + } + } else { + if (canvas_mcdu.myCLBWIND[0] != nil and canvas_mcdu.myCLBWIND[1] != nil) { + canvas_mcdu.myCLBWIND[0].windList = canvas_mcdu.myCLBWIND[1].windList; + canvas_mcdu.myCLBWIND[0]._setupPageWithData(); + } + + if (canvas_mcdu.myCRZWIND[0] != nil and canvas_mcdu.myCRZWIND[1] != nil) { + if (!getprop("/FMGC/internal/tofrom-set") and size(me.getWaypointList(1)) == 0) { + canvas_mcdu.myCRZWIND[0].windList = canvas_mcdu.myCRZWIND[1].windList; + } else { + canvas_mcdu.myCRZWIND[0].del(); + canvas_mcdu.myCRZWIND[0] = nil; + canvas_mcdu.myCRZWIND[0] = mcdu.windCRZPage.new(0, me.getWaypointList(2)[0], 0); + } + canvas_mcdu.myCRZWIND[0]._setupPageWithData(); + } else if (canvas_mcdu.myCRZWIND[0] != nil and getprop("/FMGC/internal/tofrom-set") and size(me.getWaypointList(1)) > 0) { + canvas_mcdu.myCRZWIND[0].del(); + canvas_mcdu.myCRZWIND[0] = nil; + canvas_mcdu.myCRZWIND[0] = mcdu.windCRZPage.new(0, me.getWaypointList(2)[0], 0); + canvas_mcdu.myCRZWIND[0]._setupPageWithData(); + } + + if (canvas_mcdu.myDESWIND[0] != nil and canvas_mcdu.myDESWIND[1] != nil) { + canvas_mcdu.myDESWIND[0].windList = canvas_mcdu.myDESWIND[1].windList; + canvas_mcdu.myDESWIND[0]._setupPageWithData(); + } + + if (canvas_mcdu.myHISTWIND[0] != nil) { + canvas_mcdu.myHISTWIND[0]._setupPageWithData(); + } + } + } +}; diff --git a/Nasal/Libraries/libraries.nas b/Nasal/Libraries/libraries.nas index 1953bcf9..a7644a60 100644 --- a/Nasal/Libraries/libraries.nas +++ b/Nasal/Libraries/libraries.nas @@ -207,6 +207,7 @@ var systemsInit = func { systems.fire_init(); systems.icingInit(); fmgc.flightPlanController.reset(); + fmgc.windController.reset(); fadec.FADEC.init(); fmgc.ITAF.init(); fmgc.FMGCinit(); @@ -225,6 +226,7 @@ var systemsInit = func { fcu.FCUController.init(); dmc.DMController.init(); fmgc.flightPlanController.init(); + fmgc.windController.init(); } setlistener("/sim/signals/fdm-initialized", func { diff --git a/Nasal/MCDU/INITA.nas b/Nasal/MCDU/INITA.nas index c9a699b5..5e0402fd 100644 --- a/Nasal/MCDU/INITA.nas +++ b/Nasal/MCDU/INITA.nas @@ -169,7 +169,9 @@ var initInputA = func(key, i) { setprop("/FMGC/internal/fuel-calculating", 1); } fmgc.flightPlanController.reset(2); + fmgc.windController.reset(2); fmgc.flightPlanController.init(); + fmgc.windController.init(); mcdu_scratchpad.scratchpads[i].empty(); #} else if (scratchpad == "") { #setprop("/FMGC/internal/alt-selected", 0); diff --git a/Nasal/MCDU/WINDCRZ.nas b/Nasal/MCDU/WINDCRZ.nas index ab620e59..8899dffc 100644 --- a/Nasal/MCDU/WINDCRZ.nas +++ b/Nasal/MCDU/WINDCRZ.nas @@ -70,10 +70,10 @@ var windCRZPage = { # load wind list if (me.singleCRZ == 0) { - if (fmgc.flightPlanController.temporaryFlag[me.computer]) { + if (fmgc.windController.temporaryFlag[me.computer]) { #get from 0 me.windList = [nil]; - if (fmgc.wpWindAltitude0[me.computer][me.match_location].getValue() != "") { + if (fmgc.windController.winds[me.computer][me.match_location].getValue() != nil) { me.windList[0] = [fmgc.wpWindDirection0[me.computer][me.match_location].getValue(), fmgc.wpWindMagnitude0[me.computer][me.match_location].getValue(), fmgc.wpWindAltitude0[me.computer][me.match_location].getValue()]; append(me.windList, nil); } From 331baf014b63553b2e2c1350dbb799f7f0432630 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Wed, 10 Jun 2020 17:44:04 -0400 Subject: [PATCH 12/53] Push new logic to climb page, make work on both mcdus --- Nasal/FMGC/flightplan.nas | 3 +- Nasal/FMGC/winds.nas | 214 +++++++++++++++++++++++--------------- Nasal/MCDU/WINDCLB.nas | 102 ++++++++++++------ Nasal/MCDU/WINDCRZ.nas | 1 - 4 files changed, 204 insertions(+), 116 deletions(-) diff --git a/Nasal/FMGC/flightplan.nas b/Nasal/FMGC/flightplan.nas index 64747678..2e0b06c9 100644 --- a/Nasal/FMGC/flightplan.nas +++ b/Nasal/FMGC/flightplan.nas @@ -92,8 +92,8 @@ var flightPlanController = { if (canvas_mcdu.myAirways[n] != nil) { canvas_mcdu.myAirways[n].updateTmpy(); } - me.flightPlanChanged(n); fmgc.windController.createTemporaryWinds(n); + me.flightPlanChanged(n); }, loadFlightPlan: func(path) { @@ -122,6 +122,7 @@ var flightPlanController = { canvas_mcdu.myDirTo[n].updateTmpy(); } fmgc.windController.destroyTemporaryWinds(n, a); + me.flightPlanChanged(n); }, updateAirports: func(dep, arr, plan) { diff --git a/Nasal/FMGC/winds.nas b/Nasal/FMGC/winds.nas index 6f98e0cc..6a02b413 100644 --- a/Nasal/FMGC/winds.nas +++ b/Nasal/FMGC/winds.nas @@ -1,34 +1,31 @@ # A3XX FMGC Wind Driver # Copyright (c) 2020 Matthew Maring (mattmaring) -var wpDep = nil; -var wpArr = nil; -var pos = nil; -var geoPosPrev = geo.Coord.new(); -var currentLegCourseDist = nil; -var courseDistanceFrom = nil; -var courseDistanceFromPrev = nil; -var sizeWP = nil; -var magTrueError = 0; -var storeCourse = nil; - -var DEBUG_DISCONT = 0; - -# Props.getNode -var magHDG = props.globals.getNode("/orientation/heading-magnetic-deg", 1); -var trueHDG = props.globals.getNode("/orientation/heading-deg", 1); -var FMGCdep = props.globals.getNode("/FMGC/internal/dep-arpt", 1); -var FMGCarr = props.globals.getNode("/FMGC/internal/arr-arpt", 1); -var toFromSet = props.globals.getNode("/FMGC/internal/tofrom-set", 1); - var wind = { + heading: 0, + magnitude: 0, + altitude: "", + new: func() { return { parents: [wind], heading: 0, magnitude: 0, - altitude: 0 + altitude: "" }; + }, + + newcopy: func(heading, magnitude, altitude) { + me.heading = heading; + me.magnitude = magnitude; + me.altitude = altitude; + + return { + parents: [wind], + heading: me.heading, + magnitude: me.magnitude, + altitude: me.altitude + } } }; @@ -45,6 +42,7 @@ var waypoint_winds = { me.id = id; me.type = type; me.includeWind = includeWind; + return { id: me.id, type: me.type, #departure, waypoint, arrival @@ -55,23 +53,45 @@ var waypoint_winds = { wind4: wind.new(), wind5: wind.new() }; + }, + + newcopy: func(id, type, includeWind, wind1, wind2, wind3, wind4, wind5) { + me.id = id; + me.type = type; + me.includeWind = includeWind; + me.wind1 = wind1; + me.wind2 = wind2; + me.wind3 = wind3; + me.wind4 = wind4; + me.wind5 = wind5; + + return { + id: me.id, + type: me.type, #departure, waypoint, arrival + includeWind: me.includeWind, + wind1: me.wind1, + wind2: me.wind2, + wind3: me.wind3, + wind4: me.wind4, + wind5: me.wind5 + }; } }; var windController = { - winds: [[], [], []], + clb_winds: [0, 0, 0], + crz_winds: [0, 0, 0], + des_winds: [0, 0, 0], + winds: [[], [], []], #waypoint winds used if route includes navaids nav_indicies: [[], [], []], windSizes: [0, 0, 0], #temporaryFlag: [0, 0], init: func() { me.resetWind(2); - #me.insertWind(2, 0, 1); - #me.insertWind(2, 1, 0); - # temp = waypoint_winds.new("KCVG", "waypoint", 1); -# print(temp.wind2.magnitude); -# temp.wind2.magnitude = 200; -# print(temp.wind2.magnitude); + me.clb_winds[2] = waypoint_winds.new("climb", "waypoint", 1); + me.crz_winds[2] = waypoint_winds.new("cruize", "waypoint", 1); + me.des_winds[2] = waypoint_winds.new("descent", "waypoint", 1); }, reset: func() { @@ -83,13 +103,31 @@ var windController = { }, resetWind: func(n) { + me.clb_winds[n] = 0; + me.crz_winds[n] = 0; + me.des_winds[n] = 0; me.winds[n] = []; me.nav_indicies[n] = []; me.windSizes[n] = 0; }, + copyClbWind: func(n) { + var id = me.clb_winds[n].id; + var type = me.clb_winds[n].type; + var includeWind = me.clb_winds[n].includeWind; + var wind1 = wind.newcopy(me.clb_winds[n].wind1.heading, me.clb_winds[n].wind1.magnitude, me.clb_winds[n].wind1.altitude); + var wind2 = wind.newcopy(me.clb_winds[n].wind2.heading, me.clb_winds[n].wind2.magnitude, me.clb_winds[n].wind2.altitude); + var wind3 = wind.newcopy(me.clb_winds[n].wind3.heading, me.clb_winds[n].wind3.magnitude, me.clb_winds[n].wind3.altitude); + var wind4 = wind.newcopy(me.clb_winds[n].wind4.heading, me.clb_winds[n].wind4.magnitude, me.clb_winds[n].wind4.altitude); + var wind5 = wind.newcopy(me.clb_winds[n].wind5.heading, me.clb_winds[n].wind5.magnitude, me.clb_winds[n].wind5.altitude); + return waypoint_winds.newcopy(id, type, includeWind, wind1, wind2, wind3, wind4, wind5); + }, + createTemporaryWinds: func(n) { me.resetWind(n); + me.clb_winds[n] = me.copyClbWind(2); + me.crz_winds[n] = me.crz_winds[2]; + me.des_winds[n] = me.des_winds[2]; me.winds[n] = me.winds[2]; me.nav_indicies[n] = me.nav_indicies[2]; me.windSizes[n] = me.windSizes[2]; @@ -97,15 +135,19 @@ var windController = { }, destroyTemporaryWinds: func(n, a) { # a = 1 activate, a = 0 erase - me.updatePlans(); + print("destroying temporary ", n); if (a == 1) { me.resetWind(2); + me.clb_winds[2] = me.copyClbWind(n); + me.crz_winds[2] = me.crz_winds[n]; + me.des_winds[2] = me.des_winds[n]; me.winds[2] = me.winds[n]; me.nav_indicies[2] = me.nav_indicies[n]; me.windSizes[2] = me.windSizes[n]; } if (n == 3) { return; } me.resetWind(n); + #me.updatePlans(); #me.temporaryFlag[n] = 0; }, @@ -174,6 +216,7 @@ var windController = { me.winds = [[], [], []]; me.nav_indicies = [[], [], []]; me.windSizes = [0, 0, 0]; + # loop through waypoints for (plan = 0; plan <= 2; plan += 1) { for (i = 0; i < fmgc.flightPlanController.flightplans[plan].getPlanSize(); i += 1) { @@ -190,7 +233,7 @@ var windController = { for (index = 0; index < windSizes_copy[plan]; index += 1) { print(waypoint.id, " : ", winds_copy[plan][index].id); if (waypoint.id == winds_copy[plan][index].id) { - append(me.winds[plan], waypoint_winds.new(waypoint.id, "waypoint", 1)); + append(me.winds[plan], winds_copy[plan][index]); append(me.nav_indicies[plan], i); me.windSizes[plan] += 1; found = 1; @@ -211,72 +254,73 @@ var windController = { } } - me.updateWind(0); - me.updateWind(1); - me.updateWind(2); + if (canvas_mcdu.myCLBWIND[1] != nil) { + canvas_mcdu.myCLBWIND[1]._setupPageWithData(); + } + if (canvas_mcdu.myCLBWIND[0] != nil) { + canvas_mcdu.myCLBWIND[0]._setupPageWithData(); + } }, updateWind: func(n) { if (n == 0) { if (canvas_mcdu.myCLBWIND[0] != nil and canvas_mcdu.myCLBWIND[1] != nil) { - canvas_mcdu.myCLBWIND[1].windList = canvas_mcdu.myCLBWIND[0].windList; canvas_mcdu.myCLBWIND[1]._setupPageWithData(); } - - if (canvas_mcdu.myCRZWIND[0] != nil and canvas_mcdu.myCRZWIND[1] != nil) { - if (!getprop("/FMGC/internal/tofrom-set") and size(me.getWaypointList(0)) == 0) { - canvas_mcdu.myCRZWIND[1].windList = canvas_mcdu.myCRZWIND[0].windList; - } else { - canvas_mcdu.myCRZWIND[1].del(); - canvas_mcdu.myCRZWIND[1] = nil; - canvas_mcdu.myCRZWIND[1] = mcdu.windCRZPage.new(1, me.getWaypointList(2)[0], 0); - } - canvas_mcdu.myCRZWIND[1]._setupPageWithData(); - } else if (canvas_mcdu.myCRZWIND[1] != nil and getprop("/FMGC/internal/tofrom-set") and size(me.getWaypointList(0)) > 0) { - canvas_mcdu.myCRZWIND[1].del(); - canvas_mcdu.myCRZWIND[1] = nil; - canvas_mcdu.myCRZWIND[1] = mcdu.windCRZPage.new(1, me.getWaypointList(2)[0], 0); - canvas_mcdu.myCRZWIND[1]._setupPageWithData(); - } - - if (canvas_mcdu.myDESWIND[0] != nil and canvas_mcdu.myDESWIND[1] != nil) { - canvas_mcdu.myDESWIND[1].windList = canvas_mcdu.myDESWIND[0].windList; - canvas_mcdu.myDESWIND[1]._setupPageWithData(); - } - - if (canvas_mcdu.myHISTWIND[1] != nil) { - canvas_mcdu.myHISTWIND[1]._setupPageWithData(); - } + +# if (canvas_mcdu.myCRZWIND[0] != nil and canvas_mcdu.myCRZWIND[1] != nil) { +# if (!getprop("/FMGC/internal/tofrom-set") and size(me.getWaypointList(0)) == 0) { +# canvas_mcdu.myCRZWIND[1].windList = canvas_mcdu.myCRZWIND[0].windList; +# } else { +# canvas_mcdu.myCRZWIND[1].del(); +# canvas_mcdu.myCRZWIND[1] = nil; +# canvas_mcdu.myCRZWIND[1] = mcdu.windCRZPage.new(1, me.getWaypointList(2)[0], 0); +# } +# canvas_mcdu.myCRZWIND[1]._setupPageWithData(); +# } else if (canvas_mcdu.myCRZWIND[1] != nil and getprop("/FMGC/internal/tofrom-set") and size(me.getWaypointList(0)) > 0) { +# canvas_mcdu.myCRZWIND[1].del(); +# canvas_mcdu.myCRZWIND[1] = nil; +# canvas_mcdu.myCRZWIND[1] = mcdu.windCRZPage.new(1, me.getWaypointList(2)[0], 0); +# canvas_mcdu.myCRZWIND[1]._setupPageWithData(); +# } +# +# if (canvas_mcdu.myDESWIND[0] != nil and canvas_mcdu.myDESWIND[1] != nil) { +# canvas_mcdu.myDESWIND[1].windList = canvas_mcdu.myDESWIND[0].windList; +# canvas_mcdu.myDESWIND[1]._setupPageWithData(); +# } +# +# if (canvas_mcdu.myHISTWIND[1] != nil) { +# canvas_mcdu.myHISTWIND[1]._setupPageWithData(); +# } } else { if (canvas_mcdu.myCLBWIND[0] != nil and canvas_mcdu.myCLBWIND[1] != nil) { - canvas_mcdu.myCLBWIND[0].windList = canvas_mcdu.myCLBWIND[1].windList; canvas_mcdu.myCLBWIND[0]._setupPageWithData(); } - - if (canvas_mcdu.myCRZWIND[0] != nil and canvas_mcdu.myCRZWIND[1] != nil) { - if (!getprop("/FMGC/internal/tofrom-set") and size(me.getWaypointList(1)) == 0) { - canvas_mcdu.myCRZWIND[0].windList = canvas_mcdu.myCRZWIND[1].windList; - } else { - canvas_mcdu.myCRZWIND[0].del(); - canvas_mcdu.myCRZWIND[0] = nil; - canvas_mcdu.myCRZWIND[0] = mcdu.windCRZPage.new(0, me.getWaypointList(2)[0], 0); - } - canvas_mcdu.myCRZWIND[0]._setupPageWithData(); - } else if (canvas_mcdu.myCRZWIND[0] != nil and getprop("/FMGC/internal/tofrom-set") and size(me.getWaypointList(1)) > 0) { - canvas_mcdu.myCRZWIND[0].del(); - canvas_mcdu.myCRZWIND[0] = nil; - canvas_mcdu.myCRZWIND[0] = mcdu.windCRZPage.new(0, me.getWaypointList(2)[0], 0); - canvas_mcdu.myCRZWIND[0]._setupPageWithData(); - } - - if (canvas_mcdu.myDESWIND[0] != nil and canvas_mcdu.myDESWIND[1] != nil) { - canvas_mcdu.myDESWIND[0].windList = canvas_mcdu.myDESWIND[1].windList; - canvas_mcdu.myDESWIND[0]._setupPageWithData(); - } - - if (canvas_mcdu.myHISTWIND[0] != nil) { - canvas_mcdu.myHISTWIND[0]._setupPageWithData(); - } + +# if (canvas_mcdu.myCRZWIND[0] != nil and canvas_mcdu.myCRZWIND[1] != nil) { +# if (!getprop("/FMGC/internal/tofrom-set") and size(me.getWaypointList(1)) == 0) { +# canvas_mcdu.myCRZWIND[0].windList = canvas_mcdu.myCRZWIND[1].windList; +# } else { +# canvas_mcdu.myCRZWIND[0].del(); +# canvas_mcdu.myCRZWIND[0] = nil; +# canvas_mcdu.myCRZWIND[0] = mcdu.windCRZPage.new(0, me.getWaypointList(2)[0], 0); +# } +# canvas_mcdu.myCRZWIND[0]._setupPageWithData(); +# } else if (canvas_mcdu.myCRZWIND[0] != nil and getprop("/FMGC/internal/tofrom-set") and size(me.getWaypointList(1)) > 0) { +# canvas_mcdu.myCRZWIND[0].del(); +# canvas_mcdu.myCRZWIND[0] = nil; +# canvas_mcdu.myCRZWIND[0] = mcdu.windCRZPage.new(0, me.getWaypointList(2)[0], 0); +# canvas_mcdu.myCRZWIND[0]._setupPageWithData(); +# } +# +# if (canvas_mcdu.myDESWIND[0] != nil and canvas_mcdu.myDESWIND[1] != nil) { +# canvas_mcdu.myDESWIND[0].windList = canvas_mcdu.myDESWIND[1].windList; +# canvas_mcdu.myDESWIND[0]._setupPageWithData(); +# } +# +# if (canvas_mcdu.myHISTWIND[0] != nil) { +# canvas_mcdu.myHISTWIND[0]._setupPageWithData(); +# } } } }; diff --git a/Nasal/MCDU/WINDCLB.nas b/Nasal/MCDU/WINDCLB.nas index 8e21902a..766f887e 100644 --- a/Nasal/MCDU/WINDCLB.nas +++ b/Nasal/MCDU/WINDCLB.nas @@ -29,19 +29,11 @@ var windCLBPage = { vector: [], index: nil, computer: nil, - windList: [], + items: 0, new: func(computer) { var wcp = {parents:[windCLBPage]}; wcp.computer = computer; - if (computer == 0 and canvas_mcdu.myCLBWIND[1] != nil) { - wcp.windList = canvas_mcdu.myCLBWIND[1].windList; - } else if (computer == 1 and canvas_mcdu.myCLBWIND[0] != nil) { - wcp.windList = canvas_mcdu.myCLBWIND[0].windList; - } else { - wcp.windList = [nil]; - } wcp._setupPageWithData(); - wcp.updateTmpy(); return wcp; }, del: func() { @@ -55,9 +47,32 @@ var windCLBPage = { me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "ack"], ["wht", "ack", "ack", "ack", "wht", "ack"]]; me.fontMatrix = [[1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0]]; - if (size(me.windList) >= 5) { - if (me.windList[4] != nil) { - me.L5 = [me.windList[4][0] ~ "/" ~ me.windList[4][1] ~ "/" ~ me.windList[4][2], nil, "blu"]; + var computer_temp = 2; + if (fmgc.flightPlanController.temporaryFlag[me.computer]) { + computer_temp = me.computer; + } + + debug.dump(fmgc.windController.clb_winds[0]); + debug.dump(fmgc.windController.clb_winds[1]); + debug.dump(fmgc.windController.clb_winds[2]); + + if (fmgc.windController.clb_winds[computer_temp] == 0 or fmgc.windController.clb_winds[computer_temp].wind1.altitude == "") { + me.items = 1; + } else if (fmgc.windController.clb_winds[computer_temp].wind2.altitude == "") { + me.items = 2; + } else if (fmgc.windController.clb_winds[computer_temp].wind3.altitude == "") { + me.items = 3; + } else if (fmgc.windController.clb_winds[computer_temp].wind4.altitude == "") { + me.items = 4; + } else { + me.items = 5; + } + + if (me.items >= 5) { + var wind = 0; + wind = fmgc.windController.clb_winds[computer_temp].wind5; + if (wind.altitude != "") { + me.L5 = [wind.heading ~ "/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; me.fontMatrix[0][4] = 0; } else { me.L5 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -67,9 +82,10 @@ var windCLBPage = { me.L5 = [nil, nil, "ack"]; } - if (size(me.windList) >= 4) { - if (me.windList[3] != nil) { - me.L4 = [me.windList[3][0] ~ "/" ~ me.windList[3][1] ~ "/" ~ me.windList[3][2], nil, "blu"]; + if (me.items >= 4) { + wind = fmgc.windController.clb_winds[computer_temp].wind4; + if (wind.altitude != "") { + me.L4 = [wind.heading ~ "/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; me.fontMatrix[0][3] = 0; } else { me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -79,9 +95,10 @@ var windCLBPage = { me.L4 = [nil, nil, "ack"]; } - if (size(me.windList) >= 3) { - if (me.windList[2] != nil) { - me.L3 = [me.windList[2][0] ~ "/" ~ me.windList[2][1] ~ "/" ~ me.windList[2][2], nil, "blu"]; + if (me.items >= 3) { + wind = fmgc.windController.clb_winds[computer_temp].wind3; + if (wind.altitude != "") { + me.L3 = [wind.heading ~ "/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; me.fontMatrix[0][2] = 0; } else { me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -91,9 +108,10 @@ var windCLBPage = { me.L3 = [nil, nil, "ack"]; } - if (size(me.windList) >= 2) { - if (me.windList[1] != nil) { - me.L2 = [me.windList[1][0] ~ "/" ~ me.windList[1][1] ~ "/" ~ me.windList[1][2], nil, "blu"]; + if (me.items >= 2) { + wind = fmgc.windController.clb_winds[computer_temp].wind2; + if (wind.altitude != "") { + me.L2 = [wind.heading ~ "/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; me.fontMatrix[0][1] = 0; } else { me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -103,9 +121,10 @@ var windCLBPage = { me.L2 = [nil, nil, "ack"]; } - if (size(me.windList) >= 1) { - if (me.windList[0] != nil) { - me.L1 = [me.windList[0][0] ~ "/" ~ me.windList[0][1] ~ "/" ~ me.windList[0][2], "TRU WIND/ALT", "blu"]; + if (me.items >= 1) { + wind = fmgc.windController.clb_winds[computer_temp].wind1; + if (wind.altitude != "") { + me.L1 = [wind.heading ~ "/" ~ wind.magnitude ~ "/" ~ wind.altitude, "TRU WIND/ALT", "blu"]; me.fontMatrix[0][0] = 0; } else { me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"]; @@ -154,20 +173,45 @@ var windCLBPage = { me.updateTmpy(); }, pushButtonLeft: func(index) { - if (size(me.windList) >= index) { + if (me.items >= index) { if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) == 13) { var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad); if (size(winds[0]) == 3 and num(winds[0]) != nil and winds[0] >= 0 and winds[0] <= 360 and size(winds[1]) == 3 and num(winds[1]) != nil and winds[1] >= 0 and winds[1] <= 200 and size(winds[2]) == 5 and ((num(winds[2]) != nil and winds[2] >= 1000 and winds[2] <= 39000) or (num(split("FL", winds[2])[1]) != nil and split("FL", winds[2])[1] >= 10 and split("FL", winds[2])[1] <= 390))) { - me.windList[index - 1] = [winds[0], winds[1], winds[2]]; + me.makeTmpy(); + var computer_temp = 2; + if (fmgc.flightPlanController.temporaryFlag[me.computer]) { + computer_temp = me.computer; + } + #print(computer_temp); + if (index == 5) { + fmgc.windController.clb_winds[computer_temp].wind5.heading = winds[0]; + fmgc.windController.clb_winds[computer_temp].wind5.magnitude = winds[1]; + fmgc.windController.clb_winds[computer_temp].wind5.altitude = winds[2]; + } else if (index == 4) { + fmgc.windController.clb_winds[computer_temp].wind4.heading = winds[0]; + fmgc.windController.clb_winds[computer_temp].wind4.magnitude = winds[1]; + fmgc.windController.clb_winds[computer_temp].wind4.altitude = winds[2]; + } else if (index == 3) { + fmgc.windController.clb_winds[computer_temp].wind3.heading = winds[0]; + fmgc.windController.clb_winds[computer_temp].wind3.magnitude = winds[1]; + fmgc.windController.clb_winds[computer_temp].wind3.altitude = winds[2]; + } else if (index == 2) { + fmgc.windController.clb_winds[computer_temp].wind2.heading = winds[0]; + fmgc.windController.clb_winds[computer_temp].wind2.magnitude = winds[1]; + fmgc.windController.clb_winds[computer_temp].wind2.altitude = winds[2]; + } else if (index == 1) { + fmgc.windController.clb_winds[computer_temp].wind1.heading = winds[0]; + fmgc.windController.clb_winds[computer_temp].wind1.magnitude = winds[1]; + fmgc.windController.clb_winds[computer_temp].wind1.altitude = winds[2]; + } mcdu_scratchpad.scratchpads[me.computer].empty(); - if (index != 5) { - append(me.windList, nil); + if (me.items == index and index != 5) { + me.items += 1; } me._setupPageWithData(); - me.makeTmpy(); me.updateTmpy(); } else { mcdu_message(me.computer, "NOT ALLOWED"); diff --git a/Nasal/MCDU/WINDCRZ.nas b/Nasal/MCDU/WINDCRZ.nas index 8899dffc..e1e7f751 100644 --- a/Nasal/MCDU/WINDCRZ.nas +++ b/Nasal/MCDU/WINDCRZ.nas @@ -198,7 +198,6 @@ var windCRZPage = { me.updateTmpy(); }, pushButtonLeft: func(index) { - #destroyTemporaryFlightPlan if (size(me.windList) >= index) { if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) == 13) { var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad); From 49257dc01833d8e9ba332b70aff2af027f56bf8f Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Wed, 10 Jun 2020 18:26:55 -0400 Subject: [PATCH 13/53] Push changes to cruize/descent, fix return button bug --- Nasal/FMGC/winds.nas | 140 +++++++++++++++++---------- Nasal/MCDU/WINDCLB.nas | 3 +- Nasal/MCDU/WINDCRZ.nas | 213 ++++++++++++++++++++--------------------- Nasal/MCDU/WINDDES.nas | 106 ++++++++++++++------ 4 files changed, 267 insertions(+), 195 deletions(-) diff --git a/Nasal/FMGC/winds.nas b/Nasal/FMGC/winds.nas index 6a02b413..0ab71805 100644 --- a/Nasal/FMGC/winds.nas +++ b/Nasal/FMGC/winds.nas @@ -123,11 +123,35 @@ var windController = { return waypoint_winds.newcopy(id, type, includeWind, wind1, wind2, wind3, wind4, wind5); }, + copyCrzWind: func(n) { + var id = me.crz_winds[n].id; + var type = me.crz_winds[n].type; + var includeWind = me.crz_winds[n].includeWind; + var wind1 = wind.newcopy(me.crz_winds[n].wind1.heading, me.crz_winds[n].wind1.magnitude, me.crz_winds[n].wind1.altitude); + var wind2 = wind.newcopy(me.crz_winds[n].wind2.heading, me.crz_winds[n].wind2.magnitude, me.crz_winds[n].wind2.altitude); + var wind3 = wind.newcopy(me.crz_winds[n].wind3.heading, me.crz_winds[n].wind3.magnitude, me.crz_winds[n].wind3.altitude); + var wind4 = wind.newcopy(me.crz_winds[n].wind4.heading, me.crz_winds[n].wind4.magnitude, me.crz_winds[n].wind4.altitude); + var wind5 = wind.newcopy(me.crz_winds[n].wind5.heading, me.crz_winds[n].wind5.magnitude, me.crz_winds[n].wind5.altitude); + return waypoint_winds.newcopy(id, type, includeWind, wind1, wind2, wind3, wind4, wind5); + }, + + copyDesWind: func(n) { + var id = me.des_winds[n].id; + var type = me.des_winds[n].type; + var includeWind = me.des_winds[n].includeWind; + var wind1 = wind.newcopy(me.des_winds[n].wind1.heading, me.des_winds[n].wind1.magnitude, me.des_winds[n].wind1.altitude); + var wind2 = wind.newcopy(me.des_winds[n].wind2.heading, me.des_winds[n].wind2.magnitude, me.des_winds[n].wind2.altitude); + var wind3 = wind.newcopy(me.des_winds[n].wind3.heading, me.des_winds[n].wind3.magnitude, me.des_winds[n].wind3.altitude); + var wind4 = wind.newcopy(me.des_winds[n].wind4.heading, me.des_winds[n].wind4.magnitude, me.des_winds[n].wind4.altitude); + var wind5 = wind.newcopy(me.des_winds[n].wind5.heading, me.des_winds[n].wind5.magnitude, me.des_winds[n].wind5.altitude); + return waypoint_winds.newcopy(id, type, includeWind, wind1, wind2, wind3, wind4, wind5); + }, + createTemporaryWinds: func(n) { me.resetWind(n); me.clb_winds[n] = me.copyClbWind(2); - me.crz_winds[n] = me.crz_winds[2]; - me.des_winds[n] = me.des_winds[2]; + me.crz_winds[n] = me.copyCrzWind(2); + me.des_winds[n] = me.copyDesWind(2); me.winds[n] = me.winds[2]; me.nav_indicies[n] = me.nav_indicies[2]; me.windSizes[n] = me.windSizes[2]; @@ -139,8 +163,8 @@ var windController = { if (a == 1) { me.resetWind(2); me.clb_winds[2] = me.copyClbWind(n); - me.crz_winds[2] = me.crz_winds[n]; - me.des_winds[2] = me.des_winds[n]; + me.crz_winds[2] = me.copyCrzWind(n); + me.des_winds[2] = me.copyDesWind(n); me.winds[2] = me.winds[n]; me.nav_indicies[2] = me.nav_indicies[n]; me.windSizes[2] = me.windSizes[n]; @@ -260,6 +284,18 @@ var windController = { if (canvas_mcdu.myCLBWIND[0] != nil) { canvas_mcdu.myCLBWIND[0]._setupPageWithData(); } + if (canvas_mcdu.myCRZWIND[1] != nil) { + canvas_mcdu.myCRZWIND[1]._setupPageWithData(); + } + if (canvas_mcdu.myCRZWIND[0] != nil) { + canvas_mcdu.myCRZWIND[0]._setupPageWithData(); + } + if (canvas_mcdu.myDESWIND[1] != nil) { + canvas_mcdu.myDESWIND[1]._setupPageWithData(); + } + if (canvas_mcdu.myDESWIND[0] != nil) { + canvas_mcdu.myDESWIND[0]._setupPageWithData(); + } }, updateWind: func(n) { @@ -268,59 +304,59 @@ var windController = { canvas_mcdu.myCLBWIND[1]._setupPageWithData(); } -# if (canvas_mcdu.myCRZWIND[0] != nil and canvas_mcdu.myCRZWIND[1] != nil) { -# if (!getprop("/FMGC/internal/tofrom-set") and size(me.getWaypointList(0)) == 0) { -# canvas_mcdu.myCRZWIND[1].windList = canvas_mcdu.myCRZWIND[0].windList; -# } else { -# canvas_mcdu.myCRZWIND[1].del(); -# canvas_mcdu.myCRZWIND[1] = nil; -# canvas_mcdu.myCRZWIND[1] = mcdu.windCRZPage.new(1, me.getWaypointList(2)[0], 0); -# } -# canvas_mcdu.myCRZWIND[1]._setupPageWithData(); -# } else if (canvas_mcdu.myCRZWIND[1] != nil and getprop("/FMGC/internal/tofrom-set") and size(me.getWaypointList(0)) > 0) { -# canvas_mcdu.myCRZWIND[1].del(); -# canvas_mcdu.myCRZWIND[1] = nil; -# canvas_mcdu.myCRZWIND[1] = mcdu.windCRZPage.new(1, me.getWaypointList(2)[0], 0); -# canvas_mcdu.myCRZWIND[1]._setupPageWithData(); -# } -# -# if (canvas_mcdu.myDESWIND[0] != nil and canvas_mcdu.myDESWIND[1] != nil) { -# canvas_mcdu.myDESWIND[1].windList = canvas_mcdu.myDESWIND[0].windList; -# canvas_mcdu.myDESWIND[1]._setupPageWithData(); -# } -# -# if (canvas_mcdu.myHISTWIND[1] != nil) { -# canvas_mcdu.myHISTWIND[1]._setupPageWithData(); -# } + if (canvas_mcdu.myCRZWIND[0] != nil and canvas_mcdu.myCRZWIND[1] != nil) { + if (!getprop("/FMGC/internal/tofrom-set") and size(me.getWaypointList(0)) == 0) { + canvas_mcdu.myCRZWIND[1].windList = canvas_mcdu.myCRZWIND[0].windList; + } else { + canvas_mcdu.myCRZWIND[1].del(); + canvas_mcdu.myCRZWIND[1] = nil; + canvas_mcdu.myCRZWIND[1] = mcdu.windCRZPage.new(1, me.getWaypointList(2)[0], 0); + } + canvas_mcdu.myCRZWIND[1]._setupPageWithData(); + } else if (canvas_mcdu.myCRZWIND[1] != nil and getprop("/FMGC/internal/tofrom-set") and size(me.getWaypointList(0)) > 0) { + canvas_mcdu.myCRZWIND[1].del(); + canvas_mcdu.myCRZWIND[1] = nil; + canvas_mcdu.myCRZWIND[1] = mcdu.windCRZPage.new(1, me.getWaypointList(2)[0], 0); + canvas_mcdu.myCRZWIND[1]._setupPageWithData(); + } + + if (canvas_mcdu.myDESWIND[0] != nil and canvas_mcdu.myDESWIND[1] != nil) { + canvas_mcdu.myDESWIND[1].windList = canvas_mcdu.myDESWIND[0].windList; + canvas_mcdu.myDESWIND[1]._setupPageWithData(); + } + + if (canvas_mcdu.myHISTWIND[1] != nil) { + canvas_mcdu.myHISTWIND[1]._setupPageWithData(); + } } else { if (canvas_mcdu.myCLBWIND[0] != nil and canvas_mcdu.myCLBWIND[1] != nil) { canvas_mcdu.myCLBWIND[0]._setupPageWithData(); } -# if (canvas_mcdu.myCRZWIND[0] != nil and canvas_mcdu.myCRZWIND[1] != nil) { -# if (!getprop("/FMGC/internal/tofrom-set") and size(me.getWaypointList(1)) == 0) { -# canvas_mcdu.myCRZWIND[0].windList = canvas_mcdu.myCRZWIND[1].windList; -# } else { -# canvas_mcdu.myCRZWIND[0].del(); -# canvas_mcdu.myCRZWIND[0] = nil; -# canvas_mcdu.myCRZWIND[0] = mcdu.windCRZPage.new(0, me.getWaypointList(2)[0], 0); -# } -# canvas_mcdu.myCRZWIND[0]._setupPageWithData(); -# } else if (canvas_mcdu.myCRZWIND[0] != nil and getprop("/FMGC/internal/tofrom-set") and size(me.getWaypointList(1)) > 0) { -# canvas_mcdu.myCRZWIND[0].del(); -# canvas_mcdu.myCRZWIND[0] = nil; -# canvas_mcdu.myCRZWIND[0] = mcdu.windCRZPage.new(0, me.getWaypointList(2)[0], 0); -# canvas_mcdu.myCRZWIND[0]._setupPageWithData(); -# } -# -# if (canvas_mcdu.myDESWIND[0] != nil and canvas_mcdu.myDESWIND[1] != nil) { -# canvas_mcdu.myDESWIND[0].windList = canvas_mcdu.myDESWIND[1].windList; -# canvas_mcdu.myDESWIND[0]._setupPageWithData(); -# } -# -# if (canvas_mcdu.myHISTWIND[0] != nil) { -# canvas_mcdu.myHISTWIND[0]._setupPageWithData(); -# } + if (canvas_mcdu.myCRZWIND[0] != nil and canvas_mcdu.myCRZWIND[1] != nil) { + if (!getprop("/FMGC/internal/tofrom-set") and size(me.getWaypointList(1)) == 0) { + canvas_mcdu.myCRZWIND[0].windList = canvas_mcdu.myCRZWIND[1].windList; + } else { + canvas_mcdu.myCRZWIND[0].del(); + canvas_mcdu.myCRZWIND[0] = nil; + canvas_mcdu.myCRZWIND[0] = mcdu.windCRZPage.new(0, me.getWaypointList(2)[0], 0); + } + canvas_mcdu.myCRZWIND[0]._setupPageWithData(); + } else if (canvas_mcdu.myCRZWIND[0] != nil and getprop("/FMGC/internal/tofrom-set") and size(me.getWaypointList(1)) > 0) { + canvas_mcdu.myCRZWIND[0].del(); + canvas_mcdu.myCRZWIND[0] = nil; + canvas_mcdu.myCRZWIND[0] = mcdu.windCRZPage.new(0, me.getWaypointList(2)[0], 0); + canvas_mcdu.myCRZWIND[0]._setupPageWithData(); + } + + if (canvas_mcdu.myDESWIND[0] != nil and canvas_mcdu.myDESWIND[1] != nil) { + canvas_mcdu.myDESWIND[0].windList = canvas_mcdu.myDESWIND[1].windList; + canvas_mcdu.myDESWIND[0]._setupPageWithData(); + } + + if (canvas_mcdu.myHISTWIND[0] != nil) { + canvas_mcdu.myHISTWIND[0]._setupPageWithData(); + } } } }; diff --git a/Nasal/MCDU/WINDCLB.nas b/Nasal/MCDU/WINDCLB.nas index 766f887e..a5cba4e6 100644 --- a/Nasal/MCDU/WINDCLB.nas +++ b/Nasal/MCDU/WINDCLB.nas @@ -43,7 +43,7 @@ var windCLBPage = { me.title = "CLIMB WIND"; #me.title = "DRAFT CLIMB WIND"; me.titleColour = "wht"; - me.arrowsMatrix = [[0, 0, 0, 0, 0, 0], [1, 0, 0, 0, 1, 0]]; + me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 1, 0]]; me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "ack"], ["wht", "ack", "ack", "ack", "wht", "ack"]]; me.fontMatrix = [[1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0]]; @@ -132,6 +132,7 @@ var windCLBPage = { } } + me.L6 = [" RETURN", nil, "wht"]; me.R1 = [" HISTORY ", "WIND ", "wht"]; me.R3 = [" REQUEST ", "WIND ", "amb"]; me.R5 = [" PHASE ", "NEXT ", "wht"]; diff --git a/Nasal/MCDU/WINDCRZ.nas b/Nasal/MCDU/WINDCRZ.nas index e1e7f751..25178fa9 100644 --- a/Nasal/MCDU/WINDCRZ.nas +++ b/Nasal/MCDU/WINDCRZ.nas @@ -27,31 +27,22 @@ var windCRZPage = { R6: [nil, nil, "ack"], scroll: 0, vector: [], - #index: nil, + index: nil, computer: nil, cur_location: 0, - match_location: 0, - windList: [nil], + items: 0, singleCRZ: 0, new: func(computer, waypoint, cur_location) { var wcp = {parents:[windCRZPage]}; wcp.computer = computer; - if (computer == 0 and canvas_mcdu.myCRZWIND[1] != nil) { - wcp.windList = canvas_mcdu.myCRZWIND[1].windList; - } else if (computer == 1 and canvas_mcdu.myCRZWIND[0] != nil) { - wcp.windList = canvas_mcdu.myCRZWIND[0].windList; - } else { - wcp.windList = [nil]; - } wcp.waypoint = waypoint; wcp.cur_location = cur_location; if (waypoint == nil) { wcp.singleCRZ = 1; } else { - wcp.match_location = fmgc.flightPlanController.getWaypointMapping(2)[wcp.cur_location]; + #wcp.match_location = first item in match list; } wcp._setupPageWithData(); - wcp.updateTmpy(); return wcp; }, del: func() { @@ -68,95 +59,86 @@ var windCRZPage = { me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["ack", "ack", "ack", "wht", "wht", "ack"]]; me.fontMatrix = [[1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0]]; - # load wind list - if (me.singleCRZ == 0) { - if (fmgc.windController.temporaryFlag[me.computer]) { - #get from 0 - me.windList = [nil]; - if (fmgc.windController.winds[me.computer][me.match_location].getValue() != nil) { - me.windList[0] = [fmgc.wpWindDirection0[me.computer][me.match_location].getValue(), fmgc.wpWindMagnitude0[me.computer][me.match_location].getValue(), fmgc.wpWindAltitude0[me.computer][me.match_location].getValue()]; - append(me.windList, nil); - } - if (fmgc.wpWindAltitude1[me.computer][me.match_location].getValue() != "") { - me.windList[1] = [fmgc.wpWindDirection1[me.computer][me.match_location].getValue(), fmgc.wpWindMagnitude1[me.computer][me.match_location].getValue(), fmgc.wpWindAltitude1[me.computer][me.match_location].getValue()]; - append(me.windList, nil); - } - if (fmgc.wpWindAltitude2[me.computer][me.match_location].getValue() != "") { - me.windList[2] = [fmgc.wpWindDirection2[me.computer][me.match_location].getValue(), fmgc.wpWindMagnitude2[me.computer][me.match_location].getValue(), fmgc.wpWindAltitude2[me.computer][me.match_location].getValue()]; - append(me.windList, nil); - } - if (fmgc.wpWindAltitude3[me.computer][me.match_location].getValue() != "") { - me.windList[3] = [fmgc.wpWindDirection3[me.computer][me.match_location].getValue(), fmgc.wpWindMagnitude3[me.computer][me.match_location].getValue(), fmgc.wpWindAltitude3[me.computer][me.match_location].getValue()]; - } + var computer_temp = 2; + if (fmgc.flightPlanController.temporaryFlag[me.computer]) { + computer_temp = me.computer; + } + + debug.dump(fmgc.windController.crz_winds[0]); + debug.dump(fmgc.windController.crz_winds[1]); + debug.dump(fmgc.windController.crz_winds[2]); + + if (me.singleCRZ == 1) { + if (fmgc.windController.crz_winds[computer_temp] == 0 or fmgc.windController.crz_winds[computer_temp].wind1.altitude == "") { + me.items = 1; + } else if (fmgc.windController.crz_winds[computer_temp].wind2.altitude == "") { + me.items = 2; + } else if (fmgc.windController.crz_winds[computer_temp].wind3.altitude == "") { + me.items = 3; } else { - #get from 2 - me.windList = [nil]; - if (fmgc.wpWindAltitude0[2][me.match_location].getValue() != "") { - me.windList[0] = [fmgc.wpWindDirection0[2][me.match_location].getValue(), fmgc.wpWindMagnitude0[2][me.match_location].getValue(), fmgc.wpWindAltitude0[2][me.match_location].getValue()]; - append(me.windList, nil); - } - if (fmgc.wpWindAltitude1[2][me.match_location].getValue() != "") { - me.windList[1] = [fmgc.wpWindDirection1[2][me.match_location].getValue(), fmgc.wpWindMagnitude1[2][me.match_location].getValue(), fmgc.wpWindAltitude1[2][me.match_location].getValue()]; - append(me.windList, nil); - } - if (fmgc.wpWindAltitude2[2][me.match_location].getValue() != "") { - me.windList[2] = [fmgc.wpWindDirection2[2][me.match_location].getValue(), fmgc.wpWindMagnitude2[2][me.match_location].getValue(), fmgc.wpWindAltitude2[2][me.match_location].getValue()]; - append(me.windList, nil); - } - if (fmgc.wpWindAltitude3[2][me.match_location].getValue() != "") { - me.windList[3] = [fmgc.wpWindDirection3[2][me.match_location].getValue(), fmgc.wpWindMagnitude3[2][me.match_location].getValue(), fmgc.wpWindAltitude3[2][me.match_location].getValue()]; - } + me.items = 4; } + } else { + } # load data - if (size(me.windList) >= 4) { - if (me.windList[3] != nil) { - me.L4 = [sprintf("%03d", me.windList[3][0]) ~ "/" ~ sprintf("%03d", me.windList[3][1]) ~ "/" ~ me.windList[3][2], nil, "blu"]; - me.fontMatrix[0][3] = 0; + if (me.singleCRZ == 1) { + if (me.items >= 4) { + wind = fmgc.windController.crz_winds[computer_temp].wind4; + if (wind.altitude != "") { + me.L4 = [wind.heading ~ "/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; + me.fontMatrix[0][3] = 0; + } else { + me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"]; + me.fontMatrix[0][3] = 1; + } } else { - me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"]; - me.fontMatrix[0][3] = 1; + me.L4 = [nil, nil, "ack"]; + } + + if (me.items >= 3) { + wind = fmgc.windController.crz_winds[computer_temp].wind3; + if (wind.altitude != "") { + me.L3 = [wind.heading ~ "/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; + me.fontMatrix[0][2] = 0; + } else { + me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"]; + me.fontMatrix[0][2] = 1; + } + } else { + me.L3 = [nil, nil, "ack"]; + } + + if (me.items >= 2) { + wind = fmgc.windController.crz_winds[computer_temp].wind2; + if (wind.altitude != "") { + me.L2 = [wind.heading ~ "/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; + me.fontMatrix[0][1] = 0; + } else { + me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"]; + me.fontMatrix[0][1] = 1; + } + } else { + me.L2 = [nil, nil, "ack"]; + } + + if (me.items >= 1) { + wind = fmgc.windController.crz_winds[computer_temp].wind1; + if (wind.altitude != "") { + me.L1 = [wind.heading ~ "/" ~ wind.magnitude ~ "/" ~ wind.altitude, "TRU WIND/ALT", "blu"]; + me.fontMatrix[0][0] = 0; + } else { + me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"]; + me.fontMatrix[0][0] = 1; + } } } else { - me.L4 = [nil, nil, "ack"]; - } - - if (size(me.windList) >= 3) { - if (me.windList[2] != nil) { - me.L3 = [sprintf("%03d", me.windList[2][0]) ~ "/" ~ sprintf("%03d", me.windList[2][1]) ~ "/" ~ me.windList[2][2], nil, "blu"]; - me.fontMatrix[0][2] = 0; - } else { - me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"]; - me.fontMatrix[0][2] = 1; - } - } else { - me.L3 = [nil, nil, "ack"]; - } - - if (size(me.windList) >= 2) { - if (me.windList[1] != nil) { - me.L2 = [sprintf("%03d", me.windList[1][0]) ~ "/" ~ sprintf("%03d", me.windList[1][1]) ~ "/" ~ me.windList[1][2], nil, "blu"]; - me.fontMatrix[0][1] = 0; - } else { - me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"]; - me.fontMatrix[0][1] = 1; - } - } else { - me.L2 = [nil, nil, "ack"]; - } - - if (size(me.windList) >= 1) { - if (me.windList[0] != nil) { - me.L1 = [sprintf("%03d", me.windList[0][0]) ~ "/" ~ sprintf("%03d", me.windList[0][1]) ~ "/" ~ me.windList[0][2], "TRU WIND/ALT", "blu"]; - me.fontMatrix[0][0] = 0; - } else { - me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"]; - me.fontMatrix[0][0] = 1; - } + } me.L5 = ["[ ]/[ ]", "SAT / ALT", "blu"]; + me.L6 = [" RETURN", nil, "wht"]; me.R2 = [" REQUEST ", "WIND ", "amb"]; me.R4 = [" PHASE ", "PREV ", "wht"]; me.R5 = [" PHASE ", "NEXT ", "wht"]; @@ -198,7 +180,7 @@ var windCRZPage = { me.updateTmpy(); }, pushButtonLeft: func(index) { - if (size(me.windList) >= index) { + if (me.items >= index) { if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) == 13) { var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad); if (size(winds[0]) == 3 and num(winds[0]) != nil and winds[0] >= 0 and winds[0] <= 360 and @@ -206,31 +188,40 @@ var windCRZPage = { size(winds[2]) == 5 and ((num(winds[2]) != nil and winds[2] >= 1000 and winds[2] <= 39000) or (num(split("FL", winds[2])[1]) != nil and split("FL", winds[2])[1] >= 10 and split("FL", winds[2])[1] <= 390))) { me.makeTmpy(); + var computer_temp = 2; + if (fmgc.flightPlanController.temporaryFlag[me.computer]) { + computer_temp = me.computer; + } + #print(computer_temp); if (me.singleCRZ == 1) { - me.windList[index - 1] = [winds[0], winds[1], winds[2]]; - if (index != 4) { - append(me.windList, nil); + if (index == 5) { + fmgc.windController.crz_winds[computer_temp].wind5.heading = winds[0]; + fmgc.windController.crz_winds[computer_temp].wind5.magnitude = winds[1]; + fmgc.windController.crz_winds[computer_temp].wind5.altitude = winds[2]; + } else if (index == 4) { + fmgc.windController.crz_winds[computer_temp].wind4.heading = winds[0]; + fmgc.windController.crz_winds[computer_temp].wind4.magnitude = winds[1]; + fmgc.windController.crz_winds[computer_temp].wind4.altitude = winds[2]; + } else if (index == 3) { + fmgc.windController.crz_winds[computer_temp].wind3.heading = winds[0]; + fmgc.windController.crz_winds[computer_temp].wind3.magnitude = winds[1]; + fmgc.windController.crz_winds[computer_temp].wind3.altitude = winds[2]; + } else if (index == 2) { + fmgc.windController.crz_winds[computer_temp].wind2.heading = winds[0]; + fmgc.windController.crz_winds[computer_temp].wind2.magnitude = winds[1]; + fmgc.windController.crz_winds[computer_temp].wind2.altitude = winds[2]; + } else if (index == 1) { + fmgc.windController.crz_winds[computer_temp].wind1.heading = winds[0]; + fmgc.windController.crz_winds[computer_temp].wind1.magnitude = winds[1]; + fmgc.windController.crz_winds[computer_temp].wind1.altitude = winds[2]; } } else { - if (index == 1) { - fmgc.wpWindDirection0[me.computer][me.match_location].setValue(num(winds[0])); - fmgc.wpWindMagnitude0[me.computer][me.match_location].setValue(num(winds[1])); - fmgc.wpWindAltitude0[me.computer][me.match_location].setValue(winds[2]); - } else if (index == 2) { - fmgc.wpWindDirection1[me.computer][me.match_location].setValue(num(winds[0])); - fmgc.wpWindMagnitude1[me.computer][me.match_location].setValue(num(winds[1])); - fmgc.wpWindAltitude1[me.computer][me.match_location].setValue(winds[2]); - } else if (index == 3) { - fmgc.wpWindDirection2[me.computer][me.match_location].setValue(num(winds[0])); - fmgc.wpWindMagnitude2[me.computer][me.match_location].setValue(num(winds[1])); - fmgc.wpWindAltitude2[me.computer][me.match_location].setValue(winds[2]); - } else if (index == 4) { - fmgc.wpWindDirection3[me.computer][me.match_location].setValue(num(winds[0])); - fmgc.wpWindMagnitude3[me.computer][me.match_location].setValue(num(winds[1])); - fmgc.wpWindAltitude3[me.computer][me.match_location].setValue(winds[2]); - } + } mcdu_scratchpad.scratchpads[me.computer].empty(); + if (me.items == index and index != 5) { + me.items += 1; + } me._setupPageWithData(); me.updateTmpy(); } else { diff --git a/Nasal/MCDU/WINDDES.nas b/Nasal/MCDU/WINDDES.nas index 1f5dc7f0..ef2ec73b 100644 --- a/Nasal/MCDU/WINDDES.nas +++ b/Nasal/MCDU/WINDDES.nas @@ -29,20 +29,11 @@ var windDESPage = { vector: [], index: nil, computer: nil, - windList: [], - new: func(computer) { #, waypoint + items: 0, + new: func(computer) { var wcp = {parents:[windDESPage]}; wcp.computer = computer; - if (computer == 0 and canvas_mcdu.myDESWIND[1] != nil) { - wcp.windList = canvas_mcdu.myDESWIND[1].windList; - } else if (computer == 1 and canvas_mcdu.myDESWIND[0] != nil) { - wcp.windList = canvas_mcdu.myDESWIND[0].windList; - } else { - wcp.windList = [nil]; - } - #wcp.waypoint = waypoint; wcp._setupPageWithData(); - wcp.updateTmpy(); return wcp; }, del: func() { @@ -56,9 +47,32 @@ var windDESPage = { me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["ack", "ack", "ack", "wht", "ack", "ack"]]; me.fontMatrix = [[1, 1, 1, 1, 1, 0], [1, 0, 0, 0, 0, 0]]; - if (size(me.windList) >= 5) { - if (me.windList[4] != nil) { - me.L5 = [me.windList[4][0] ~ "/" ~ me.windList[4][1] ~ "/" ~ me.windList[4][2], nil, "blu"]; + var computer_temp = 2; + if (fmgc.flightPlanController.temporaryFlag[me.computer]) { + computer_temp = me.computer; + } + + debug.dump(fmgc.windController.des_winds[0]); + debug.dump(fmgc.windController.des_winds[1]); + debug.dump(fmgc.windController.des_winds[2]); + + if (fmgc.windController.des_winds[computer_temp] == 0 or fmgc.windController.des_winds[computer_temp].wind1.altitude == "") { + me.items = 1; + } else if (fmgc.windController.des_winds[computer_temp].wind2.altitude == "") { + me.items = 2; + } else if (fmgc.windController.des_winds[computer_temp].wind3.altitude == "") { + me.items = 3; + } else if (fmgc.windController.des_winds[computer_temp].wind4.altitude == "") { + me.items = 4; + } else { + me.items = 5; + } + + if (me.items >= 5) { + var wind = 0; + wind = fmgc.windController.des_winds[computer_temp].wind5; + if (wind.altitude != "") { + me.L5 = [wind.heading ~ "/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; me.fontMatrix[0][4] = 0; } else { me.L5 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -68,9 +82,10 @@ var windDESPage = { me.L5 = [nil, nil, "ack"]; } - if (size(me.windList) >= 4) { - if (me.windList[3] != nil) { - me.L4 = [me.windList[3][0] ~ "/" ~ me.windList[3][1] ~ "/" ~ me.windList[3][2], nil, "blu"]; + if (me.items >= 4) { + wind = fmgc.windController.des_winds[computer_temp].wind4; + if (wind.altitude != "") { + me.L4 = [wind.heading ~ "/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; me.fontMatrix[0][3] = 0; } else { me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -80,9 +95,10 @@ var windDESPage = { me.L4 = [nil, nil, "ack"]; } - if (size(me.windList) >= 3) { - if (me.windList[2] != nil) { - me.L3 = [me.windList[2][0] ~ "/" ~ me.windList[2][1] ~ "/" ~ me.windList[2][2], nil, "blu"]; + if (me.items >= 3) { + wind = fmgc.windController.des_winds[computer_temp].wind3; + if (wind.altitude != "") { + me.L3 = [wind.heading ~ "/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; me.fontMatrix[0][2] = 0; } else { me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -92,9 +108,10 @@ var windDESPage = { me.L3 = [nil, nil, "ack"]; } - if (size(me.windList) >= 2) { - if (me.windList[1] != nil) { - me.L2 = [me.windList[1][0] ~ "/" ~ me.windList[1][1] ~ "/" ~ me.windList[1][2], nil, "blu"]; + if (me.items >= 2) { + wind = fmgc.windController.des_winds[computer_temp].wind2; + if (wind.altitude != "") { + me.L2 = [wind.heading ~ "/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; me.fontMatrix[0][1] = 0; } else { me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -104,9 +121,10 @@ var windDESPage = { me.L2 = [nil, nil, "ack"]; } - if (size(me.windList) >= 1) { - if (me.windList[0] != nil) { - me.L1 = [me.windList[0][0] ~ "/" ~ me.windList[0][1] ~ "/" ~ me.windList[0][2], "TRU WIND/ALT", "blu"]; + if (me.items >= 1) { + wind = fmgc.windController.des_winds[computer_temp].wind1; + if (wind.altitude != "") { + me.L1 = [wind.heading ~ "/" ~ wind.magnitude ~ "/" ~ wind.altitude, "TRU WIND/ALT", "blu"]; me.fontMatrix[0][0] = 0; } else { me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"]; @@ -114,6 +132,7 @@ var windDESPage = { } } + me.L6 = [" RETURN", nil, "wht"]; me.R1 = ["[ ]/[ ]", "ALTN WIND ", "blu"]; me.R3 = [" REQUEST ", "WIND ", "amb"]; me.R4 = [" PHASE ", "PREV ", "wht"]; @@ -157,20 +176,45 @@ var windDESPage = { me.updateTmpy(); }, pushButtonLeft: func(index) { - if (size(me.windList) >= index) { + if (me.items >= index) { if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) == 13) { var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad); if (size(winds[0]) == 3 and num(winds[0]) != nil and winds[0] >= 0 and winds[0] <= 360 and size(winds[1]) == 3 and num(winds[1]) != nil and winds[1] >= 0 and winds[1] <= 200 and size(winds[2]) == 5 and ((num(winds[2]) != nil and winds[2] >= 1000 and winds[2] <= 39000) or (num(split("FL", winds[2])[1]) != nil and split("FL", winds[2])[1] >= 10 and split("FL", winds[2])[1] <= 390))) { - me.windList[index - 1] = [winds[0], winds[1], winds[2]]; + me.makeTmpy(); + var computer_temp = 2; + if (fmgc.flightPlanController.temporaryFlag[me.computer]) { + computer_temp = me.computer; + } + #print(computer_temp); + if (index == 5) { + fmgc.windController.des_winds[computer_temp].wind5.heading = winds[0]; + fmgc.windController.des_winds[computer_temp].wind5.magnitude = winds[1]; + fmgc.windController.des_winds[computer_temp].wind5.altitude = winds[2]; + } else if (index == 4) { + fmgc.windController.des_winds[computer_temp].wind4.heading = winds[0]; + fmgc.windController.des_winds[computer_temp].wind4.magnitude = winds[1]; + fmgc.windController.des_winds[computer_temp].wind4.altitude = winds[2]; + } else if (index == 3) { + fmgc.windController.des_winds[computer_temp].wind3.heading = winds[0]; + fmgc.windController.des_winds[computer_temp].wind3.magnitude = winds[1]; + fmgc.windController.des_winds[computer_temp].wind3.altitude = winds[2]; + } else if (index == 2) { + fmgc.windController.des_winds[computer_temp].wind2.heading = winds[0]; + fmgc.windController.des_winds[computer_temp].wind2.magnitude = winds[1]; + fmgc.windController.des_winds[computer_temp].wind2.altitude = winds[2]; + } else if (index == 1) { + fmgc.windController.des_winds[computer_temp].wind1.heading = winds[0]; + fmgc.windController.des_winds[computer_temp].wind1.magnitude = winds[1]; + fmgc.windController.des_winds[computer_temp].wind1.altitude = winds[2]; + } mcdu_scratchpad.scratchpads[me.computer].empty(); - if (index != 5) { - append(me.windList, nil); + if (me.items == index and index != 5) { + me.items += 1; } me._setupPageWithData(); - me.makeTmpy(); me.updateTmpy(); } else { mcdu_message(me.computer, "NOT ALLOWED"); From 6b523801b8bbafc2e003d4eab8d53db05dbe9985 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Wed, 10 Jun 2020 19:22:08 -0400 Subject: [PATCH 14/53] Implement enroute navaids wind, save wind values across flightplan changes --- Nasal/FMGC/winds.nas | 40 ++++++++------- Nasal/MCDU/MCDU.nas | 16 +++--- Nasal/MCDU/WINDCLB.nas | 6 +-- Nasal/MCDU/WINDCRZ.nas | 114 +++++++++++++++++++++++++++++++++++------ 4 files changed, 130 insertions(+), 46 deletions(-) diff --git a/Nasal/FMGC/winds.nas b/Nasal/FMGC/winds.nas index 0ab71805..e0319c23 100644 --- a/Nasal/FMGC/winds.nas +++ b/Nasal/FMGC/winds.nas @@ -159,7 +159,7 @@ var windController = { }, destroyTemporaryWinds: func(n, a) { # a = 1 activate, a = 0 erase - print("destroying temporary ", n); + #print("destroying temporary ", n); if (a == 1) { me.resetWind(2); me.clb_winds[2] = me.copyClbWind(n); @@ -203,14 +203,14 @@ var windController = { me.winds[plan][index] = waypoint_winds.new(id, "waypoint", 0); } } else { - print("insert invalid id: ", id, ", plan: ", plan, ", index: ", index, ", size: ", me.windSizes[plan]); - debug.dump(me.winds); - debug.dump(me.windSizes); + #print("insert invalid id: ", id, ", plan: ", plan, ", index: ", index, ", size: ", me.windSizes[plan]); + #debug.dump(me.winds); + #debug.dump(me.windSizes); return; } - print("insert plan: ", plan, ", index: ", index); - debug.dump(me.winds); - debug.dump(me.windSizes); + #print("insert plan: ", plan, ", index: ", index); + #debug.dump(me.winds); + #debug.dump(me.windSizes); }, deleteWind: func(plan, index) { @@ -224,14 +224,14 @@ var windController = { pop(me.winds[plan]); me.windSizes[plan] -= 1; } else { - print("delete invalid plan: ", plan, ", index: ", index, ", size: ", me.windSizes[plan]); - debug.dump(me.winds); - debug.dump(me.windSizes); + #print("delete invalid plan: ", plan, ", index: ", index, ", size: ", me.windSizes[plan]); + #debug.dump(me.winds); + #debug.dump(me.windSizes); return; } - print("delete plan: ", plan, ", index: ", index); - debug.dump(me.winds); - debug.dump(me.windSizes); + #print("delete plan: ", plan, ", index: ", index); + #debug.dump(me.winds); + #debug.dump(me.windSizes); }, updatePlans: func() { @@ -245,7 +245,7 @@ var windController = { for (plan = 0; plan <= 2; plan += 1) { for (i = 0; i < fmgc.flightPlanController.flightplans[plan].getPlanSize(); i += 1) { var waypoint = fmgc.flightPlanController.flightplans[plan].getWP(i); - print(waypoint.wp_role, "| : |", waypoint.wp_type); + #print(waypoint.wp_role, "| : |", waypoint.wp_type); if (waypoint.wp_role == "sid") { append(me.winds[plan], waypoint_winds.new(waypoint.id, "departure", 0)); me.windSizes[plan] += 1; @@ -255,7 +255,7 @@ var windController = { } else if (waypoint.wp_role == nil and waypoint.wp_type == "navaid") { var found = 0; for (index = 0; index < windSizes_copy[plan]; index += 1) { - print(waypoint.id, " : ", winds_copy[plan][index].id); + #print(waypoint.id, " : ", winds_copy[plan][index].id); if (waypoint.id == winds_copy[plan][index].id) { append(me.winds[plan], winds_copy[plan][index]); append(me.nav_indicies[plan], i); @@ -271,13 +271,15 @@ var windController = { append(me.winds[plan], waypoint_winds.new(waypoint.id, "waypoint", 0)); me.windSizes[plan] += 1; } - print("insert plan: ", plan, ", index: ", i); - debug.dump(me.winds); - debug.dump(me.nav_indicies); - debug.dump(me.windSizes); + #print("insert plan: ", plan, ", index: ", i); + #debug.dump(me.winds); + #debug.dump(me.nav_indicies); + #debug.dump(me.windSizes); } } + debug.dump(me.nav_indicies); + if (canvas_mcdu.myCLBWIND[1] != nil) { canvas_mcdu.myCLBWIND[1]._setupPageWithData(); } diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 15609c39..4b085354 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -588,12 +588,12 @@ var rskbutton = func(btn, i) { setprop("MCDU[" ~ i ~ "]/page", "WINDCLB"); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") { if (fmgc.flightPlanController.temporaryFlag[i]) { - if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.flightPlanController.getWaypointList(i)) > 0) { + if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.windController.nav_indicies[i]) > 0) { if (canvas_mcdu.myCRZWIND[i] != nil) { canvas_mcdu.myCRZWIND[i].del(); } canvas_mcdu.myCRZWIND[i] = nil; - canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, fmgc.flightPlanController.getWaypointList(i)[0], 0); + canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, fmgc.flightPlanController.flightplans[i].getWP(fmgc.windController.nav_indicies[i][0]), 0); } else { if (canvas_mcdu.myCRZWIND[i] == nil) { canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, nil, nil); @@ -602,12 +602,12 @@ var rskbutton = func(btn, i) { } } } else { - if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.flightPlanController.getWaypointList(2)) > 0) { + if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.windController.nav_indicies[2]) > 0) { if (canvas_mcdu.myCRZWIND[i] != nil) { canvas_mcdu.myCRZWIND[i].del(); } canvas_mcdu.myCRZWIND[i] = nil; - canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, fmgc.flightPlanController.getWaypointList(2)[0], 0); + canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, fmgc.flightPlanController.flightplans[2].getWP(fmgc.windController.nav_indicies[2][0]), 0); } else { if (canvas_mcdu.myCRZWIND[i] == nil) { canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, nil, nil); @@ -641,12 +641,12 @@ var rskbutton = func(btn, i) { initInputB("R5",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") { if (fmgc.flightPlanController.temporaryFlag[i]) { - if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.flightPlanController.getWaypointList(i)) > 0) { + if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.windController.nav_indicies[i]) > 0) { if (canvas_mcdu.myCRZWIND[i] != nil) { canvas_mcdu.myCRZWIND[i].del(); } canvas_mcdu.myCRZWIND[i] = nil; - canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, fmgc.flightPlanController.getWaypointList(i)[0], 0); + canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, fmgc.flightPlanController.flightplans[i].getWP(fmgc.windController.nav_indicies[i][0]), 0); } else { if (canvas_mcdu.myCRZWIND[i] == nil) { canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, nil, nil); @@ -655,12 +655,12 @@ var rskbutton = func(btn, i) { } } } else { - if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.flightPlanController.getWaypointList(2)) > 0) { + if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.windController.nav_indicies[2]) > 0) { if (canvas_mcdu.myCRZWIND[i] != nil) { canvas_mcdu.myCRZWIND[i].del(); } canvas_mcdu.myCRZWIND[i] = nil; - canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, fmgc.flightPlanController.getWaypointList(2)[0], 0); + canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, fmgc.flightPlanController.flightplans[2].getWP(fmgc.windController.nav_indicies[2][0]), 0); } else { if (canvas_mcdu.myCRZWIND[i] == nil) { canvas_mcdu.myCRZWIND[i] = windCRZPage.new(i, nil, nil); diff --git a/Nasal/MCDU/WINDCLB.nas b/Nasal/MCDU/WINDCLB.nas index a5cba4e6..175b9cfc 100644 --- a/Nasal/MCDU/WINDCLB.nas +++ b/Nasal/MCDU/WINDCLB.nas @@ -52,9 +52,9 @@ var windCLBPage = { computer_temp = me.computer; } - debug.dump(fmgc.windController.clb_winds[0]); - debug.dump(fmgc.windController.clb_winds[1]); - debug.dump(fmgc.windController.clb_winds[2]); + #debug.dump(fmgc.windController.clb_winds[0]); + #debug.dump(fmgc.windController.clb_winds[1]); + #debug.dump(fmgc.windController.clb_winds[2]); if (fmgc.windController.clb_winds[computer_temp] == 0 or fmgc.windController.clb_winds[computer_temp].wind1.altitude == "") { me.items = 1; diff --git a/Nasal/MCDU/WINDCRZ.nas b/Nasal/MCDU/WINDCRZ.nas index 25178fa9..ac0f35e1 100644 --- a/Nasal/MCDU/WINDCRZ.nas +++ b/Nasal/MCDU/WINDCRZ.nas @@ -30,6 +30,7 @@ var windCRZPage = { index: nil, computer: nil, cur_location: 0, + match_location: 0, items: 0, singleCRZ: 0, new: func(computer, waypoint, cur_location) { @@ -39,8 +40,6 @@ var windCRZPage = { wcp.cur_location = cur_location; if (waypoint == nil) { wcp.singleCRZ = 1; - } else { - #wcp.match_location = first item in match list; } wcp._setupPageWithData(); return wcp; @@ -64,9 +63,9 @@ var windCRZPage = { computer_temp = me.computer; } - debug.dump(fmgc.windController.crz_winds[0]); - debug.dump(fmgc.windController.crz_winds[1]); - debug.dump(fmgc.windController.crz_winds[2]); + #debug.dump(fmgc.windController.crz_winds[0]); + #debug.dump(fmgc.windController.crz_winds[1]); + #debug.dump(fmgc.windController.crz_winds[2]); if (me.singleCRZ == 1) { if (fmgc.windController.crz_winds[computer_temp] == 0 or fmgc.windController.crz_winds[computer_temp].wind1.altitude == "") { @@ -79,7 +78,16 @@ var windCRZPage = { me.items = 4; } } else { - + me.match_location = fmgc.windController.nav_indicies[computer_temp][me.cur_location]; + if (size(fmgc.windController.winds[computer_temp]) == 0 or fmgc.windController.winds[computer_temp][me.match_location].wind1.altitude == "") { + me.items = 1; + } else if (fmgc.windController.winds[computer_temp][me.match_location].wind2.altitude == "") { + me.items = 2; + } else if (fmgc.windController.crz_winds[computer_temp][me.match_location].wind3.altitude == "") { + me.items = 3; + } else { + me.items = 4; + } } # load data @@ -134,7 +142,55 @@ var windCRZPage = { } } } else { - + if (me.items >= 4) { + wind = fmgc.windController.winds[computer_temp][me.match_location].wind4; + if (wind.altitude != "") { + me.L4 = [wind.heading ~ "/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; + me.fontMatrix[0][3] = 0; + } else { + me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"]; + me.fontMatrix[0][3] = 1; + } + } else { + me.L4 = [nil, nil, "ack"]; + } + + if (me.items >= 3) { + wind = fmgc.windController.winds[computer_temp][me.match_location].wind3; + if (wind.altitude != "") { + me.L3 = [wind.heading ~ "/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; + me.fontMatrix[0][2] = 0; + } else { + me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"]; + me.fontMatrix[0][2] = 1; + } + } else { + me.L3 = [nil, nil, "ack"]; + } + + if (me.items >= 2) { + wind = fmgc.windController.winds[computer_temp][me.match_location].wind2; + if (wind.altitude != "") { + me.L2 = [wind.heading ~ "/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; + me.fontMatrix[0][1] = 0; + } else { + me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"]; + me.fontMatrix[0][1] = 1; + } + } else { + me.L2 = [nil, nil, "ack"]; + } + + if (me.items >= 1) { + wind = fmgc.windController.winds[computer_temp][me.match_location].wind1; + if (wind.altitude != "") { + me.L1 = [wind.heading ~ "/" ~ wind.magnitude ~ "/" ~ wind.altitude, "TRU WIND/ALT", "blu"]; + me.fontMatrix[0][0] = 0; + } else { + me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"]; + me.fontMatrix[0][0] = 1; + } + } } me.L5 = ["[ ]/[ ]", "SAT / ALT", "blu"]; @@ -216,7 +272,27 @@ var windCRZPage = { fmgc.windController.crz_winds[computer_temp].wind1.altitude = winds[2]; } } else { - + if (index == 5) { + fmgc.windController.winds[computer_temp][me.match_location].wind5.heading = winds[0]; + fmgc.windController.winds[computer_temp][me.match_location].wind5.magnitude = winds[1]; + fmgc.windController.winds[computer_temp][me.match_location].wind5.altitude = winds[2]; + } else if (index == 4) { + fmgc.windController.winds[computer_temp][me.match_location].wind4.heading = winds[0]; + fmgc.windController.winds[computer_temp][me.match_location].wind4.magnitude = winds[1]; + fmgc.windController.winds[computer_temp][me.match_location].wind4.altitude = winds[2]; + } else if (index == 3) { + fmgc.windController.winds[computer_temp][me.match_location].wind3.heading = winds[0]; + fmgc.windController.winds[computer_temp][me.match_location].wind3.magnitude = winds[1]; + fmgc.windController.winds[computer_temp][me.match_location].wind3.altitude = winds[2]; + } else if (index == 2) { + fmgc.windController.winds[computer_temp][me.match_location].wind2.heading = winds[0]; + fmgc.windController.winds[computer_temp][me.match_location].wind2.magnitude = winds[1]; + fmgc.windController.winds[computer_temp][me.match_location].wind2.altitude = winds[2]; + } else if (index == 1) { + fmgc.windController.winds[computer_temp][me.match_location].wind1.heading = winds[0]; + fmgc.windController.winds[computer_temp][me.match_location].wind1.magnitude = winds[1]; + fmgc.windController.winds[computer_temp][me.match_location].wind1.altitude = winds[2]; + } } mcdu_scratchpad.scratchpads[me.computer].empty(); if (me.items == index and index != 5) { @@ -235,25 +311,31 @@ var windCRZPage = { } }, pushButtonUp: func() { - if (me.cur_location < size(fmgc.flightPlanController.getWaypointList(2)) - 1) { + var computer_temp = 2; + if (fmgc.flightPlanController.temporaryFlag[me.computer]) { + computer_temp = me.computer; + } + if (me.cur_location < size(fmgc.windController.nav_indicies[computer_temp]) - 1) { me.cur_location = me.cur_location + 1; } else { me.cur_location = 0; } - me.waypoint = fmgc.flightPlanController.getWaypointList(2)[me.cur_location]; - me.match_location = fmgc.flightPlanController.getWaypointMapping(2)[me.cur_location]; - #load stored data here + me.match_location = fmgc.windController.nav_indicies[computer_temp][me.cur_location]; + me.waypoint = fmgc.flightPlanController.flightplans[computer_temp].getWP(me.match_location); me.reload(); }, pushButtonDown: func() { + var computer_temp = 2; + if (fmgc.flightPlanController.temporaryFlag[me.computer]) { + computer_temp = me.computer; + } if (me.cur_location > 0) { me.cur_location = me.cur_location - 1; } else { - me.cur_location = size(fmgc.flightPlanController.getWaypointList(2)) - 1; + me.cur_location = size(fmgc.windController.nav_indicies[computer_temp]) - 1; } - me.waypoint = fmgc.flightPlanController.getWaypointList(2)[me.cur_location]; - me.match_location = fmgc.flightPlanController.getWaypointMapping(2)[me.cur_location]; - #load stored data here + me.match_location = fmgc.windController.nav_indicies[computer_temp][me.cur_location]; + me.waypoint = fmgc.flightPlanController.flightplans[computer_temp].getWP(me.match_location); me.reload(); } }; \ No newline at end of file From 3fd01a904daf02f8508051fe3c0791888ea9801c Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Wed, 10 Jun 2020 20:18:11 -0400 Subject: [PATCH 15/53] Enable wind cancel/insert buttons --- Nasal/FMGC/winds.nas | 72 ++++++------------------------------------ Nasal/MCDU/MCDU.nas | 16 ++++++++++ Nasal/MCDU/WINDCLB.nas | 31 +++++++++++++++++- Nasal/MCDU/WINDCRZ.nas | 33 +++++++++++++++++-- Nasal/MCDU/WINDDES.nas | 31 +++++++++++++++++- 5 files changed, 117 insertions(+), 66 deletions(-) diff --git a/Nasal/FMGC/winds.nas b/Nasal/FMGC/winds.nas index e0319c23..2b7c6f81 100644 --- a/Nasal/FMGC/winds.nas +++ b/Nasal/FMGC/winds.nas @@ -287,9 +287,19 @@ var windController = { canvas_mcdu.myCLBWIND[0]._setupPageWithData(); } if (canvas_mcdu.myCRZWIND[1] != nil) { + # if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.windController.nav_indicies[1]) > 0) { +# canvas_mcdu.myCRZWIND[1].del(); +# canvas_mcdu.myCRZWIND[1] = nil; +# canvas_mcdu.myCRZWIND[1] = windCRZPage.new(1, fmgc.flightPlanController.flightplans[2].getWP(me.nav_indicies[2][0]), 0); +# } canvas_mcdu.myCRZWIND[1]._setupPageWithData(); } if (canvas_mcdu.myCRZWIND[0] != nil) { + # if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.windController.nav_indicies[0]) > 0) { +# canvas_mcdu.myCRZWIND[0].del(); +# canvas_mcdu.myCRZWIND[0] = nil; +# canvas_mcdu.myCRZWIND[0] = windCRZPage.new(0, fmgc.flightPlanController.flightplans[2].getWP(me.nav_indicies[2][0]), 0); +# } canvas_mcdu.myCRZWIND[0]._setupPageWithData(); } if (canvas_mcdu.myDESWIND[1] != nil) { @@ -298,67 +308,5 @@ var windController = { if (canvas_mcdu.myDESWIND[0] != nil) { canvas_mcdu.myDESWIND[0]._setupPageWithData(); } - }, - - updateWind: func(n) { - if (n == 0) { - if (canvas_mcdu.myCLBWIND[0] != nil and canvas_mcdu.myCLBWIND[1] != nil) { - canvas_mcdu.myCLBWIND[1]._setupPageWithData(); - } - - if (canvas_mcdu.myCRZWIND[0] != nil and canvas_mcdu.myCRZWIND[1] != nil) { - if (!getprop("/FMGC/internal/tofrom-set") and size(me.getWaypointList(0)) == 0) { - canvas_mcdu.myCRZWIND[1].windList = canvas_mcdu.myCRZWIND[0].windList; - } else { - canvas_mcdu.myCRZWIND[1].del(); - canvas_mcdu.myCRZWIND[1] = nil; - canvas_mcdu.myCRZWIND[1] = mcdu.windCRZPage.new(1, me.getWaypointList(2)[0], 0); - } - canvas_mcdu.myCRZWIND[1]._setupPageWithData(); - } else if (canvas_mcdu.myCRZWIND[1] != nil and getprop("/FMGC/internal/tofrom-set") and size(me.getWaypointList(0)) > 0) { - canvas_mcdu.myCRZWIND[1].del(); - canvas_mcdu.myCRZWIND[1] = nil; - canvas_mcdu.myCRZWIND[1] = mcdu.windCRZPage.new(1, me.getWaypointList(2)[0], 0); - canvas_mcdu.myCRZWIND[1]._setupPageWithData(); - } - - if (canvas_mcdu.myDESWIND[0] != nil and canvas_mcdu.myDESWIND[1] != nil) { - canvas_mcdu.myDESWIND[1].windList = canvas_mcdu.myDESWIND[0].windList; - canvas_mcdu.myDESWIND[1]._setupPageWithData(); - } - - if (canvas_mcdu.myHISTWIND[1] != nil) { - canvas_mcdu.myHISTWIND[1]._setupPageWithData(); - } - } else { - if (canvas_mcdu.myCLBWIND[0] != nil and canvas_mcdu.myCLBWIND[1] != nil) { - canvas_mcdu.myCLBWIND[0]._setupPageWithData(); - } - - if (canvas_mcdu.myCRZWIND[0] != nil and canvas_mcdu.myCRZWIND[1] != nil) { - if (!getprop("/FMGC/internal/tofrom-set") and size(me.getWaypointList(1)) == 0) { - canvas_mcdu.myCRZWIND[0].windList = canvas_mcdu.myCRZWIND[1].windList; - } else { - canvas_mcdu.myCRZWIND[0].del(); - canvas_mcdu.myCRZWIND[0] = nil; - canvas_mcdu.myCRZWIND[0] = mcdu.windCRZPage.new(0, me.getWaypointList(2)[0], 0); - } - canvas_mcdu.myCRZWIND[0]._setupPageWithData(); - } else if (canvas_mcdu.myCRZWIND[0] != nil and getprop("/FMGC/internal/tofrom-set") and size(me.getWaypointList(1)) > 0) { - canvas_mcdu.myCRZWIND[0].del(); - canvas_mcdu.myCRZWIND[0] = nil; - canvas_mcdu.myCRZWIND[0] = mcdu.windCRZPage.new(0, me.getWaypointList(2)[0], 0); - canvas_mcdu.myCRZWIND[0]._setupPageWithData(); - } - - if (canvas_mcdu.myDESWIND[0] != nil and canvas_mcdu.myDESWIND[1] != nil) { - canvas_mcdu.myDESWIND[0].windList = canvas_mcdu.myDESWIND[1].windList; - canvas_mcdu.myDESWIND[0]._setupPageWithData(); - } - - if (canvas_mcdu.myHISTWIND[0] != nil) { - canvas_mcdu.myHISTWIND[0]._setupPageWithData(); - } - } } }; diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 4b085354..ffa6486a 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -434,6 +434,14 @@ var lskbutton = func(btn, i) { fuelPredInput("L6",i); } else if (getprop("MCDU[" ~ i ~ "]/page") == "IRSINIT") { initInputIRS("L6",i); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") { + canvas_mcdu.myCLBWIND[i].pushButtonLeft(6); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") { + canvas_mcdu.myCRZWIND[i].pushButtonLeft(6); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") { + canvas_mcdu.myDESWIND[i].pushButtonLeft(6); + #} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDHIST") { + # canvas_mcdu.myHISTWIND[i].pushButtonRight(6); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDHIST") { if (canvas_mcdu.myCLBWIND[i] == nil) { canvas_mcdu.myCLBWIND[i] = windCLBPage.new(i); @@ -721,6 +729,14 @@ var rskbutton = func(btn, i) { initInputA("R6",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "IRSINIT") { initInputIRS("R6",i); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") { + canvas_mcdu.myCLBWIND[i].pushButtonRight(6); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") { + canvas_mcdu.myCRZWIND[i].pushButtonRight(6); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") { + canvas_mcdu.myDESWIND[i].pushButtonRight(6); + #} else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDHIST") { + # canvas_mcdu.myHISTWIND[i].pushButtonRight(6); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") { perfTOInput("R6",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFCLB") { diff --git a/Nasal/MCDU/WINDCLB.nas b/Nasal/MCDU/WINDCLB.nas index 175b9cfc..75449484 100644 --- a/Nasal/MCDU/WINDCLB.nas +++ b/Nasal/MCDU/WINDCLB.nas @@ -174,7 +174,19 @@ var windCLBPage = { me.updateTmpy(); }, pushButtonLeft: func(index) { - if (me.items >= index) { + if (index == 6 and fmgc.flightPlanController.temporaryFlag[me.computer]) { + if (canvas_mcdu.myFpln[me.computer] != nil) { + canvas_mcdu.myFpln[me.computer].pushButtonLeft(index); + } else { + fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 0); + # push update to fuel + if (getprop("/FMGC/internal/block-confirmed")) { + setprop("/FMGC/internal/fuel-calculating", 0); + setprop("/FMGC/internal/fuel-calculating", 1); + } + } + me.reload(); + } else if (me.items >= index) { if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) == 13) { var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad); if (size(winds[0]) == 3 and num(winds[0]) != nil and winds[0] >= 0 and winds[0] <= 360 and @@ -223,5 +235,22 @@ var windCLBPage = { } else { mcdu_message(me.computer, "NOT ALLOWED"); } + }, + pushButtonRight: func(index) { + if (index == 6 and fmgc.flightPlanController.temporaryFlag[me.computer]) { + if (canvas_mcdu.myFpln[me.computer] != nil) { + canvas_mcdu.myFpln[me.computer].pushButtonRight(index); + } else { + fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 1); + # push update to fuel + if (getprop("/FMGC/internal/block-confirmed")) { + setprop("/FMGC/internal/fuel-calculating", 0); + setprop("/FMGC/internal/fuel-calculating", 1); + } + } + me.reload(); + } else { + mcdu_message(me.computer, "NOT ALLOWED"); + } } }; \ No newline at end of file diff --git a/Nasal/MCDU/WINDCRZ.nas b/Nasal/MCDU/WINDCRZ.nas index ac0f35e1..07120522 100644 --- a/Nasal/MCDU/WINDCRZ.nas +++ b/Nasal/MCDU/WINDCRZ.nas @@ -83,7 +83,7 @@ var windCRZPage = { me.items = 1; } else if (fmgc.windController.winds[computer_temp][me.match_location].wind2.altitude == "") { me.items = 2; - } else if (fmgc.windController.crz_winds[computer_temp][me.match_location].wind3.altitude == "") { + } else if (fmgc.windController.winds[computer_temp][me.match_location].wind3.altitude == "") { me.items = 3; } else { me.items = 4; @@ -236,7 +236,19 @@ var windCRZPage = { me.updateTmpy(); }, pushButtonLeft: func(index) { - if (me.items >= index) { + if (index == 6 and fmgc.flightPlanController.temporaryFlag[me.computer]) { + if (canvas_mcdu.myFpln[me.computer] != nil) { + canvas_mcdu.myFpln[me.computer].pushButtonLeft(index); + } else { + fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 0); + # push update to fuel + if (getprop("/FMGC/internal/block-confirmed")) { + setprop("/FMGC/internal/fuel-calculating", 0); + setprop("/FMGC/internal/fuel-calculating", 1); + } + } + me.reload(); + } else if (me.items >= index) { if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) == 13) { var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad); if (size(winds[0]) == 3 and num(winds[0]) != nil and winds[0] >= 0 and winds[0] <= 360 and @@ -310,6 +322,23 @@ var windCRZPage = { mcdu_message(me.computer, "NOT ALLOWED"); } }, + pushButtonRight: func(index) { + if (index == 6 and fmgc.flightPlanController.temporaryFlag[me.computer]) { + if (canvas_mcdu.myFpln[me.computer] != nil) { + canvas_mcdu.myFpln[me.computer].pushButtonRight(index); + } else { + fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 1); + # push update to fuel + if (getprop("/FMGC/internal/block-confirmed")) { + setprop("/FMGC/internal/fuel-calculating", 0); + setprop("/FMGC/internal/fuel-calculating", 1); + } + } + me.reload(); + } else { + mcdu_message(me.computer, "NOT ALLOWED"); + } + }, pushButtonUp: func() { var computer_temp = 2; if (fmgc.flightPlanController.temporaryFlag[me.computer]) { diff --git a/Nasal/MCDU/WINDDES.nas b/Nasal/MCDU/WINDDES.nas index ef2ec73b..64ad3b91 100644 --- a/Nasal/MCDU/WINDDES.nas +++ b/Nasal/MCDU/WINDDES.nas @@ -176,7 +176,19 @@ var windDESPage = { me.updateTmpy(); }, pushButtonLeft: func(index) { - if (me.items >= index) { + if (index == 6 and fmgc.flightPlanController.temporaryFlag[me.computer]) { + if (canvas_mcdu.myFpln[me.computer] != nil) { + canvas_mcdu.myFpln[me.computer].pushButtonLeft(index); + } else { + fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 0); + # push update to fuel + if (getprop("/FMGC/internal/block-confirmed")) { + setprop("/FMGC/internal/fuel-calculating", 0); + setprop("/FMGC/internal/fuel-calculating", 1); + } + } + me.reload(); + } else if (me.items >= index) { if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) == 13) { var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad); if (size(winds[0]) == 3 and num(winds[0]) != nil and winds[0] >= 0 and winds[0] <= 360 and @@ -225,5 +237,22 @@ var windDESPage = { } else { mcdu_message(me.computer, "NOT ALLOWED"); } + }, + pushButtonRight: func(index) { + if (index == 6 and fmgc.flightPlanController.temporaryFlag[me.computer]) { + if (canvas_mcdu.myFpln[me.computer] != nil) { + canvas_mcdu.myFpln[me.computer].pushButtonRight(index); + } else { + fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 1); + # push update to fuel + if (getprop("/FMGC/internal/block-confirmed")) { + setprop("/FMGC/internal/fuel-calculating", 0); + setprop("/FMGC/internal/fuel-calculating", 1); + } + } + me.reload(); + } else { + mcdu_message(me.computer, "NOT ALLOWED"); + } } }; \ No newline at end of file From 34333c876c3a1eb69017c19e6ad82c7127d5d0d7 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Thu, 11 Jun 2020 12:57:35 -0400 Subject: [PATCH 16/53] Bug fixes when using both mcdus at the same time --- Nasal/FMGC/winds.nas | 50 ++++++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/Nasal/FMGC/winds.nas b/Nasal/FMGC/winds.nas index 2b7c6f81..57f7c593 100644 --- a/Nasal/FMGC/winds.nas +++ b/Nasal/FMGC/winds.nas @@ -147,12 +147,28 @@ var windController = { return waypoint_winds.newcopy(id, type, includeWind, wind1, wind2, wind3, wind4, wind5); }, + copyWinds: func(n) { + var tempWind = []; + for (i = 0; i < size(me.winds[n]); i += 1) { + var id = me.winds[n][i].id; + var type = me.winds[n][i].type; + var includeWind = me.winds[n][i].includeWind; + var wind1 = wind.newcopy(me.winds[n][i].wind1.heading, me.winds[n][i].wind1.magnitude, me.winds[n][i].wind1.altitude); + var wind2 = wind.newcopy(me.winds[n][i].wind2.heading, me.winds[n][i].wind2.magnitude, me.winds[n][i].wind2.altitude); + var wind3 = wind.newcopy(me.winds[n][i].wind3.heading, me.winds[n][i].wind3.magnitude, me.winds[n][i].wind3.altitude); + var wind4 = wind.newcopy(me.winds[n][i].wind4.heading, me.winds[n][i].wind4.magnitude, me.winds[n][i].wind4.altitude); + var wind5 = wind.newcopy(me.winds[n][i].wind5.heading, me.winds[n][i].wind5.magnitude, me.winds[n][i].wind5.altitude); + append(tempWind, waypoint_winds.newcopy(id, type, includeWind, wind1, wind2, wind3, wind4, wind5)); + } + return tempWind; + }, + createTemporaryWinds: func(n) { me.resetWind(n); me.clb_winds[n] = me.copyClbWind(2); me.crz_winds[n] = me.copyCrzWind(2); me.des_winds[n] = me.copyDesWind(2); - me.winds[n] = me.winds[2]; + me.winds[n] = me.copyWinds(2); me.nav_indicies[n] = me.nav_indicies[2]; me.windSizes[n] = me.windSizes[2]; #me.temporaryFlag[n] = 1; @@ -165,7 +181,7 @@ var windController = { me.clb_winds[2] = me.copyClbWind(n); me.crz_winds[2] = me.copyCrzWind(n); me.des_winds[2] = me.copyDesWind(n); - me.winds[2] = me.winds[n]; + me.winds[2] = me.copyWinds(n); me.nav_indicies[2] = me.nav_indicies[n]; me.windSizes[2] = me.windSizes[n]; } @@ -281,32 +297,30 @@ var windController = { debug.dump(me.nav_indicies); if (canvas_mcdu.myCLBWIND[1] != nil) { - canvas_mcdu.myCLBWIND[1]._setupPageWithData(); + canvas_mcdu.myCLBWIND[1].reload(); } if (canvas_mcdu.myCLBWIND[0] != nil) { - canvas_mcdu.myCLBWIND[0]._setupPageWithData(); + canvas_mcdu.myCLBWIND[0].reload(); } if (canvas_mcdu.myCRZWIND[1] != nil) { - # if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.windController.nav_indicies[1]) > 0) { -# canvas_mcdu.myCRZWIND[1].del(); -# canvas_mcdu.myCRZWIND[1] = nil; -# canvas_mcdu.myCRZWIND[1] = windCRZPage.new(1, fmgc.flightPlanController.flightplans[2].getWP(me.nav_indicies[2][0]), 0); -# } - canvas_mcdu.myCRZWIND[1]._setupPageWithData(); + if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.windController.nav_indicies[1]) > 0) { + canvas_mcdu.myCRZWIND[1].waypoint = fmgc.flightPlanController.flightplans[2].getWP(me.nav_indicies[2][0]); + canvas_mcdu.myCRZWIND[1].cur_location = 0; + } + canvas_mcdu.myCRZWIND[1].reload(); } if (canvas_mcdu.myCRZWIND[0] != nil) { - # if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.windController.nav_indicies[0]) > 0) { -# canvas_mcdu.myCRZWIND[0].del(); -# canvas_mcdu.myCRZWIND[0] = nil; -# canvas_mcdu.myCRZWIND[0] = windCRZPage.new(0, fmgc.flightPlanController.flightplans[2].getWP(me.nav_indicies[2][0]), 0); -# } - canvas_mcdu.myCRZWIND[0]._setupPageWithData(); + if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.windController.nav_indicies[0]) > 0) { + canvas_mcdu.myCRZWIND[0].waypoint = fmgc.flightPlanController.flightplans[2].getWP(me.nav_indicies[2][0]); + canvas_mcdu.myCRZWIND[0].cur_location = 0; + } + canvas_mcdu.myCRZWIND[0].reload(); } if (canvas_mcdu.myDESWIND[1] != nil) { - canvas_mcdu.myDESWIND[1]._setupPageWithData(); + canvas_mcdu.myDESWIND[1].reload(); } if (canvas_mcdu.myDESWIND[0] != nil) { - canvas_mcdu.myDESWIND[0]._setupPageWithData(); + canvas_mcdu.myDESWIND[0].reload(); } } }; From 136a292c532c1a3523e9f4ee0212cfd459536186 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Thu, 11 Jun 2020 13:55:52 -0400 Subject: [PATCH 17/53] Enable return buttons, clean up history page --- Models/Instruments/MCDU/MCDU.nas | 5 +- Nasal/FMGC/winds.nas | 78 +++++++++++++++++++++++++++++--- Nasal/MCDU/WINDCLB.nas | 2 + Nasal/MCDU/WINDCRZ.nas | 2 + Nasal/MCDU/WINDDES.nas | 2 + Nasal/MCDU/WINDHIST.nas | 24 +++------- 6 files changed, 88 insertions(+), 25 deletions(-) diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index 321f2a3c..22c5c2a3 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -3175,7 +3175,6 @@ var canvas_MCDU_base = { me.fontRightS(default, default, default, default, default, default); me.fontSizeLeft(normal, normal, normal, normal, normal, normal); - me.fontSizeRight(normal, normal, normal, normal, normal, normal); me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "wht"); me.colorRightArrow("wht", "wht", "wht", "wht", "wht", "wht"); @@ -3184,18 +3183,22 @@ var canvas_MCDU_base = { myWind = myCLBWIND; me.colorLeftS("wht", "wht", "wht", "wht", "wht", "amb"); me.colorRightS("wht", "wht", "amb", "wht", "wht", "amb"); + me.fontSizeCenter(normal, normal, normal, normal, normal, normal); } else if (page == "WINDCRZ") { myWind = myCRZWIND; me.colorLeftS("wht", "wht", "wht", "wht", "wht", "amb"); me.colorRightS("wht", "amb", "wht", "wht", "wht", "amb"); + me.fontSizeCenter(normal, normal, normal, normal, normal, normal); } else if (page == "WINDDES") { myWind = myDESWIND; me.colorLeftS("wht", "wht", "wht", "wht", "wht", "amb"); me.colorRightS("wht", "wht", "amb", "wht", "wht", "amb"); + me.fontSizeCenter(normal, normal, normal, normal, normal, normal); } else if (page == "WINDHIST") { myWind = myHISTWIND; me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); me.colorRightS("wht", "wht", "wht", "wht", "wht", "wht"); + me.fontSizeCenter(small, small, small, small, small, normal); } if (myWind[i] != nil) { diff --git a/Nasal/FMGC/winds.nas b/Nasal/FMGC/winds.nas index 57f7c593..30d0f064 100644 --- a/Nasal/FMGC/winds.nas +++ b/Nasal/FMGC/winds.nas @@ -29,6 +29,54 @@ var wind = { } }; +var alt_wind = { + heading: 0, + magnitude: 0, + + new: func() { + return { + parents: [wind], + heading: 0, + magnitude: 0 + }; + }, + + newcopy: func(heading, magnitude) { + me.heading = heading; + me.magnitude = magnitude; + + return { + parents: [wind], + heading: me.heading, + magnitude: me.magnitude + } + } +}; + +var sat_temp = { + temp: 0, + altitude: "", + + new: func() { + return { + parents: [wind], + temp: 0, + altitude: "" + }; + }, + + newcopy: func(temp, altitude) { + me.temp = temp; + me.altitude = altitude; + + return { + parents: [wind], + temp: me.temp, + altitude: me.altitude + } + } +}; + var waypoint_winds = { type: "", #departure, waypoint, arrival includeWind: 1, @@ -37,6 +85,8 @@ var waypoint_winds = { wind3: 0, wind4: 0, wind5: 0, + sat1: 0, + alt1: 0, new: func(id, type, includeWind) { me.id = id; @@ -51,11 +101,13 @@ var waypoint_winds = { wind2: wind.new(), wind3: wind.new(), wind4: wind.new(), - wind5: wind.new() + wind5: wind.new(), + sat1: sat_temp.new(), + alt1: alt_wind.new() }; }, - newcopy: func(id, type, includeWind, wind1, wind2, wind3, wind4, wind5) { + newcopy: func(id, type, includeWind, wind1, wind2, wind3, wind4, wind5, sat1, alt1) { me.id = id; me.type = type; me.includeWind = includeWind; @@ -64,6 +116,8 @@ var waypoint_winds = { me.wind3 = wind3; me.wind4 = wind4; me.wind5 = wind5; + me.sat1 = sat1; + me.alt1 = alt1; return { id: me.id, @@ -73,7 +127,9 @@ var waypoint_winds = { wind2: me.wind2, wind3: me.wind3, wind4: me.wind4, - wind5: me.wind5 + wind5: me.wind5, + sat1: me.sat1, + alt1: me.alt1 }; } }; @@ -120,7 +176,9 @@ var windController = { var wind3 = wind.newcopy(me.clb_winds[n].wind3.heading, me.clb_winds[n].wind3.magnitude, me.clb_winds[n].wind3.altitude); var wind4 = wind.newcopy(me.clb_winds[n].wind4.heading, me.clb_winds[n].wind4.magnitude, me.clb_winds[n].wind4.altitude); var wind5 = wind.newcopy(me.clb_winds[n].wind5.heading, me.clb_winds[n].wind5.magnitude, me.clb_winds[n].wind5.altitude); - return waypoint_winds.newcopy(id, type, includeWind, wind1, wind2, wind3, wind4, wind5); + var sat1 = alt_wind.newcopy(me.clb_winds[n].sat1.temperature, me.clb_winds[n].sat1.altitude); + var alt1 = sat_temp.newcopy(me.clb_winds[n].alt1.heading, me.clb_winds[n].alt1.magnitude); + return waypoint_winds.newcopy(id, type, includeWind, wind1, wind2, wind3, wind4, wind5, sat1, alt1); }, copyCrzWind: func(n) { @@ -132,7 +190,9 @@ var windController = { var wind3 = wind.newcopy(me.crz_winds[n].wind3.heading, me.crz_winds[n].wind3.magnitude, me.crz_winds[n].wind3.altitude); var wind4 = wind.newcopy(me.crz_winds[n].wind4.heading, me.crz_winds[n].wind4.magnitude, me.crz_winds[n].wind4.altitude); var wind5 = wind.newcopy(me.crz_winds[n].wind5.heading, me.crz_winds[n].wind5.magnitude, me.crz_winds[n].wind5.altitude); - return waypoint_winds.newcopy(id, type, includeWind, wind1, wind2, wind3, wind4, wind5); + var sat1 = alt_wind.newcopy(me.crz_winds[n].sat1.temperature, me.crz_winds[n].sat1.altitude); + var alt1 = sat_temp.newcopy(me.crz_winds[n].alt1.heading, me.crz_winds[n].alt1.magnitude); + return waypoint_winds.newcopy(id, type, includeWind, wind1, wind2, wind3, wind4, wind5, sat1, alt1); }, copyDesWind: func(n) { @@ -144,7 +204,9 @@ var windController = { var wind3 = wind.newcopy(me.des_winds[n].wind3.heading, me.des_winds[n].wind3.magnitude, me.des_winds[n].wind3.altitude); var wind4 = wind.newcopy(me.des_winds[n].wind4.heading, me.des_winds[n].wind4.magnitude, me.des_winds[n].wind4.altitude); var wind5 = wind.newcopy(me.des_winds[n].wind5.heading, me.des_winds[n].wind5.magnitude, me.des_winds[n].wind5.altitude); - return waypoint_winds.newcopy(id, type, includeWind, wind1, wind2, wind3, wind4, wind5); + var sat1 = alt_wind.newcopy(me.des_winds[n].sat1.temp, me.des_winds[n].sat1.altitude); + var alt1 = sat_temp.newcopy(me.des_winds[n].alt1.heading, me.des_winds[n].alt1.magnitude); + return waypoint_winds.newcopy(id, type, includeWind, wind1, wind2, wind3, wind4, wind5, sat1, alt1); }, copyWinds: func(n) { @@ -158,7 +220,9 @@ var windController = { var wind3 = wind.newcopy(me.winds[n][i].wind3.heading, me.winds[n][i].wind3.magnitude, me.winds[n][i].wind3.altitude); var wind4 = wind.newcopy(me.winds[n][i].wind4.heading, me.winds[n][i].wind4.magnitude, me.winds[n][i].wind4.altitude); var wind5 = wind.newcopy(me.winds[n][i].wind5.heading, me.winds[n][i].wind5.magnitude, me.winds[n][i].wind5.altitude); - append(tempWind, waypoint_winds.newcopy(id, type, includeWind, wind1, wind2, wind3, wind4, wind5)); + var sat1 = alt_wind.newcopy(me.winds[n][i].sat1.temperature, me.winds[n][i].sat1.altitude); + var alt1 = sat_temp.newcopy(me.winds[n][i].alt1.heading, me.winds[n][i].alt1.magnitude); + append(tempWind, waypoint_winds.newcopy(id, type, includeWind, wind1, wind2, wind3, wind4, wind5, sat1, alt1)); } return tempWind; }, diff --git a/Nasal/MCDU/WINDCLB.nas b/Nasal/MCDU/WINDCLB.nas index 75449484..a9c03e71 100644 --- a/Nasal/MCDU/WINDCLB.nas +++ b/Nasal/MCDU/WINDCLB.nas @@ -186,6 +186,8 @@ var windCLBPage = { } } me.reload(); + } else if (index == 6) { + setprop("/MCDU[" ~ me.computer ~ "]/page", "INITA"); } else if (me.items >= index) { if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) == 13) { var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad); diff --git a/Nasal/MCDU/WINDCRZ.nas b/Nasal/MCDU/WINDCRZ.nas index 07120522..2484343a 100644 --- a/Nasal/MCDU/WINDCRZ.nas +++ b/Nasal/MCDU/WINDCRZ.nas @@ -248,6 +248,8 @@ var windCRZPage = { } } me.reload(); + } else if (index == 6) { + setprop("/MCDU[" ~ me.computer ~ "]/page", "INITA"); } else if (me.items >= index) { if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) == 13) { var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad); diff --git a/Nasal/MCDU/WINDDES.nas b/Nasal/MCDU/WINDDES.nas index 64ad3b91..1a851d43 100644 --- a/Nasal/MCDU/WINDDES.nas +++ b/Nasal/MCDU/WINDDES.nas @@ -188,6 +188,8 @@ var windDESPage = { } } me.reload(); + } else if (index == 6) { + setprop("/MCDU[" ~ me.computer ~ "]/page", "INITA"); } else if (me.items >= index) { if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) == 13) { var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad); diff --git a/Nasal/MCDU/WINDHIST.nas b/Nasal/MCDU/WINDHIST.nas index 410dd46a..ab4844ee 100644 --- a/Nasal/MCDU/WINDHIST.nas +++ b/Nasal/MCDU/WINDHIST.nas @@ -42,29 +42,19 @@ var windHISTPage = { _setupPageWithData: func() { me.title = "HISTROY WIND"; me.titleColour = "wht"; - me.L1 = ["[ ]/[ ]", "", "blu"]; - me.L2 = ["[ ]/[ ]", "", "blu"]; - me.L3 = ["[ ]/[ ]", "", "blu"]; - me.L4 = ["[ ]/[ ]", "", "blu"]; - me.L5 = ["[ ]/[ ]", "", "blu"]; + me.L1 = ["----/---", "", "blu"]; + me.L2 = ["----/---", "", "blu"]; + me.L3 = ["----/---", "", "blu"]; + me.L4 = ["----/---", "", "blu"]; + me.L5 = ["----/---", "", "blu"]; me.L6 = [" CLIMB WIND", "", "wht"]; me.C1 = ["FL050", "", "blu"]; me.C2 = ["FL150", "", "blu"]; me.C3 = ["FL250", "", "blu"]; - me.C4 = ["FL---", "", "blu"]; + me.C4 = [" FL--- CRZ FL", "", "blu"]; me.C5 = ["FL370", "", "blu"]; me.R6 = ["SELECT ", "", "amb"]; -# me.L2 = [" R", " TURN", "blu"]; -# if (pts.Instrumentation.Altimeter.indicatedFt.getValue() >= 14000) { -# me.L2 = [" 1.5/----", "TIME/DIST", "blu"]; -# } else { -# me.L2 = [" 1.0/----", "TIME/DIST", "blu"]; -# } -# me.L6 = [" RETURN", nil, "wht"]; -# me.C4 = ["LAST EXIT", nil, "wht"]; -# me.C5 = ["---- ---.-", "UTC FUEL", "wht"]; -# me.R1 = ["COMPUTED ", nil, "wht"]; -# me.R2 = ["DATABASE ", nil, "wht"]; + me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0]]; me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["ack", "ack", "ack", "ack", "ack", "ack"]]; me.fontMatrix = [[1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0]]; From bee94d54e0741d3b8729125ee08302d32d182f66 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Thu, 11 Jun 2020 14:09:16 -0400 Subject: [PATCH 18/53] Hide alt wind if no alternate --- Nasal/MCDU/MCDU.nas | 6 ++++-- Nasal/MCDU/WINDCRZ.nas | 2 ++ Nasal/MCDU/WINDDES.nas | 12 ++++++++++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index ffa6486a..d80e6a8d 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -385,8 +385,8 @@ var lskbutton = func(btn, i) { fuelPredInput("L5",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCLB") { canvas_mcdu.myCLBWIND[i].pushButtonLeft(5); - # } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") { -# canvas_mcdu.myCRZWIND[i].pushButtonLeft(5); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDCRZ") { + canvas_mcdu.myCRZWIND[i].pushButtonLeft(5); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") { canvas_mcdu.myDESWIND[i].pushButtonLeft(5); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PERFTO") { @@ -498,6 +498,8 @@ var rskbutton = func(btn, i) { canvas_mcdu.myHISTWIND[i].reload(); } setprop("MCDU[" ~ i ~ "]/page", "WINDHIST"); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "WINDDES") { + canvas_mcdu.myDESWIND[i].pushButtonRight(1); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "RADNAV") { radnavInput("R1",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "PRINTFUNC") { diff --git a/Nasal/MCDU/WINDCRZ.nas b/Nasal/MCDU/WINDCRZ.nas index 2484343a..76da03a6 100644 --- a/Nasal/MCDU/WINDCRZ.nas +++ b/Nasal/MCDU/WINDCRZ.nas @@ -250,6 +250,8 @@ var windCRZPage = { me.reload(); } else if (index == 6) { setprop("/MCDU[" ~ me.computer ~ "]/page", "INITA"); + } else if (index == 5) { + #set sat temp here } else if (me.items >= index) { if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) == 13) { var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad); diff --git a/Nasal/MCDU/WINDDES.nas b/Nasal/MCDU/WINDDES.nas index 1a851d43..277fe1f4 100644 --- a/Nasal/MCDU/WINDDES.nas +++ b/Nasal/MCDU/WINDDES.nas @@ -133,7 +133,13 @@ var windDESPage = { } me.L6 = [" RETURN", nil, "wht"]; - me.R1 = ["[ ]/[ ]", "ALTN WIND ", "blu"]; + + if (getprop("/FMGC/internal/alt-set")) { + me.R1 = ["[ ]/[ ]", "ALTN WIND ", "blu"]; + } else { + me.R1 = ["", "", "blu"]; + } + me.R3 = [" REQUEST ", "WIND ", "amb"]; me.R4 = [" PHASE ", "PREV ", "wht"]; @@ -241,7 +247,9 @@ var windDESPage = { } }, pushButtonRight: func(index) { - if (index == 6 and fmgc.flightPlanController.temporaryFlag[me.computer]) { + if (index == 1 and getprop("/FMGC/internal/alt-set")) { + # set alt wind here + } if (index == 6 and fmgc.flightPlanController.temporaryFlag[me.computer]) { if (canvas_mcdu.myFpln[me.computer] != nil) { canvas_mcdu.myFpln[me.computer].pushButtonRight(index); } else { From f3f84d1c692a691ff2abd9fd60f2abedfd1a8669 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Thu, 11 Jun 2020 14:20:25 -0400 Subject: [PATCH 19/53] Push alternate changes :) --- Nasal/MCDU/INITA.nas | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Nasal/MCDU/INITA.nas b/Nasal/MCDU/INITA.nas index 5e0402fd..95e4b3df 100644 --- a/Nasal/MCDU/INITA.nas +++ b/Nasal/MCDU/INITA.nas @@ -9,6 +9,7 @@ var initInputA = func(key, i) { if (scratchpad == "CLR") { setprop("/FMGC/internal/alt-airport", ""); setprop("/FMGC/internal/alt-set", 0); + fmgc.windController.updatePlans(); if (getprop("/FMGC/internal/block-confirmed")) { setprop("/FMGC/internal/fuel-calculating", 0); setprop("/FMGC/internal/fuel-calculating", 1); @@ -24,6 +25,7 @@ var initInputA = func(key, i) { if (tfs == 4) { setprop("/FMGC/internal/alt-airport", scratchpad); setprop("/FMGC/internal/alt-set", 1); + fmgc.windController.updatePlans(); if (getprop("/FMGC/internal/block-confirmed")) { setprop("/FMGC/internal/fuel-calculating", 0); setprop("/FMGC/internal/fuel-calculating", 1); From 9f867a6bd0ece9ebf9942a864d9512a4838c530c Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Thu, 11 Jun 2020 14:43:32 -0400 Subject: [PATCH 20/53] Fix nasal bug --- Nasal/FMGC/winds.nas | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Nasal/FMGC/winds.nas b/Nasal/FMGC/winds.nas index 30d0f064..c0c4b50f 100644 --- a/Nasal/FMGC/winds.nas +++ b/Nasal/FMGC/winds.nas @@ -176,7 +176,7 @@ var windController = { var wind3 = wind.newcopy(me.clb_winds[n].wind3.heading, me.clb_winds[n].wind3.magnitude, me.clb_winds[n].wind3.altitude); var wind4 = wind.newcopy(me.clb_winds[n].wind4.heading, me.clb_winds[n].wind4.magnitude, me.clb_winds[n].wind4.altitude); var wind5 = wind.newcopy(me.clb_winds[n].wind5.heading, me.clb_winds[n].wind5.magnitude, me.clb_winds[n].wind5.altitude); - var sat1 = alt_wind.newcopy(me.clb_winds[n].sat1.temperature, me.clb_winds[n].sat1.altitude); + var sat1 = alt_wind.newcopy(me.clb_winds[n].sat1.temp, me.clb_winds[n].sat1.altitude); var alt1 = sat_temp.newcopy(me.clb_winds[n].alt1.heading, me.clb_winds[n].alt1.magnitude); return waypoint_winds.newcopy(id, type, includeWind, wind1, wind2, wind3, wind4, wind5, sat1, alt1); }, @@ -190,7 +190,7 @@ var windController = { var wind3 = wind.newcopy(me.crz_winds[n].wind3.heading, me.crz_winds[n].wind3.magnitude, me.crz_winds[n].wind3.altitude); var wind4 = wind.newcopy(me.crz_winds[n].wind4.heading, me.crz_winds[n].wind4.magnitude, me.crz_winds[n].wind4.altitude); var wind5 = wind.newcopy(me.crz_winds[n].wind5.heading, me.crz_winds[n].wind5.magnitude, me.crz_winds[n].wind5.altitude); - var sat1 = alt_wind.newcopy(me.crz_winds[n].sat1.temperature, me.crz_winds[n].sat1.altitude); + var sat1 = alt_wind.newcopy(me.crz_winds[n].sat1.temp, me.crz_winds[n].sat1.altitude); var alt1 = sat_temp.newcopy(me.crz_winds[n].alt1.heading, me.crz_winds[n].alt1.magnitude); return waypoint_winds.newcopy(id, type, includeWind, wind1, wind2, wind3, wind4, wind5, sat1, alt1); }, @@ -220,7 +220,7 @@ var windController = { var wind3 = wind.newcopy(me.winds[n][i].wind3.heading, me.winds[n][i].wind3.magnitude, me.winds[n][i].wind3.altitude); var wind4 = wind.newcopy(me.winds[n][i].wind4.heading, me.winds[n][i].wind4.magnitude, me.winds[n][i].wind4.altitude); var wind5 = wind.newcopy(me.winds[n][i].wind5.heading, me.winds[n][i].wind5.magnitude, me.winds[n][i].wind5.altitude); - var sat1 = alt_wind.newcopy(me.winds[n][i].sat1.temperature, me.winds[n][i].sat1.altitude); + var sat1 = alt_wind.newcopy(me.winds[n][i].sat1.temp, me.winds[n][i].sat1.altitude); var alt1 = sat_temp.newcopy(me.winds[n][i].alt1.heading, me.winds[n][i].alt1.magnitude); append(tempWind, waypoint_winds.newcopy(id, type, includeWind, wind1, wind2, wind3, wind4, wind5, sat1, alt1)); } From 3332a106f29726a8cbf71f47cb610c17dd810986 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Thu, 11 Jun 2020 14:56:09 -0400 Subject: [PATCH 21/53] Another typo, temporary bug fix --- Nasal/FMGC/winds.nas | 16 ++++++++-------- Nasal/MCDU/WINDCLB.nas | 1 + Nasal/MCDU/WINDCRZ.nas | 1 + Nasal/MCDU/WINDDES.nas | 9 +++++---- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/Nasal/FMGC/winds.nas b/Nasal/FMGC/winds.nas index c0c4b50f..c48e589e 100644 --- a/Nasal/FMGC/winds.nas +++ b/Nasal/FMGC/winds.nas @@ -176,8 +176,8 @@ var windController = { var wind3 = wind.newcopy(me.clb_winds[n].wind3.heading, me.clb_winds[n].wind3.magnitude, me.clb_winds[n].wind3.altitude); var wind4 = wind.newcopy(me.clb_winds[n].wind4.heading, me.clb_winds[n].wind4.magnitude, me.clb_winds[n].wind4.altitude); var wind5 = wind.newcopy(me.clb_winds[n].wind5.heading, me.clb_winds[n].wind5.magnitude, me.clb_winds[n].wind5.altitude); - var sat1 = alt_wind.newcopy(me.clb_winds[n].sat1.temp, me.clb_winds[n].sat1.altitude); - var alt1 = sat_temp.newcopy(me.clb_winds[n].alt1.heading, me.clb_winds[n].alt1.magnitude); + var sat1 = sat_temp.newcopy(me.clb_winds[n].sat1.temp, me.clb_winds[n].sat1.altitude); + var alt1 = alt_wind.newcopy(me.clb_winds[n].alt1.heading, me.clb_winds[n].alt1.magnitude); return waypoint_winds.newcopy(id, type, includeWind, wind1, wind2, wind3, wind4, wind5, sat1, alt1); }, @@ -190,8 +190,8 @@ var windController = { var wind3 = wind.newcopy(me.crz_winds[n].wind3.heading, me.crz_winds[n].wind3.magnitude, me.crz_winds[n].wind3.altitude); var wind4 = wind.newcopy(me.crz_winds[n].wind4.heading, me.crz_winds[n].wind4.magnitude, me.crz_winds[n].wind4.altitude); var wind5 = wind.newcopy(me.crz_winds[n].wind5.heading, me.crz_winds[n].wind5.magnitude, me.crz_winds[n].wind5.altitude); - var sat1 = alt_wind.newcopy(me.crz_winds[n].sat1.temp, me.crz_winds[n].sat1.altitude); - var alt1 = sat_temp.newcopy(me.crz_winds[n].alt1.heading, me.crz_winds[n].alt1.magnitude); + var sat1 = sat_temp.newcopy(me.crz_winds[n].sat1.temp, me.crz_winds[n].sat1.altitude); + var alt1 = alt_wind.newcopy(me.crz_winds[n].alt1.heading, me.crz_winds[n].alt1.magnitude); return waypoint_winds.newcopy(id, type, includeWind, wind1, wind2, wind3, wind4, wind5, sat1, alt1); }, @@ -204,8 +204,8 @@ var windController = { var wind3 = wind.newcopy(me.des_winds[n].wind3.heading, me.des_winds[n].wind3.magnitude, me.des_winds[n].wind3.altitude); var wind4 = wind.newcopy(me.des_winds[n].wind4.heading, me.des_winds[n].wind4.magnitude, me.des_winds[n].wind4.altitude); var wind5 = wind.newcopy(me.des_winds[n].wind5.heading, me.des_winds[n].wind5.magnitude, me.des_winds[n].wind5.altitude); - var sat1 = alt_wind.newcopy(me.des_winds[n].sat1.temp, me.des_winds[n].sat1.altitude); - var alt1 = sat_temp.newcopy(me.des_winds[n].alt1.heading, me.des_winds[n].alt1.magnitude); + var sat1 = sat_temp.newcopy(me.des_winds[n].sat1.temp, me.des_winds[n].sat1.altitude); + var alt1 = alt_wind.newcopy(me.des_winds[n].alt1.heading, me.des_winds[n].alt1.magnitude); return waypoint_winds.newcopy(id, type, includeWind, wind1, wind2, wind3, wind4, wind5, sat1, alt1); }, @@ -220,8 +220,8 @@ var windController = { var wind3 = wind.newcopy(me.winds[n][i].wind3.heading, me.winds[n][i].wind3.magnitude, me.winds[n][i].wind3.altitude); var wind4 = wind.newcopy(me.winds[n][i].wind4.heading, me.winds[n][i].wind4.magnitude, me.winds[n][i].wind4.altitude); var wind5 = wind.newcopy(me.winds[n][i].wind5.heading, me.winds[n][i].wind5.magnitude, me.winds[n][i].wind5.altitude); - var sat1 = alt_wind.newcopy(me.winds[n][i].sat1.temp, me.winds[n][i].sat1.altitude); - var alt1 = sat_temp.newcopy(me.winds[n][i].alt1.heading, me.winds[n][i].alt1.magnitude); + var sat1 = sat_temp.newcopy(me.winds[n][i].sat1.temp, me.winds[n][i].sat1.altitude); + var alt1 = alt_wind.newcopy(me.winds[n][i].alt1.heading, me.winds[n][i].alt1.magnitude); append(tempWind, waypoint_winds.newcopy(id, type, includeWind, wind1, wind2, wind3, wind4, wind5, sat1, alt1)); } return tempWind; diff --git a/Nasal/MCDU/WINDCLB.nas b/Nasal/MCDU/WINDCLB.nas index a9c03e71..7e62588a 100644 --- a/Nasal/MCDU/WINDCLB.nas +++ b/Nasal/MCDU/WINDCLB.nas @@ -34,6 +34,7 @@ var windCLBPage = { var wcp = {parents:[windCLBPage]}; wcp.computer = computer; wcp._setupPageWithData(); + wcp.updateTmpy(); return wcp; }, del: func() { diff --git a/Nasal/MCDU/WINDCRZ.nas b/Nasal/MCDU/WINDCRZ.nas index 76da03a6..be9dd959 100644 --- a/Nasal/MCDU/WINDCRZ.nas +++ b/Nasal/MCDU/WINDCRZ.nas @@ -42,6 +42,7 @@ var windCRZPage = { wcp.singleCRZ = 1; } wcp._setupPageWithData(); + wcp.updateTmpy(); return wcp; }, del: func() { diff --git a/Nasal/MCDU/WINDDES.nas b/Nasal/MCDU/WINDDES.nas index 277fe1f4..335e079d 100644 --- a/Nasal/MCDU/WINDDES.nas +++ b/Nasal/MCDU/WINDDES.nas @@ -31,10 +31,11 @@ var windDESPage = { computer: nil, items: 0, new: func(computer) { - var wcp = {parents:[windDESPage]}; - wcp.computer = computer; - wcp._setupPageWithData(); - return wcp; + var wdp = {parents:[windDESPage]}; + wdp.computer = computer; + wdp._setupPageWithData(); + wdp.updateTmpy(); + return wdp; }, del: func() { return nil; From acefe499f28a0015eef74d647edf437bf0711076 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Thu, 11 Jun 2020 17:25:15 -0400 Subject: [PATCH 22/53] Enable cruize temp field --- Nasal/MCDU/WINDCRZ.nas | 62 +++++++++++++++++++++++++++++++++--------- 1 file changed, 49 insertions(+), 13 deletions(-) diff --git a/Nasal/MCDU/WINDCRZ.nas b/Nasal/MCDU/WINDCRZ.nas index be9dd959..d81924af 100644 --- a/Nasal/MCDU/WINDCRZ.nas +++ b/Nasal/MCDU/WINDCRZ.nas @@ -142,6 +142,15 @@ var windCRZPage = { me.fontMatrix[0][0] = 1; } } + + wind = fmgc.windController.crz_winds[computer_temp].sat1; + if (wind.altitude != "") { + me.L5 = [wind.temp ~ "/" ~ wind.altitude, "SAT / ALT", "blu"]; + me.fontMatrix[0][4] = 0; + } else { + me.L5 = ["[ ]/[ ]", "SAT / ALT", "blu"]; + me.fontMatrix[0][4] = 1; + } } else { if (me.items >= 4) { wind = fmgc.windController.winds[computer_temp][me.match_location].wind4; @@ -192,9 +201,17 @@ var windCRZPage = { me.fontMatrix[0][0] = 1; } } + + wind = fmgc.windController.winds[computer_temp][me.match_location].sat1; + if (wind.altitude != "") { + me.L5 = [wind.temp ~ "/" ~ wind.altitude, "SAT / ALT", "blu"]; + me.fontMatrix[0][4] = 0; + } else { + me.L5 = ["[ ]/[ ]", "SAT / ALT", "blu"]; + me.fontMatrix[0][4] = 1; + } } - me.L5 = ["[ ]/[ ]", "SAT / ALT", "blu"]; me.L6 = [" RETURN", nil, "wht"]; me.R2 = [" REQUEST ", "WIND ", "amb"]; me.R4 = [" PHASE ", "PREV ", "wht"]; @@ -252,7 +269,34 @@ var windCRZPage = { } else if (index == 6) { setprop("/MCDU[" ~ me.computer ~ "]/page", "INITA"); } else if (index == 5) { - #set sat temp here + var sts = size(mcdu_scratchpad.scratchpads[me.computer].scratchpad); + if (sts >= 7 and sts <= 9) { + var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad); + if (size(winds[0]) >= 1 and size(winds[0]) <= 3 and num(winds[0]) != nil and winds[0] >= -99 and winds[0] <= -99 and + size(winds[1]) == 5 and ((num(winds[1]) != nil and winds[1] >= 1000 and winds[1] <= 39000) or + (num(split("FL", winds[1])[1]) != nil and split("FL", winds[1])[1] >= 10 and split("FL", winds[1])[1] <= 390))) { + me.makeTmpy(); + var computer_temp = 2; + if (fmgc.flightPlanController.temporaryFlag[me.computer]) { + computer_temp = me.computer; + } + #print(computer_temp); + if (me.singleCRZ == 1) { + fmgc.windController.crz_winds[computer_temp].sat1.temp = winds[0]; + fmgc.windController.crz_winds[computer_temp].sat1.altitude = winds[1]; + } else { + fmgc.windController.winds[computer_temp][me.match_location].sat1.temp = winds[0]; + fmgc.windController.winds[computer_temp][me.match_location].sat1.altitude = winds[1]; + } + mcdu_scratchpad.scratchpads[me.computer].empty(); + me._setupPageWithData(); + me.updateTmpy(); + } else { + mcdu_message(me.computer, "NOT ALLOWED"); + } + } else { + mcdu_message(me.computer, "NOT ALLOWED"); + } } else if (me.items >= index) { if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) == 13) { var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad); @@ -267,11 +311,7 @@ var windCRZPage = { } #print(computer_temp); if (me.singleCRZ == 1) { - if (index == 5) { - fmgc.windController.crz_winds[computer_temp].wind5.heading = winds[0]; - fmgc.windController.crz_winds[computer_temp].wind5.magnitude = winds[1]; - fmgc.windController.crz_winds[computer_temp].wind5.altitude = winds[2]; - } else if (index == 4) { + if (index == 4) { fmgc.windController.crz_winds[computer_temp].wind4.heading = winds[0]; fmgc.windController.crz_winds[computer_temp].wind4.magnitude = winds[1]; fmgc.windController.crz_winds[computer_temp].wind4.altitude = winds[2]; @@ -289,11 +329,7 @@ var windCRZPage = { fmgc.windController.crz_winds[computer_temp].wind1.altitude = winds[2]; } } else { - if (index == 5) { - fmgc.windController.winds[computer_temp][me.match_location].wind5.heading = winds[0]; - fmgc.windController.winds[computer_temp][me.match_location].wind5.magnitude = winds[1]; - fmgc.windController.winds[computer_temp][me.match_location].wind5.altitude = winds[2]; - } else if (index == 4) { + if (index == 4) { fmgc.windController.winds[computer_temp][me.match_location].wind4.heading = winds[0]; fmgc.windController.winds[computer_temp][me.match_location].wind4.magnitude = winds[1]; fmgc.windController.winds[computer_temp][me.match_location].wind4.altitude = winds[2]; @@ -312,7 +348,7 @@ var windCRZPage = { } } mcdu_scratchpad.scratchpads[me.computer].empty(); - if (me.items == index and index != 5) { + if (me.items == index and index != 4) { me.items += 1; } me._setupPageWithData(); From ca9e8b53389df5a7709f48673eabf1d6e5fe95d8 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Thu, 11 Jun 2020 17:48:19 -0400 Subject: [PATCH 23/53] Enable alternate wind --- Nasal/MCDU/WINDDES.nas | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/Nasal/MCDU/WINDDES.nas b/Nasal/MCDU/WINDDES.nas index 335e079d..6489381f 100644 --- a/Nasal/MCDU/WINDDES.nas +++ b/Nasal/MCDU/WINDDES.nas @@ -136,7 +136,14 @@ var windDESPage = { me.L6 = [" RETURN", nil, "wht"]; if (getprop("/FMGC/internal/alt-set")) { - me.R1 = ["[ ]/[ ]", "ALTN WIND ", "blu"]; + wind = fmgc.windController.winds[computer_temp][me.match_location].alt1; + if (wind.heading != 0 and wind.magnitude != 0) { + me.R1 = [wind.heading ~ "/" ~ wind.magnitude, "ALTN WIND ", "blu"]; + me.fontMatrix[1][0] = 0; + } else { + me.R1 = ["[ ]/[ ]", "ALTN WIND ", "blu"]; + me.fontMatrix[1][0] = 1; + } } else { me.R1 = ["", "", "blu"]; } @@ -249,7 +256,27 @@ var windDESPage = { }, pushButtonRight: func(index) { if (index == 1 and getprop("/FMGC/internal/alt-set")) { - # set alt wind here + if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) == 7) { + var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad); + if (size(winds[0]) == 3 and num(winds[0]) != nil and winds[0] >= 0 and winds[0] <= 360 and + size(winds[1]) == 3 and num(winds[1]) != nil and winds[1] >= 0 and winds[1] <= 200) { + me.makeTmpy(); + var computer_temp = 2; + if (fmgc.flightPlanController.temporaryFlag[me.computer]) { + computer_temp = me.computer; + } + #print(computer_temp); + fmgc.windController.des_winds[computer_temp].alt1.heading = winds[0]; + fmgc.windController.des_winds[computer_temp].alt1.magnitude = winds[1]; + mcdu_scratchpad.scratchpads[me.computer].empty(); + me._setupPageWithData(); + me.updateTmpy(); + } else { + mcdu_message(me.computer, "NOT ALLOWED"); + } + } else { + mcdu_message(me.computer, "NOT ALLOWED"); + } } if (index == 6 and fmgc.flightPlanController.temporaryFlag[me.computer]) { if (canvas_mcdu.myFpln[me.computer] != nil) { canvas_mcdu.myFpln[me.computer].pushButtonRight(index); From 9986b4b7f9806727d03e901339a41610c6866a15 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Thu, 11 Jun 2020 18:08:47 -0400 Subject: [PATCH 24/53] Fix nasal error when adding navaids --- Nasal/FMGC/winds.nas | 28 ++++++++++++++++++++-------- Nasal/MCDU/WINDCRZ.nas | 2 ++ Nasal/MCDU/WINDDES.nas | 6 +++--- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/Nasal/FMGC/winds.nas b/Nasal/FMGC/winds.nas index c48e589e..39a1fe3f 100644 --- a/Nasal/FMGC/winds.nas +++ b/Nasal/FMGC/winds.nas @@ -358,8 +358,6 @@ var windController = { } } - debug.dump(me.nav_indicies); - if (canvas_mcdu.myCLBWIND[1] != nil) { canvas_mcdu.myCLBWIND[1].reload(); } @@ -367,16 +365,30 @@ var windController = { canvas_mcdu.myCLBWIND[0].reload(); } if (canvas_mcdu.myCRZWIND[1] != nil) { - if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.windController.nav_indicies[1]) > 0) { - canvas_mcdu.myCRZWIND[1].waypoint = fmgc.flightPlanController.flightplans[2].getWP(me.nav_indicies[2][0]); - canvas_mcdu.myCRZWIND[1].cur_location = 0; + if (fmgc.flightPlanController.temporaryFlag[1]) { + if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.windController.nav_indicies[2]) > 0) { + canvas_mcdu.myCRZWIND[1].waypoint = fmgc.flightPlanController.flightplans[2].getWP(me.nav_indicies[2][0]); + canvas_mcdu.myCRZWIND[1].cur_location = 0; + } + } else { + if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.windController.nav_indicies[1]) > 0) { + canvas_mcdu.myCRZWIND[1].waypoint = fmgc.flightPlanController.flightplans[1].getWP(me.nav_indicies[1][0]); + canvas_mcdu.myCRZWIND[1].cur_location = 0; + } } canvas_mcdu.myCRZWIND[1].reload(); } if (canvas_mcdu.myCRZWIND[0] != nil) { - if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.windController.nav_indicies[0]) > 0) { - canvas_mcdu.myCRZWIND[0].waypoint = fmgc.flightPlanController.flightplans[2].getWP(me.nav_indicies[2][0]); - canvas_mcdu.myCRZWIND[0].cur_location = 0; + if (fmgc.flightPlanController.temporaryFlag[1]) { + if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.windController.nav_indicies[2]) > 0) { + canvas_mcdu.myCRZWIND[0].waypoint = fmgc.flightPlanController.flightplans[2].getWP(me.nav_indicies[2][0]); + canvas_mcdu.myCRZWIND[0].cur_location = 0; + } + } else { + if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.windController.nav_indicies[0]) > 0) { + canvas_mcdu.myCRZWIND[0].waypoint = fmgc.flightPlanController.flightplans[0].getWP(me.nav_indicies[0][0]); + canvas_mcdu.myCRZWIND[0].cur_location = 0; + } } canvas_mcdu.myCRZWIND[0].reload(); } diff --git a/Nasal/MCDU/WINDCRZ.nas b/Nasal/MCDU/WINDCRZ.nas index d81924af..d7c27a7c 100644 --- a/Nasal/MCDU/WINDCRZ.nas +++ b/Nasal/MCDU/WINDCRZ.nas @@ -49,6 +49,8 @@ var windCRZPage = { return nil; }, _setupPageWithData: func() { + print("setup called"); + if (me.singleCRZ == 1) { me.title = ["","CRZ WIND",""]; } else { diff --git a/Nasal/MCDU/WINDDES.nas b/Nasal/MCDU/WINDDES.nas index 6489381f..29aa2517 100644 --- a/Nasal/MCDU/WINDDES.nas +++ b/Nasal/MCDU/WINDDES.nas @@ -53,9 +53,9 @@ var windDESPage = { computer_temp = me.computer; } - debug.dump(fmgc.windController.des_winds[0]); - debug.dump(fmgc.windController.des_winds[1]); - debug.dump(fmgc.windController.des_winds[2]); + # debug.dump(fmgc.windController.des_winds[0]); +# debug.dump(fmgc.windController.des_winds[1]); +# debug.dump(fmgc.windController.des_winds[2]); if (fmgc.windController.des_winds[computer_temp] == 0 or fmgc.windController.des_winds[computer_temp].wind1.altitude == "") { me.items = 1; From ca1407d7d648dbae39e3181d99a85c4a227496df Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Fri, 12 Jun 2020 08:15:04 -0400 Subject: [PATCH 25/53] Major ug fix for crz page when using both mcdus (no more nasal errors!), minor temp fix --- Nasal/FMGC/winds.nas | 24 ++++++++++++++++++++++-- Nasal/MCDU/WINDCRZ.nas | 2 +- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/Nasal/FMGC/winds.nas b/Nasal/FMGC/winds.nas index 39a1fe3f..e7322fdd 100644 --- a/Nasal/FMGC/winds.nas +++ b/Nasal/FMGC/winds.nas @@ -365,28 +365,48 @@ var windController = { canvas_mcdu.myCLBWIND[0].reload(); } if (canvas_mcdu.myCRZWIND[1] != nil) { - if (fmgc.flightPlanController.temporaryFlag[1]) { + if (!fmgc.flightPlanController.temporaryFlag[1]) { if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.windController.nav_indicies[2]) > 0) { canvas_mcdu.myCRZWIND[1].waypoint = fmgc.flightPlanController.flightplans[2].getWP(me.nav_indicies[2][0]); + canvas_mcdu.myCRZWIND[1].singleCRZ = 0; + canvas_mcdu.myCRZWIND[1].cur_location = 0; + } else { + canvas_mcdu.myCRZWIND[1].waypoint = nil; + canvas_mcdu.myCRZWIND[1].singleCRZ = 1; canvas_mcdu.myCRZWIND[1].cur_location = 0; } } else { if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.windController.nav_indicies[1]) > 0) { canvas_mcdu.myCRZWIND[1].waypoint = fmgc.flightPlanController.flightplans[1].getWP(me.nav_indicies[1][0]); + canvas_mcdu.myCRZWIND[1].singleCRZ = 0; + canvas_mcdu.myCRZWIND[1].cur_location = 0; + } else { + canvas_mcdu.myCRZWIND[1].waypoint = nil; + canvas_mcdu.myCRZWIND[1].singleCRZ = 1; canvas_mcdu.myCRZWIND[1].cur_location = 0; } } canvas_mcdu.myCRZWIND[1].reload(); } if (canvas_mcdu.myCRZWIND[0] != nil) { - if (fmgc.flightPlanController.temporaryFlag[1]) { + if (!fmgc.flightPlanController.temporaryFlag[0]) { if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.windController.nav_indicies[2]) > 0) { canvas_mcdu.myCRZWIND[0].waypoint = fmgc.flightPlanController.flightplans[2].getWP(me.nav_indicies[2][0]); + canvas_mcdu.myCRZWIND[0].singleCRZ = 0; + canvas_mcdu.myCRZWIND[0].cur_location = 0; + } else { + canvas_mcdu.myCRZWIND[0].waypoint = nil; + canvas_mcdu.myCRZWIND[0].singleCRZ = 1; canvas_mcdu.myCRZWIND[0].cur_location = 0; } } else { if (getprop("/FMGC/internal/tofrom-set") and size(fmgc.windController.nav_indicies[0]) > 0) { canvas_mcdu.myCRZWIND[0].waypoint = fmgc.flightPlanController.flightplans[0].getWP(me.nav_indicies[0][0]); + canvas_mcdu.myCRZWIND[0].singleCRZ = 0; + canvas_mcdu.myCRZWIND[0].cur_location = 0; + } else { + canvas_mcdu.myCRZWIND[0].waypoint = nil; + canvas_mcdu.myCRZWIND[0].singleCRZ = 1; canvas_mcdu.myCRZWIND[0].cur_location = 0; } } diff --git a/Nasal/MCDU/WINDCRZ.nas b/Nasal/MCDU/WINDCRZ.nas index d7c27a7c..dc54871e 100644 --- a/Nasal/MCDU/WINDCRZ.nas +++ b/Nasal/MCDU/WINDCRZ.nas @@ -274,7 +274,7 @@ var windCRZPage = { var sts = size(mcdu_scratchpad.scratchpads[me.computer].scratchpad); if (sts >= 7 and sts <= 9) { var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad); - if (size(winds[0]) >= 1 and size(winds[0]) <= 3 and num(winds[0]) != nil and winds[0] >= -99 and winds[0] <= -99 and + if (size(winds[0]) >= 1 and size(winds[0]) <= 3 and num(winds[0]) != nil and winds[0] >= -99 and winds[0] <= 99 and size(winds[1]) == 5 and ((num(winds[1]) != nil and winds[1] >= 1000 and winds[1] <= 39000) or (num(split("FL", winds[1])[1]) != nil and split("FL", winds[1])[1] >= 10 and split("FL", winds[1])[1] <= 390))) { me.makeTmpy(); From 35852cc124771b05afeb644fbfa36fe9dc59c4e1 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Fri, 12 Jun 2020 09:52:32 -0400 Subject: [PATCH 26/53] Enable clearing for CLB winds --- Nasal/MCDU/WINDCLB.nas | 53 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/Nasal/MCDU/WINDCLB.nas b/Nasal/MCDU/WINDCLB.nas index 7e62588a..893ec553 100644 --- a/Nasal/MCDU/WINDCLB.nas +++ b/Nasal/MCDU/WINDCLB.nas @@ -232,6 +232,59 @@ var windCLBPage = { } else { mcdu_message(me.computer, "NOT ALLOWED"); } + } else if (mcdu_scratchpad.scratchpads[me.computer].scratchpad == "CLR") { + var computer_temp = 2; + if (fmgc.flightPlanController.temporaryFlag[me.computer]) { + computer_temp = me.computer; + } + if (me.items == index) { + if (index == 5) { + fmgc.windController.clb_winds[computer_temp].wind5.heading = 0; + fmgc.windController.clb_winds[computer_temp].wind5.magnitude = 0; + fmgc.windController.clb_winds[computer_temp].wind5.altitude = ""; + } else if (index == 4) { + fmgc.windController.clb_winds[computer_temp].wind4.heading = 0; + fmgc.windController.clb_winds[computer_temp].wind4.magnitude = 0; + fmgc.windController.clb_winds[computer_temp].wind4.altitude = ""; + } else if (index == 3) { + fmgc.windController.clb_winds[computer_temp].wind3.heading = 0; + fmgc.windController.clb_winds[computer_temp].wind3.magnitude = 0; + fmgc.windController.clb_winds[computer_temp].wind3.altitude = ""; + } else if (index == 2) { + fmgc.windController.clb_winds[computer_temp].wind2.heading = 0; + fmgc.windController.clb_winds[computer_temp].wind2.magnitude = 0; + fmgc.windController.clb_winds[computer_temp].wind2.altitude = ""; + } else if (index == 1) { + fmgc.windController.clb_winds[computer_temp].wind1.heading = 0; + fmgc.windController.clb_winds[computer_temp].wind1.magnitude = 0; + fmgc.windController.clb_winds[computer_temp].wind1.altitude = ""; + } + } else { + if (index <= 1) { + fmgc.windController.clb_winds[computer_temp].wind1.heading = fmgc.windController.clb_winds[computer_temp].wind2.heading; + fmgc.windController.clb_winds[computer_temp].wind1.magnitude = fmgc.windController.clb_winds[computer_temp].wind2.magnitude; + fmgc.windController.clb_winds[computer_temp].wind1.altitude = fmgc.windController.clb_winds[computer_temp].wind2.altitude; + } + if (index <= 2) { + fmgc.windController.clb_winds[computer_temp].wind2.heading = fmgc.windController.clb_winds[computer_temp].wind3.heading; + fmgc.windController.clb_winds[computer_temp].wind2.magnitude = fmgc.windController.clb_winds[computer_temp].wind3.magnitude; + fmgc.windController.clb_winds[computer_temp].wind2.altitude = fmgc.windController.clb_winds[computer_temp].wind3.altitude; + } + if (index <= 3) { + fmgc.windController.clb_winds[computer_temp].wind3.heading = fmgc.windController.clb_winds[computer_temp].wind4.heading; + fmgc.windController.clb_winds[computer_temp].wind3.magnitude = fmgc.windController.clb_winds[computer_temp].wind4.magnitude; + fmgc.windController.clb_winds[computer_temp].wind3.altitude = fmgc.windController.clb_winds[computer_temp].wind4.altitude; + } + if (index <= 4) { + fmgc.windController.clb_winds[computer_temp].wind4.heading = fmgc.windController.clb_winds[computer_temp].wind5.heading; + fmgc.windController.clb_winds[computer_temp].wind4.magnitude = fmgc.windController.clb_winds[computer_temp].wind5.magnitude; + fmgc.windController.clb_winds[computer_temp].wind4.altitude = fmgc.windController.clb_winds[computer_temp].wind5.altitude; + } + } + mcdu_scratchpad.scratchpads[me.computer].empty(); + me.items -= 0; + me._setupPageWithData(); + me.updateTmpy(); } else { mcdu_message(me.computer, "NOT ALLOWED"); } From da8dbc2cb9c22d3b16229cb1b577e292bf6a4da3 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Fri, 12 Jun 2020 10:11:57 -0400 Subject: [PATCH 27/53] Fix clearing bug, add descent winds --- Nasal/MCDU/WINDCLB.nas | 2 +- Nasal/MCDU/WINDDES.nas | 53 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 1 deletion(-) diff --git a/Nasal/MCDU/WINDCLB.nas b/Nasal/MCDU/WINDCLB.nas index 893ec553..f4f0aed8 100644 --- a/Nasal/MCDU/WINDCLB.nas +++ b/Nasal/MCDU/WINDCLB.nas @@ -282,7 +282,7 @@ var windCLBPage = { } } mcdu_scratchpad.scratchpads[me.computer].empty(); - me.items -= 0; + me.items -= 1; me._setupPageWithData(); me.updateTmpy(); } else { diff --git a/Nasal/MCDU/WINDDES.nas b/Nasal/MCDU/WINDDES.nas index 29aa2517..d1fd3d05 100644 --- a/Nasal/MCDU/WINDDES.nas +++ b/Nasal/MCDU/WINDDES.nas @@ -247,6 +247,59 @@ var windDESPage = { } else { mcdu_message(me.computer, "NOT ALLOWED"); } + } else if (mcdu_scratchpad.scratchpads[me.computer].scratchpad == "CLR") { + var computer_temp = 2; + if (fmgc.flightPlanController.temporaryFlag[me.computer]) { + computer_temp = me.computer; + } + if (me.items == index) { + if (index == 5) { + fmgc.windController.des_winds[computer_temp].wind5.heading = 0; + fmgc.windController.des_winds[computer_temp].wind5.magnitude = 0; + fmgc.windController.des_winds[computer_temp].wind5.altitude = ""; + } else if (index == 4) { + fmgc.windController.des_winds[computer_temp].wind4.heading = 0; + fmgc.windController.des_winds[computer_temp].wind4.magnitude = 0; + fmgc.windController.des_winds[computer_temp].wind4.altitude = ""; + } else if (index == 3) { + fmgc.windController.des_winds[computer_temp].wind3.heading = 0; + fmgc.windController.des_winds[computer_temp].wind3.magnitude = 0; + fmgc.windController.des_winds[computer_temp].wind3.altitude = ""; + } else if (index == 2) { + fmgc.windController.des_winds[computer_temp].wind2.heading = 0; + fmgc.windController.des_winds[computer_temp].wind2.magnitude = 0; + fmgc.windController.des_winds[computer_temp].wind2.altitude = ""; + } else if (index == 1) { + fmgc.windController.des_winds[computer_temp].wind1.heading = 0; + fmgc.windController.des_winds[computer_temp].wind1.magnitude = 0; + fmgc.windController.des_winds[computer_temp].wind1.altitude = ""; + } + } else { + if (index <= 1) { + fmgc.windController.des_winds[computer_temp].wind1.heading = fmgc.windController.des_winds[computer_temp].wind2.heading; + fmgc.windController.des_winds[computer_temp].wind1.magnitude = fmgc.windController.des_winds[computer_temp].wind2.magnitude; + fmgc.windController.des_winds[computer_temp].wind1.altitude = fmgc.windController.des_winds[computer_temp].wind2.altitude; + } + if (index <= 2) { + fmgc.windController.des_winds[computer_temp].wind2.heading = fmgc.windController.des_winds[computer_temp].wind3.heading; + fmgc.windController.des_winds[computer_temp].wind2.magnitude = fmgc.windController.des_winds[computer_temp].wind3.magnitude; + fmgc.windController.des_winds[computer_temp].wind2.altitude = fmgc.windController.des_winds[computer_temp].wind3.altitude; + } + if (index <= 3) { + fmgc.windController.des_winds[computer_temp].wind3.heading = fmgc.windController.des_winds[computer_temp].wind4.heading; + fmgc.windController.des_winds[computer_temp].wind3.magnitude = fmgc.windController.des_winds[computer_temp].wind4.magnitude; + fmgc.windController.des_winds[computer_temp].wind3.altitude = fmgc.windController.des_winds[computer_temp].wind4.altitude; + } + if (index <= 4) { + fmgc.windController.des_winds[computer_temp].wind4.heading = fmgc.windController.des_winds[computer_temp].wind5.heading; + fmgc.windController.des_winds[computer_temp].wind4.magnitude = fmgc.windController.des_winds[computer_temp].wind5.magnitude; + fmgc.windController.des_winds[computer_temp].wind4.altitude = fmgc.windController.des_winds[computer_temp].wind5.altitude; + } + } + mcdu_scratchpad.scratchpads[me.computer].empty(); + me.items -= 1; + me._setupPageWithData(); + me.updateTmpy(); } else { mcdu_message(me.computer, "NOT ALLOWED"); } From c01c1c34a7cd1af3c7762cc25f91b6d147d3168f Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Fri, 12 Jun 2020 10:29:48 -0400 Subject: [PATCH 28/53] Enable alternate wind clearing --- Nasal/MCDU/WINDDES.nas | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Nasal/MCDU/WINDDES.nas b/Nasal/MCDU/WINDDES.nas index d1fd3d05..fbf43257 100644 --- a/Nasal/MCDU/WINDDES.nas +++ b/Nasal/MCDU/WINDDES.nas @@ -136,7 +136,7 @@ var windDESPage = { me.L6 = [" RETURN", nil, "wht"]; if (getprop("/FMGC/internal/alt-set")) { - wind = fmgc.windController.winds[computer_temp][me.match_location].alt1; + wind = fmgc.windController.des_winds[computer_temp].alt1; if (wind.heading != 0 and wind.magnitude != 0) { me.R1 = [wind.heading ~ "/" ~ wind.magnitude, "ALTN WIND ", "blu"]; me.fontMatrix[1][0] = 0; @@ -327,10 +327,20 @@ var windDESPage = { } else { mcdu_message(me.computer, "NOT ALLOWED"); } + } else if (mcdu_scratchpad.scratchpads[me.computer].scratchpad == "CLR") { + var computer_temp = 2; + if (fmgc.flightPlanController.temporaryFlag[me.computer]) { + computer_temp = me.computer; + } + fmgc.windController.des_winds[computer_temp].alt1.heading = 0; + fmgc.windController.des_winds[computer_temp].alt1.magnitude = 0; + mcdu_scratchpad.scratchpads[me.computer].empty(); + me._setupPageWithData(); + me.updateTmpy(); } else { mcdu_message(me.computer, "NOT ALLOWED"); } - } if (index == 6 and fmgc.flightPlanController.temporaryFlag[me.computer]) { + } else if (index == 6 and fmgc.flightPlanController.temporaryFlag[me.computer]) { if (canvas_mcdu.myFpln[me.computer] != nil) { canvas_mcdu.myFpln[me.computer].pushButtonRight(index); } else { From e83ac26786a399704922943e3bef1f3c620b6f1a Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Fri, 12 Jun 2020 12:53:12 -0400 Subject: [PATCH 29/53] History wind bug fixes --- Nasal/FMGC/winds.nas | 6 ++++++ Nasal/MCDU/WINDHIST.nas | 9 +-------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Nasal/FMGC/winds.nas b/Nasal/FMGC/winds.nas index e7322fdd..d5658a28 100644 --- a/Nasal/FMGC/winds.nas +++ b/Nasal/FMGC/winds.nas @@ -418,5 +418,11 @@ var windController = { if (canvas_mcdu.myDESWIND[0] != nil) { canvas_mcdu.myDESWIND[0].reload(); } + if (canvas_mcdu.myHISTWIND[1] != nil) { + canvas_mcdu.myHISTWIND[1].reload(); + } + if (canvas_mcdu.myHISTWIND[0] != nil) { + canvas_mcdu.myHISTWIND[0].reload(); + } } }; diff --git a/Nasal/MCDU/WINDHIST.nas b/Nasal/MCDU/WINDHIST.nas index ab4844ee..94bd5b08 100644 --- a/Nasal/MCDU/WINDHIST.nas +++ b/Nasal/MCDU/WINDHIST.nas @@ -40,7 +40,7 @@ var windHISTPage = { return nil; }, _setupPageWithData: func() { - me.title = "HISTROY WIND"; + me.title = "HISTORY WIND"; me.titleColour = "wht"; me.L1 = ["----/---", "", "blu"]; me.L2 = ["----/---", "", "blu"]; @@ -95,12 +95,5 @@ var windHISTPage = { reload: func() { me._setupPageWithData(); me.updateTmpy(); - if (me.computer == 0) { - #canvas_mcdu.myHISTWIND[1].windList = me.windList; - canvas_mcdu.myHISTWIND[1]._setupPageWithData(); - } else { - #canvas_mcdu.myHISTWIND[0].windList = me.windList; - canvas_mcdu.myHISTWIND[0]._setupPageWithData(); - } } }; \ No newline at end of file From dd7c71c08bd143b98558522cf11086a2cf906964 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Fri, 12 Jun 2020 20:21:34 -0400 Subject: [PATCH 30/53] Enable clearing cruize temp --- Nasal/MCDU/WINDCRZ.nas | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Nasal/MCDU/WINDCRZ.nas b/Nasal/MCDU/WINDCRZ.nas index dc54871e..2b96a4f8 100644 --- a/Nasal/MCDU/WINDCRZ.nas +++ b/Nasal/MCDU/WINDCRZ.nas @@ -296,6 +296,22 @@ var windCRZPage = { } else { mcdu_message(me.computer, "NOT ALLOWED"); } + } else if (mcdu_scratchpad.scratchpads[me.computer].scratchpad == "CLR") { + var computer_temp = 2; + if (fmgc.flightPlanController.temporaryFlag[me.computer]) { + computer_temp = me.computer; + } + #print(computer_temp); + if (me.singleCRZ == 1) { + fmgc.windController.crz_winds[computer_temp].sat1.temp = 0; + fmgc.windController.crz_winds[computer_temp].sat1.altitude = ""; + } else { + fmgc.windController.winds[computer_temp][me.match_location].sat1.temp = 0; + fmgc.windController.winds[computer_temp][me.match_location].sat1.altitude = ""; + } + mcdu_scratchpad.scratchpads[me.computer].empty(); + me._setupPageWithData(); + me.updateTmpy(); } else { mcdu_message(me.computer, "NOT ALLOWED"); } From 2da3114861bce12f32915a3bf3cdf9dcad2275e7 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Fri, 12 Jun 2020 20:39:15 -0400 Subject: [PATCH 31/53] Enable clearing on crz page --- Nasal/MCDU/WINDCRZ.nas | 83 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/Nasal/MCDU/WINDCRZ.nas b/Nasal/MCDU/WINDCRZ.nas index 2b96a4f8..2da2717d 100644 --- a/Nasal/MCDU/WINDCRZ.nas +++ b/Nasal/MCDU/WINDCRZ.nas @@ -374,6 +374,89 @@ var windCRZPage = { } else { mcdu_message(me.computer, "NOT ALLOWED"); } + } else if (mcdu_scratchpad.scratchpads[me.computer].scratchpad == "CLR") { + var computer_temp = 2; + if (fmgc.flightPlanController.temporaryFlag[me.computer]) { + computer_temp = me.computer; + } + #print(computer_temp); + if (me.singleCRZ == 1) { + if (me.items == index) { + if (index == 4) { + fmgc.windController.crz_winds[computer_temp].wind4.heading = 0; + fmgc.windController.crz_winds[computer_temp].wind4.magnitude = 0; + fmgc.windController.crz_winds[computer_temp].wind4.altitude = ""; + } else if (index == 3) { + fmgc.windController.crz_winds[computer_temp].wind3.heading = 0; + fmgc.windController.crz_winds[computer_temp].wind3.magnitude = 0; + fmgc.windController.crz_winds[computer_temp].wind3.altitude = ""; + } else if (index == 2) { + fmgc.windController.crz_winds[computer_temp].wind2.heading = 0; + fmgc.windController.crz_winds[computer_temp].wind2.magnitude = 0; + fmgc.windController.crz_winds[computer_temp].wind2.altitude = ""; + } else if (index == 1) { + fmgc.windController.crz_winds[computer_temp].wind1.heading = 0; + fmgc.windController.crz_winds[computer_temp].wind1.magnitude = 0; + fmgc.windController.crz_winds[computer_temp].wind1.altitude = ""; + } + } else { + if (index <= 1) { + fmgc.windController.crz_winds[computer_temp].wind1.heading = fmgc.windController.crz_winds[computer_temp].wind2.heading; + fmgc.windController.crz_winds[computer_temp].wind1.magnitude = fmgc.windController.crz_winds[computer_temp].wind2.magnitude; + fmgc.windController.crz_winds[computer_temp].wind1.altitude = fmgc.windController.crz_winds[computer_temp].wind2.altitude; + } + if (index <= 2) { + fmgc.windController.crz_winds[computer_temp].wind2.heading = fmgc.windController.crz_winds[computer_temp].wind3.heading; + fmgc.windController.crz_winds[computer_temp].wind2.magnitude = fmgc.windController.crz_winds[computer_temp].wind3.magnitude; + fmgc.windController.crz_winds[computer_temp].wind2.altitude = fmgc.windController.crz_winds[computer_temp].wind3.altitude; + } + if (index <= 3) { + fmgc.windController.crz_winds[computer_temp].wind3.heading = fmgc.windController.crz_winds[computer_temp].wind4.heading; + fmgc.windController.crz_winds[computer_temp].wind3.magnitude = fmgc.windController.crz_winds[computer_temp].wind4.magnitude; + fmgc.windController.crz_winds[computer_temp].wind3.altitude = fmgc.windController.crz_winds[computer_temp].wind4.altitude; + } + } + } else { + if (me.items == index) { + if (index == 4) { + fmgc.windController.winds[computer_temp][me.match_location].wind4.heading = 0; + fmgc.windController.winds[computer_temp][me.match_location].wind4.magnitude = 0; + fmgc.windController.winds[computer_temp][me.match_location].wind4.altitude = ""; + } else if (index == 3) { + fmgc.windController.winds[computer_temp][me.match_location].wind3.heading = 0; + fmgc.windController.winds[computer_temp][me.match_location].wind3.magnitude = 0; + fmgc.windController.winds[computer_temp][me.match_location].wind3.altitude = ""; + } else if (index == 2) { + fmgc.windController.winds[computer_temp][me.match_location].wind2.heading = 0; + fmgc.windController.winds[computer_temp][me.match_location].wind2.magnitude = 0; + fmgc.windController.winds[computer_temp][me.match_location].wind2.altitude = ""; + } else if (index == 1) { + fmgc.windController.winds[computer_temp][me.match_location].wind1.heading = 0; + fmgc.windController.winds[computer_temp][me.match_location].wind1.magnitude = 0; + fmgc.windController.winds[computer_temp][me.match_location].wind1.altitude = ""; + } + } else { + if (index <= 1) { + fmgc.windController.winds[computer_temp][me.match_location].wind1.heading = fmgc.windController.winds[computer_temp][me.match_location].wind2.heading; + fmgc.windController.winds[computer_temp][me.match_location].wind1.magnitude = fmgc.windController.winds[computer_temp][me.match_location].wind2.magnitude; + fmgc.windController.winds[computer_temp][me.match_location].wind1.altitude = fmgc.windController.winds[computer_temp][me.match_location].wind2.altitude; + } + if (index <= 2) { + fmgc.windController.winds[computer_temp][me.match_location].wind2.heading = fmgc.windController.winds[computer_temp][me.match_location].wind3.heading; + fmgc.windController.winds[computer_temp][me.match_location].wind2.magnitude = fmgc.windController.winds[computer_temp][me.match_location].wind3.magnitude; + fmgc.windController.winds[computer_temp][me.match_location].wind2.altitude = fmgc.windController.winds[computer_temp][me.match_location].wind3.altitude; + } + if (index <= 3) { + fmgc.windController.winds[computer_temp][me.match_location].wind3.heading = fmgc.windController.winds[computer_temp][me.match_location].wind4.heading; + fmgc.windController.winds[computer_temp][me.match_location].wind3.magnitude = fmgc.windController.winds[computer_temp][me.match_location].wind4.magnitude; + fmgc.windController.winds[computer_temp][me.match_location].wind3.altitude = fmgc.windController.winds[computer_temp][me.match_location].wind4.altitude; + } + } + } + mcdu_scratchpad.scratchpads[me.computer].empty(); + me.items -= 1; + me._setupPageWithData(); + me.updateTmpy(); } else { mcdu_message(me.computer, "NOT ALLOWED"); } From 80ef332f29a06089d1df2f7c3cd13c50338a3964 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Fri, 12 Jun 2020 21:28:14 -0400 Subject: [PATCH 32/53] Add access to wind pages from DATA2, save previous page in winds --- A320-main.xml | 1 + Nasal/FMGC/winds.nas | 1 + Nasal/MCDU/DATA2.nas | 15 +++++++++++++++ Nasal/MCDU/INITA.nas | 1 + Nasal/MCDU/MCDU.nas | 2 ++ Nasal/MCDU/WINDCLB.nas | 2 +- Nasal/MCDU/WINDCRZ.nas | 2 +- Nasal/MCDU/WINDDES.nas | 2 +- 8 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 Nasal/MCDU/DATA2.nas diff --git a/A320-main.xml b/A320-main.xml index e9f6956f..2726fd11 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -4081,6 +4081,7 @@ Aircraft/A320-family/Nasal/MCDU/PERFTO.nas Aircraft/A320-family/Nasal/MCDU/RADNAV.nas Aircraft/A320-family/Nasal/MCDU/DATA.nas + Aircraft/A320-family/Nasal/MCDU/DATA2.nas Aircraft/A320-family/Nasal/MCDU/STATUS.nas diff --git a/Nasal/FMGC/winds.nas b/Nasal/FMGC/winds.nas index d5658a28..0d3284d6 100644 --- a/Nasal/FMGC/winds.nas +++ b/Nasal/FMGC/winds.nas @@ -141,6 +141,7 @@ var windController = { winds: [[], [], []], #waypoint winds used if route includes navaids nav_indicies: [[], [], []], windSizes: [0, 0, 0], + accessPage: ["", ""], #temporaryFlag: [0, 0], init: func() { diff --git a/Nasal/MCDU/DATA2.nas b/Nasal/MCDU/DATA2.nas new file mode 100644 index 00000000..650f8bd7 --- /dev/null +++ b/Nasal/MCDU/DATA2.nas @@ -0,0 +1,15 @@ +# A3XX mCDU by Joshua Davidson (Octal450), Jonathan Redpath, and Matthew Maring (mattmaring) + +# Copyright (c) 2020 Matthew Maring (mattmaring) + +var data2Input = func(key, i) { + if (key == "L5") { + if (canvas_mcdu.myCLBWIND[i] == nil) { + canvas_mcdu.myCLBWIND[i] = windCLBPage.new(i); + } else { + canvas_mcdu.myCLBWIND[i].reload(); + } + fmgc.windController.accessPage[i] = "DATA2"; + setprop("MCDU[" ~ i ~ "]/page", "WINDCLB"); + } +} diff --git a/Nasal/MCDU/INITA.nas b/Nasal/MCDU/INITA.nas index 95e4b3df..5a9fef65 100644 --- a/Nasal/MCDU/INITA.nas +++ b/Nasal/MCDU/INITA.nas @@ -232,6 +232,7 @@ var initInputA = func(key, i) { } else { canvas_mcdu.myCLBWIND[i].reload(); } + fmgc.windController.accessPage[i] = "INITA"; setprop("MCDU[" ~ i ~ "]/page", "WINDCLB"); } else if (key == "R5") { if (scratchpad == "CLR") { diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index d80e6a8d..b6b2f294 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -409,6 +409,8 @@ var lskbutton = func(btn, i) { printInput2("L5",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DATA") { dataInput("L5",i); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DATA2") { + data2Input("L5",i); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNA" or getprop("/MCDU[" ~ i ~ "]/page") == "F-PLNB") { canvas_mcdu.myFpln[i].pushButtonLeft(5); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DEPARTURE") { diff --git a/Nasal/MCDU/WINDCLB.nas b/Nasal/MCDU/WINDCLB.nas index f4f0aed8..891b4ee9 100644 --- a/Nasal/MCDU/WINDCLB.nas +++ b/Nasal/MCDU/WINDCLB.nas @@ -188,7 +188,7 @@ var windCLBPage = { } me.reload(); } else if (index == 6) { - setprop("/MCDU[" ~ me.computer ~ "]/page", "INITA"); + setprop("/MCDU[" ~ me.computer ~ "]/page", fmgc.windController.accessPage[me.computer]); } else if (me.items >= index) { if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) == 13) { var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad); diff --git a/Nasal/MCDU/WINDCRZ.nas b/Nasal/MCDU/WINDCRZ.nas index 2da2717d..1912615c 100644 --- a/Nasal/MCDU/WINDCRZ.nas +++ b/Nasal/MCDU/WINDCRZ.nas @@ -269,7 +269,7 @@ var windCRZPage = { } me.reload(); } else if (index == 6) { - setprop("/MCDU[" ~ me.computer ~ "]/page", "INITA"); + setprop("/MCDU[" ~ me.computer ~ "]/page", fmgc.windController.accessPage[me.computer]); } else if (index == 5) { var sts = size(mcdu_scratchpad.scratchpads[me.computer].scratchpad); if (sts >= 7 and sts <= 9) { diff --git a/Nasal/MCDU/WINDDES.nas b/Nasal/MCDU/WINDDES.nas index fbf43257..e90e1967 100644 --- a/Nasal/MCDU/WINDDES.nas +++ b/Nasal/MCDU/WINDDES.nas @@ -203,7 +203,7 @@ var windDESPage = { } me.reload(); } else if (index == 6) { - setprop("/MCDU[" ~ me.computer ~ "]/page", "INITA"); + setprop("/MCDU[" ~ me.computer ~ "]/page", fmgc.windController.accessPage[me.computer]); } else if (me.items >= index) { if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) == 13) { var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad); From 20849fd25a4ca9d2cb738d6594097afe9e97c420 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Fri, 12 Jun 2020 22:12:28 -0400 Subject: [PATCH 33/53] Add access to winds from VERTREV, winds finished and ready for testing! --- Nasal/FMGC/winds.nas | 2 +- Nasal/MCDU/F-PLN.nas | 16 +++++++------- Nasal/MCDU/MCDU.nas | 2 ++ Nasal/MCDU/VERTREV.nas | 50 +++++++++++++++++++++++++++++++++++++++++- 4 files changed, 60 insertions(+), 10 deletions(-) diff --git a/Nasal/FMGC/winds.nas b/Nasal/FMGC/winds.nas index 0d3284d6..5e660453 100644 --- a/Nasal/FMGC/winds.nas +++ b/Nasal/FMGC/winds.nas @@ -330,7 +330,7 @@ var windController = { if (waypoint.wp_role == "sid") { append(me.winds[plan], waypoint_winds.new(waypoint.id, "departure", 0)); me.windSizes[plan] += 1; - } else if (waypoint.wp_role == "star" or waypoint.wp_role == "arrival" or waypoint.wp_role == "missed") { + } else if (waypoint.wp_role == "star" or waypoint.wp_role == "approach" or waypoint.wp_role == "missed") { append(me.winds[plan], waypoint_winds.new(waypoint.id, "arrival", 0)); me.windSizes[plan] += 1; } else if (waypoint.wp_role == nil and waypoint.wp_type == "navaid") { diff --git a/Nasal/MCDU/F-PLN.nas b/Nasal/MCDU/F-PLN.nas index f205f457..12679a46 100644 --- a/Nasal/MCDU/F-PLN.nas +++ b/Nasal/MCDU/F-PLN.nas @@ -148,23 +148,23 @@ var fplnItem = { if (fmgc.flightPlanController.temporaryFlag[me.computer]) { if (me.index == fmgc.flightPlanController.arrivalIndex[me.computer]) { - canvas_mcdu.myVertRev[me.computer] = vertRev.new(1, left(me.wp.wp_name, 4), me.index, me.computer); + canvas_mcdu.myVertRev[me.computer] = vertRev.new(1, left(me.wp.wp_name, 4), me.index, me.computer, me.wp, me.plan); } if (left(me.wp.wp_name, 4) == fmgc.flightPlanController.flightplans[me.computer].departure.id) { - canvas_mcdu.myVertRev[me.computer] = vertRev.new(0, left(me.wp.wp_name, 4), me.index, me.computer); + canvas_mcdu.myVertRev[me.computer] = vertRev.new(0, left(me.wp.wp_name, 4), me.index, me.computer, me.wp, me.plan); } elsif (me.index == (fmgc.flightPlanController.currentToWptIndex.getValue() - 1)) { - canvas_mcdu.myVertRev[me.computer] = vertRev.new(3, me.wp.wp_name, me.index, me.computer); + canvas_mcdu.myVertRev[me.computer] = vertRev.new(3, me.wp.wp_name, me.index, me.computer, me.wp, me.plan); } else { - canvas_mcdu.myVertRev[me.computer] = vertRev.new(2, me.wp.wp_name, me.index, me.computer); + canvas_mcdu.myVertRev[me.computer] = vertRev.new(2, me.wp.wp_name, me.index, me.computer, me.wp, me.plan); } } else { if (me.index == fmgc.flightPlanController.arrivalIndex[2]) { - canvas_mcdu.myVertRev[me.computer] = vertRev.new(1, left(me.wp.wp_name, 4), me.index, me.computer); + canvas_mcdu.myVertRev[me.computer] = vertRev.new(1, left(me.wp.wp_name, 4), me.index, me.computer, me.wp, me.plan); } elsif (left(me.wp.wp_name, 4) == fmgc.flightPlanController.flightplans[2].departure.id) { - canvas_mcdu.myVertRev[me.computer] = vertRev.new(0, left(me.wp.wp_name, 4), me.index, me.computer); + canvas_mcdu.myVertRev[me.computer] = vertRev.new(0, left(me.wp.wp_name, 4), me.index, me.computer, me.wp, me.plan); } elsif (me.index == (fmgc.flightPlanController.currentToWptIndex.getValue() - 1)) { - canvas_mcdu.myVertRev[me.computer] = vertRev.new(3, me.wp.wp_name, me.index, me.computer); + canvas_mcdu.myVertRev[me.computer] = vertRev.new(3, me.wp.wp_name, me.index, me.computer, me.wp, me.plan); } else { - canvas_mcdu.myVertRev[me.computer] = vertRev.new(2, me.wp.wp_name, me.index, me.computer); + canvas_mcdu.myVertRev[me.computer] = vertRev.new(2, me.wp.wp_name, me.index, me.computer, me.wp, me.plan); } } setprop("MCDU[" ~ me.computer ~ "]/page", "VERTREV"); diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index b6b2f294..365ea49d 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -417,6 +417,8 @@ var lskbutton = func(btn, i) { canvas_mcdu.myDeparture[i].depPushbuttonLeft(5); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "ARRIVAL") { canvas_mcdu.myArrival[i].arrPushbuttonLeft(5); + } else if (getprop("/MCDU[" ~ i ~ "]/page") == "VERTREV") { + canvas_mcdu.myVertRev[i].pushButtonLeft(5); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DIRTO") { canvas_mcdu.myDirTo[i].leftFieldBtn(5); } else if (getprop("/MCDU[" ~ i ~ "]/page") == "DUPLICATENAMES") { diff --git a/Nasal/MCDU/VERTREV.nas b/Nasal/MCDU/VERTREV.nas index bc647651..b61421db 100644 --- a/Nasal/MCDU/VERTREV.nas +++ b/Nasal/MCDU/VERTREV.nas @@ -20,12 +20,14 @@ var vertRev = { arrAirport: nil, index: nil, computer: nil, - new: func(type, id, index, computer) { + new: func(type, id, index, computer, wp, plan) { var vr = {parents:[vertRev]}; vr.type = type; # 0 = origin 1 = destination 2 = wpt not ppos 3 = ppos 4 = cruise wpt 5 = climb wpt (3 + 4 not needed yet) vr.id = id; vr.index = index; vr.computer = computer; + vr.wp = wp; + vr.plan = plan; vr._setupPageWithData(); vr._checkTmpy(); return vr; @@ -132,6 +134,52 @@ var vertRev = { me.arrowsMatrix[1][4] = 0; } }, + pushButtonLeft: func(index) { + if (index == 5) { + print("role: ", me.wp.wp_role, ", type: ", me.wp.wp_type); + if (me.wp.wp_role == "sid") { + if (canvas_mcdu.myCLBWIND[me.computer] == nil) { + canvas_mcdu.myCLBWIND[me.computer] = windCLBPage.new(me.computer); + } else { + canvas_mcdu.myCLBWIND[me.computer].reload(); + } + fmgc.windController.accessPage[me.computer] = "VERTREV"; + setprop("MCDU[" ~ me.computer ~ "]/page", "WINDCLB"); + } else if (me.wp.wp_role == "star" or me.wp.wp_role == "approach" or me.wp.wp_role == "missed") { + if (canvas_mcdu.myDESWIND[me.computer] == nil) { + canvas_mcdu.myDESWIND[me.computer] = windDESPage.new(me.computer); + } else { + canvas_mcdu.myDESWIND[me.computer].reload(); + } + fmgc.windController.accessPage[me.computer] = "VERTREV"; + setprop("MCDU[" ~ me.computer ~ "]/page", "WINDDES"); + } else if (me.wp.wp_role == nil and me.wp.wp_type == "navaid") { + if (canvas_mcdu.myCRZWIND[me.computer] == nil) { + cur_location = 0; + for (i = 0; i < size(fmgc.windController.nav_indicies[me.plan]); i += 1) { + if (fmgc.windController.nav_indicies[me.plan][i] == me.index) { + cur_location = i; + } + } + canvas_mcdu.myCRZWIND[me.computer] = windCRZPage.new(me.computer, me.wp, cur_location); + } else { + canvas_mcdu.myCRZWIND[me.computer].reload(); + } + fmgc.windController.accessPage[me.computer] = "VERTREV"; + setprop("MCDU[" ~ me.computer ~ "]/page", "WINDCRZ"); + } else { + if (canvas_mcdu.myCRZWIND[me.computer] == nil) { + canvas_mcdu.myCRZWIND[me.computer] = windCRZPage.new(me.computer, nil, 0); + } else { + canvas_mcdu.myCRZWIND[me.computer].reload(); + } + fmgc.windController.accessPage[me.computer] = "VERTREV"; + setprop("MCDU[" ~ me.computer ~ "]/page", "WINDCRZ"); + } + } else { + mcdu_message(me.computer, "NOT ALLOWED"); + } + }, }; setlistener("FMGC/internal/cruise-lvl-set", func() { From 6c4c75b311dcba705838df5065db13f2f7871d9f Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Sat, 13 Jun 2020 10:51:03 -0400 Subject: [PATCH 34/53] Add parents to wind objects --- Nasal/FMGC/winds.nas | 106 ++++++++++++++++++++----------------------- 1 file changed, 50 insertions(+), 56 deletions(-) diff --git a/Nasal/FMGC/winds.nas b/Nasal/FMGC/winds.nas index 5e660453..140b9da4 100644 --- a/Nasal/FMGC/winds.nas +++ b/Nasal/FMGC/winds.nas @@ -7,12 +7,11 @@ var wind = { altitude: "", new: func() { - return { - parents: [wind], - heading: 0, - magnitude: 0, - altitude: "" - }; + var w = {parents: [wind]}; + w.heading = 0; + w.magnitude = 0; + w.altitude = ""; + return w; }, newcopy: func(heading, magnitude, altitude) { @@ -20,12 +19,11 @@ var wind = { me.magnitude = magnitude; me.altitude = altitude; - return { - parents: [wind], - heading: me.heading, - magnitude: me.magnitude, - altitude: me.altitude - } + var w = {parents: [wind]}; + w.heading = me.heading; + w.magnitude = me.magnitude; + w.altitude = me.altitude; + return w; } }; @@ -34,22 +32,20 @@ var alt_wind = { magnitude: 0, new: func() { - return { - parents: [wind], - heading: 0, - magnitude: 0 - }; + var aw = {parents: [alt_wind]}; + aw.heading = 0; + aw.magnitude = 0; + return aw; }, newcopy: func(heading, magnitude) { me.heading = heading; me.magnitude = magnitude; - return { - parents: [wind], - heading: me.heading, - magnitude: me.magnitude - } + var aw = {parents: [alt_wind]}; + aw.heading = me.heading ; + aw.magnitude = me.magnitude; + return aw; } }; @@ -58,22 +54,20 @@ var sat_temp = { altitude: "", new: func() { - return { - parents: [wind], - temp: 0, - altitude: "" - }; + var st = {parents: [sat_temp]}; + st.temp = 0; + st.altitude = ""; + return st; }, newcopy: func(temp, altitude) { me.temp = temp; me.altitude = altitude; - return { - parents: [wind], - temp: me.temp, - altitude: me.altitude - } + var st = {parents: [sat_temp]}; + st.temp = me.temp; + st.altitude = me.altitude; + return st; } }; @@ -93,18 +87,18 @@ var waypoint_winds = { me.type = type; me.includeWind = includeWind; - return { - id: me.id, - type: me.type, #departure, waypoint, arrival - includeWind: me.includeWind, - wind1: wind.new(), - wind2: wind.new(), - wind3: wind.new(), - wind4: wind.new(), - wind5: wind.new(), - sat1: sat_temp.new(), - alt1: alt_wind.new() - }; + var ww = {parents: [waypoint_winds]}; + ww.id = me.id; + ww.type = me.type; #departure, waypoint, arrival + ww.includeWind = me.includeWind; + ww.wind1 = wind.new(); + ww.wind2 = wind.new(); + ww.wind3 = wind.new(); + ww.wind4 = wind.new(); + ww.wind5 = wind.new(); + ww.sat1 = sat_temp.new(); + ww.alt1 = alt_wind.new(); + return ww; }, newcopy: func(id, type, includeWind, wind1, wind2, wind3, wind4, wind5, sat1, alt1) { @@ -119,18 +113,18 @@ var waypoint_winds = { me.sat1 = sat1; me.alt1 = alt1; - return { - id: me.id, - type: me.type, #departure, waypoint, arrival - includeWind: me.includeWind, - wind1: me.wind1, - wind2: me.wind2, - wind3: me.wind3, - wind4: me.wind4, - wind5: me.wind5, - sat1: me.sat1, - alt1: me.alt1 - }; + var ww = {parents: [waypoint_winds]}; + ww.id = me.id; + ww.type = me.type; #departure, waypoint, arrival + ww.includeWind = me.includeWind; + ww.wind1 = me.wind1; + ww.wind2 = me.wind2; + ww.wind3 = me.wind3; + ww.wind4 = me.wind4; + ww.wind5 = me.wind5; + ww.sat1 = me.sat1; + ww.alt1 = me.alt1; + return ww; } }; From 5e5966e96f2a9de60b972ac609fb1f70f064e449 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Sat, 13 Jun 2020 10:58:09 -0400 Subject: [PATCH 35/53] Remove unecessary code --- Nasal/FMGC/winds.nas | 85 +++++++++++--------------------------------- 1 file changed, 20 insertions(+), 65 deletions(-) diff --git a/Nasal/FMGC/winds.nas b/Nasal/FMGC/winds.nas index 140b9da4..b4c31a92 100644 --- a/Nasal/FMGC/winds.nas +++ b/Nasal/FMGC/winds.nas @@ -2,10 +2,6 @@ # Copyright (c) 2020 Matthew Maring (mattmaring) var wind = { - heading: 0, - magnitude: 0, - altitude: "", - new: func() { var w = {parents: [wind]}; w.heading = 0; @@ -15,22 +11,15 @@ var wind = { }, newcopy: func(heading, magnitude, altitude) { - me.heading = heading; - me.magnitude = magnitude; - me.altitude = altitude; - var w = {parents: [wind]}; - w.heading = me.heading; - w.magnitude = me.magnitude; - w.altitude = me.altitude; + w.heading = heading; + w.magnitude = magnitude; + w.altitude = altitude; return w; } }; var alt_wind = { - heading: 0, - magnitude: 0, - new: func() { var aw = {parents: [alt_wind]}; aw.heading = 0; @@ -39,20 +28,14 @@ var alt_wind = { }, newcopy: func(heading, magnitude) { - me.heading = heading; - me.magnitude = magnitude; - var aw = {parents: [alt_wind]}; - aw.heading = me.heading ; - aw.magnitude = me.magnitude; + aw.heading = heading ; + aw.magnitude = magnitude; return aw; } }; var sat_temp = { - temp: 0, - altitude: "", - new: func() { var st = {parents: [sat_temp]}; st.temp = 0; @@ -61,36 +44,19 @@ var sat_temp = { }, newcopy: func(temp, altitude) { - me.temp = temp; - me.altitude = altitude; - var st = {parents: [sat_temp]}; - st.temp = me.temp; - st.altitude = me.altitude; + st.temp = temp; + st.altitude = altitude; return st; } }; var waypoint_winds = { - type: "", #departure, waypoint, arrival - includeWind: 1, - wind1: 0, - wind2: 0, - wind3: 0, - wind4: 0, - wind5: 0, - sat1: 0, - alt1: 0, - new: func(id, type, includeWind) { - me.id = id; - me.type = type; - me.includeWind = includeWind; - var ww = {parents: [waypoint_winds]}; - ww.id = me.id; - ww.type = me.type; #departure, waypoint, arrival - ww.includeWind = me.includeWind; + ww.id = id; + ww.type = type; #departure, waypoint, arrival + ww.includeWind = includeWind; ww.wind1 = wind.new(); ww.wind2 = wind.new(); ww.wind3 = wind.new(); @@ -102,28 +68,17 @@ var waypoint_winds = { }, newcopy: func(id, type, includeWind, wind1, wind2, wind3, wind4, wind5, sat1, alt1) { - me.id = id; - me.type = type; - me.includeWind = includeWind; - me.wind1 = wind1; - me.wind2 = wind2; - me.wind3 = wind3; - me.wind4 = wind4; - me.wind5 = wind5; - me.sat1 = sat1; - me.alt1 = alt1; - var ww = {parents: [waypoint_winds]}; - ww.id = me.id; - ww.type = me.type; #departure, waypoint, arrival - ww.includeWind = me.includeWind; - ww.wind1 = me.wind1; - ww.wind2 = me.wind2; - ww.wind3 = me.wind3; - ww.wind4 = me.wind4; - ww.wind5 = me.wind5; - ww.sat1 = me.sat1; - ww.alt1 = me.alt1; + ww.id = id; + ww.type = type; #departure, waypoint, arrival + ww.includeWind = includeWind; + ww.wind1 = wind1; + ww.wind2 = wind2; + ww.wind3 = wind3; + ww.wind4 = wind4; + ww.wind5 = wind5; + ww.sat1 = sat1; + ww.alt1 = alt1; return ww; } }; From 1abf474b58206da6de2e4380793e9ead03693d24 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sun, 14 Jun 2020 12:02:45 +0100 Subject: [PATCH 36/53] Hide debug, DRAFT title and ttle colour, also new font for symbols --- Models/Instruments/MCDU/MCDU.nas | 12 +++++--- Nasal/FMGC/flightplan.nas | 6 ++-- Nasal/MCDU/VERTREV.nas | 2 +- Nasal/MCDU/WINDCLB.nas | 28 +++++++++-------- Nasal/MCDU/WINDCRZ.nas | 52 +++++++++++++++++++------------- Nasal/MCDU/WINDDES.nas | 31 ++++++++++--------- 6 files changed, 74 insertions(+), 57 deletions(-) diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index 089d51a3..c09a593d 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -24,7 +24,8 @@ var myCRZWIND = [nil, nil]; var myDESWIND = [nil, nil]; var myHISTWIND = [nil, nil]; var default = "BoeingCDU-Large.ttf"; -var symbol = "helvetica_medium.txf"; +#var symbol = "helvetica_medium.txf"; +var symbol = "LiberationMonoCustom.ttf"; var normal = 70; var small = 56; var page = ""; @@ -3179,10 +3180,10 @@ var canvas_MCDU_base = { me["PROG"].hide(); me["PERFTO"].hide(); # if (page == "WINDCRZ") { -# up/down arrows show -# } else { -# up/down arrows hide -# } + # up/down arrows show + # } else { + # up/down arrows hide + # } me["Simple_PageNum"].setText("X/X"); me["Simple_PageNum"].hide(); me["Simple_Title"].show(); @@ -3231,6 +3232,7 @@ var canvas_MCDU_base = { } else { me["Simple_Title"].setText(sprintf("%s", myWind[i].title)); } + me["Simple_Title"].setColor(getprop("/MCDUC/colors/" ~ myWind[i].titleColour ~ "/r"), getprop("/MCDUC/colors/" ~ myWind[i].titleColour ~ "/g"), getprop("/MCDUC/colors/" ~ myWind[i].titleColour ~ "/b")); forindex (var matrixArrow; myWind[i].arrowsMatrix) { if (matrixArrow == 0) { diff --git a/Nasal/FMGC/flightplan.nas b/Nasal/FMGC/flightplan.nas index 6aaa2665..60741f1d 100644 --- a/Nasal/FMGC/flightplan.nas +++ b/Nasal/FMGC/flightplan.nas @@ -171,7 +171,7 @@ var flightPlanController = { } me.addDiscontinuity(1, plan); - debug.dump(me.flightplans[2]); + #debug.dump(me.flightplans[2]); # reset mcdu if it exists if (canvas_mcdu.myFpln[0] != nil) { canvas_mcdu.myFpln[0].scroll = 0; } if (canvas_mcdu.myFpln[1] != nil) { canvas_mcdu.myFpln[1].scroll = 0; } @@ -657,7 +657,7 @@ var flightPlanController = { getNavCount: func(plan) { var count = 0; for (var wpt = 0; wpt < me.flightplans[plan].getPlanSize(); wpt += 1) { - print(me.flightplans[plan].getWP(wpt).wp_type); + #print(me.flightplans[plan].getWP(wpt).wp_type); if (me.flightplans[plan].getWP(wpt).wp_type == "navaid") { count += 1; } @@ -668,7 +668,7 @@ var flightPlanController = { getDepartureCount: func(plan) { var count = 0; for (var wpt = 0; wpt < me.flightplans[plan].getPlanSize(); wpt += 1) { - print(me.flightplans[plan].getWP(wpt).wp_role); + #print(me.flightplans[plan].getWP(wpt).wp_role); if (me.flightplans[plan].getWP(wpt).wp_role == "sid") { count += 1; } diff --git a/Nasal/MCDU/VERTREV.nas b/Nasal/MCDU/VERTREV.nas index b61421db..bc0d6573 100644 --- a/Nasal/MCDU/VERTREV.nas +++ b/Nasal/MCDU/VERTREV.nas @@ -136,7 +136,7 @@ var vertRev = { }, pushButtonLeft: func(index) { if (index == 5) { - print("role: ", me.wp.wp_role, ", type: ", me.wp.wp_type); + #print("role: ", me.wp.wp_role, ", type: ", me.wp.wp_type); if (me.wp.wp_role == "sid") { if (canvas_mcdu.myCLBWIND[me.computer] == nil) { canvas_mcdu.myCLBWIND[me.computer] = windCLBPage.new(me.computer); diff --git a/Nasal/MCDU/WINDCLB.nas b/Nasal/MCDU/WINDCLB.nas index 891b4ee9..f9b0dab7 100644 --- a/Nasal/MCDU/WINDCLB.nas +++ b/Nasal/MCDU/WINDCLB.nas @@ -4,6 +4,7 @@ var windCLBPage = { title: nil, + titleColour: "wht", fontMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]], arrowsMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]], arrowsColour: [["ack", "ack", "ack", "ack", "ack", "ack"],["ack", "ack", "ack", "ack", "ack", "ack"]], @@ -42,7 +43,6 @@ var windCLBPage = { }, _setupPageWithData: func() { me.title = "CLIMB WIND"; - #me.title = "DRAFT CLIMB WIND"; me.titleColour = "wht"; me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [1, 0, 0, 0, 1, 0]]; me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "ack"], ["wht", "ack", "ack", "ack", "wht", "ack"]]; @@ -73,8 +73,8 @@ var windCLBPage = { var wind = 0; wind = fmgc.windController.clb_winds[computer_temp].wind5; if (wind.altitude != "") { - me.L5 = [wind.heading ~ "/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; - me.fontMatrix[0][4] = 0; + me.L5 = [wind.heading ~ "°/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; + me.fontMatrix[0][4] = 1; } else { me.L5 = ["[ ]/[ ]/[ ]", nil, "blu"]; me.fontMatrix[0][4] = 1; @@ -86,8 +86,8 @@ var windCLBPage = { if (me.items >= 4) { wind = fmgc.windController.clb_winds[computer_temp].wind4; if (wind.altitude != "") { - me.L4 = [wind.heading ~ "/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; - me.fontMatrix[0][3] = 0; + me.L4 = [wind.heading ~ "°/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; + me.fontMatrix[0][3] = 1; } else { me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"]; me.fontMatrix[0][3] = 1; @@ -99,8 +99,8 @@ var windCLBPage = { if (me.items >= 3) { wind = fmgc.windController.clb_winds[computer_temp].wind3; if (wind.altitude != "") { - me.L3 = [wind.heading ~ "/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; - me.fontMatrix[0][2] = 0; + me.L3 = [wind.heading ~ "°/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; + me.fontMatrix[0][2] = 1; } else { me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"]; me.fontMatrix[0][2] = 1; @@ -112,8 +112,8 @@ var windCLBPage = { if (me.items >= 2) { wind = fmgc.windController.clb_winds[computer_temp].wind2; if (wind.altitude != "") { - me.L2 = [wind.heading ~ "/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; - me.fontMatrix[0][1] = 0; + me.L2 = [wind.heading ~ "°/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; + me.fontMatrix[0][1] = 1; } else { me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"]; me.fontMatrix[0][1] = 1; @@ -125,8 +125,8 @@ var windCLBPage = { if (me.items >= 1) { wind = fmgc.windController.clb_winds[computer_temp].wind1; if (wind.altitude != "") { - me.L1 = [wind.heading ~ "/" ~ wind.magnitude ~ "/" ~ wind.altitude, "TRU WIND/ALT", "blu"]; - me.fontMatrix[0][0] = 0; + me.L1 = [wind.heading ~ "°/" ~ wind.magnitude ~ "/" ~ wind.altitude, "TRU WIND/ALT", "blu"]; + me.fontMatrix[0][0] = 1; } else { me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"]; me.fontMatrix[0][0] = 1; @@ -155,7 +155,8 @@ var windCLBPage = { me.L6 = [" CANCEL", " WIND", "amb"]; me.R6 = ["UPDATE ", "WIND ", "amb"]; me.arrowsMatrix[0][5] = 0; - #draft title + me.title = "DRAFT CLIMB WIND"; + me.titleColour = "yel"; canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); } else { me.L1[2] = "blu"; @@ -166,7 +167,8 @@ var windCLBPage = { me.L6 = [" RETURN", nil, "wht"]; me.R6 = [nil, nil, "ack"]; me.arrowsMatrix[0][5] = 1; - #draft title + me.title = "CLIMB WIND"; + me.titleColour = "wht"; canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); } }, diff --git a/Nasal/MCDU/WINDCRZ.nas b/Nasal/MCDU/WINDCRZ.nas index 1912615c..a37761ed 100644 --- a/Nasal/MCDU/WINDCRZ.nas +++ b/Nasal/MCDU/WINDCRZ.nas @@ -4,6 +4,7 @@ var windCRZPage = { title: [nil, nil, nil], + titleColour: "wht", fontMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]], arrowsMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]], arrowsColour: [["ack", "ack", "ack", "ack", "ack", "ack"],["ack", "ack", "ack", "ack", "ack", "ack"]], @@ -49,7 +50,6 @@ var windCRZPage = { return nil; }, _setupPageWithData: func() { - print("setup called"); if (me.singleCRZ == 1) { me.title = ["","CRZ WIND",""]; @@ -98,8 +98,8 @@ var windCRZPage = { if (me.items >= 4) { wind = fmgc.windController.crz_winds[computer_temp].wind4; if (wind.altitude != "") { - me.L4 = [wind.heading ~ "/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; - me.fontMatrix[0][3] = 0; + me.L4 = [wind.heading ~ "°/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; + me.fontMatrix[0][3] = 1; } else { me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"]; me.fontMatrix[0][3] = 1; @@ -111,8 +111,8 @@ var windCRZPage = { if (me.items >= 3) { wind = fmgc.windController.crz_winds[computer_temp].wind3; if (wind.altitude != "") { - me.L3 = [wind.heading ~ "/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; - me.fontMatrix[0][2] = 0; + me.L3 = [wind.heading ~ "°/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; + me.fontMatrix[0][2] = 1; } else { me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"]; me.fontMatrix[0][2] = 1; @@ -124,8 +124,8 @@ var windCRZPage = { if (me.items >= 2) { wind = fmgc.windController.crz_winds[computer_temp].wind2; if (wind.altitude != "") { - me.L2 = [wind.heading ~ "/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; - me.fontMatrix[0][1] = 0; + me.L2 = [wind.heading ~ "°/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; + me.fontMatrix[0][1] = 1; } else { me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"]; me.fontMatrix[0][1] = 1; @@ -137,8 +137,8 @@ var windCRZPage = { if (me.items >= 1) { wind = fmgc.windController.crz_winds[computer_temp].wind1; if (wind.altitude != "") { - me.L1 = [wind.heading ~ "/" ~ wind.magnitude ~ "/" ~ wind.altitude, "TRU WIND/ALT", "blu"]; - me.fontMatrix[0][0] = 0; + me.L1 = [wind.heading ~ "°/" ~ wind.magnitude ~ "/" ~ wind.altitude, "TRU WIND/ALT", "blu"]; + me.fontMatrix[0][0] = 1; } else { me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"]; me.fontMatrix[0][0] = 1; @@ -148,7 +148,7 @@ var windCRZPage = { wind = fmgc.windController.crz_winds[computer_temp].sat1; if (wind.altitude != "") { me.L5 = [wind.temp ~ "/" ~ wind.altitude, "SAT / ALT", "blu"]; - me.fontMatrix[0][4] = 0; + me.fontMatrix[0][4] = 1; } else { me.L5 = ["[ ]/[ ]", "SAT / ALT", "blu"]; me.fontMatrix[0][4] = 1; @@ -157,8 +157,8 @@ var windCRZPage = { if (me.items >= 4) { wind = fmgc.windController.winds[computer_temp][me.match_location].wind4; if (wind.altitude != "") { - me.L4 = [wind.heading ~ "/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; - me.fontMatrix[0][3] = 0; + me.L4 = [wind.heading ~ "°/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; + me.fontMatrix[0][3] = 1; } else { me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"]; me.fontMatrix[0][3] = 1; @@ -170,8 +170,8 @@ var windCRZPage = { if (me.items >= 3) { wind = fmgc.windController.winds[computer_temp][me.match_location].wind3; if (wind.altitude != "") { - me.L3 = [wind.heading ~ "/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; - me.fontMatrix[0][2] = 0; + me.L3 = [wind.heading ~ "°/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; + me.fontMatrix[0][2] = 1; } else { me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"]; me.fontMatrix[0][2] = 1; @@ -183,8 +183,8 @@ var windCRZPage = { if (me.items >= 2) { wind = fmgc.windController.winds[computer_temp][me.match_location].wind2; if (wind.altitude != "") { - me.L2 = [wind.heading ~ "/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; - me.fontMatrix[0][1] = 0; + me.L2 = [wind.heading ~ "°/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; + me.fontMatrix[0][1] = 1; } else { me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"]; me.fontMatrix[0][1] = 1; @@ -196,8 +196,8 @@ var windCRZPage = { if (me.items >= 1) { wind = fmgc.windController.winds[computer_temp][me.match_location].wind1; if (wind.altitude != "") { - me.L1 = [wind.heading ~ "/" ~ wind.magnitude ~ "/" ~ wind.altitude, "TRU WIND/ALT", "blu"]; - me.fontMatrix[0][0] = 0; + me.L1 = [wind.heading ~ "°/" ~ wind.magnitude ~ "/" ~ wind.altitude, "TRU WIND/ALT", "blu"]; + me.fontMatrix[0][0] = 1; } else { me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"]; me.fontMatrix[0][0] = 1; @@ -207,7 +207,7 @@ var windCRZPage = { wind = fmgc.windController.winds[computer_temp][me.match_location].sat1; if (wind.altitude != "") { me.L5 = [wind.temp ~ "/" ~ wind.altitude, "SAT / ALT", "blu"]; - me.fontMatrix[0][4] = 0; + me.fontMatrix[0][4] = 1; } else { me.L5 = ["[ ]/[ ]", "SAT / ALT", "blu"]; me.fontMatrix[0][4] = 1; @@ -236,7 +236,12 @@ var windCRZPage = { me.L6 = [" CANCEL", "UPDATE", "amb"]; me.R6 = ["INSERT ", "UPDATE ", "amb"]; me.arrowsMatrix[0][5] = 0; - #draft title + if (me.singleCRZ == 1) { + me.title = ["","DRAFT CRZ WIND",""]; + } else { + me.title = ["DRAFT CRZ WIND", " AT ", me.waypoint.wp_name]; + } + me.titleColour = "yel"; canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); } else { me.L1[2] = "blu"; @@ -247,7 +252,12 @@ var windCRZPage = { me.L6 = [" RETURN", nil, "wht"]; me.R6 = [nil, nil, "ack"]; me.arrowsMatrix[0][5] = 1; - #draft title + if (me.singleCRZ == 1) { + me.title = ["","CRZ WIND",""]; + } else { + me.title = ["CRZ WIND", " AT ", me.waypoint.wp_name]; + } + me.titleColour = "wht"; canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); } }, diff --git a/Nasal/MCDU/WINDDES.nas b/Nasal/MCDU/WINDDES.nas index e90e1967..4829c4d5 100644 --- a/Nasal/MCDU/WINDDES.nas +++ b/Nasal/MCDU/WINDDES.nas @@ -4,6 +4,7 @@ var windDESPage = { title: nil, + titleColour: "wht", fontMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]], arrowsMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]], arrowsColour: [["ack", "ack", "ack", "ack", "ack", "ack"],["ack", "ack", "ack", "ack", "ack", "ack"]], @@ -73,8 +74,8 @@ var windDESPage = { var wind = 0; wind = fmgc.windController.des_winds[computer_temp].wind5; if (wind.altitude != "") { - me.L5 = [wind.heading ~ "/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; - me.fontMatrix[0][4] = 0; + me.L5 = [wind.heading ~ "°/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; + me.fontMatrix[0][4] = 1; } else { me.L5 = ["[ ]/[ ]/[ ]", nil, "blu"]; me.fontMatrix[0][4] = 1; @@ -86,8 +87,8 @@ var windDESPage = { if (me.items >= 4) { wind = fmgc.windController.des_winds[computer_temp].wind4; if (wind.altitude != "") { - me.L4 = [wind.heading ~ "/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; - me.fontMatrix[0][3] = 0; + me.L4 = [wind.heading ~ "°/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; + me.fontMatrix[0][3] = 1; } else { me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"]; me.fontMatrix[0][3] = 1; @@ -99,8 +100,8 @@ var windDESPage = { if (me.items >= 3) { wind = fmgc.windController.des_winds[computer_temp].wind3; if (wind.altitude != "") { - me.L3 = [wind.heading ~ "/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; - me.fontMatrix[0][2] = 0; + me.L3 = [wind.heading ~ "°/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; + me.fontMatrix[0][2] = 1; } else { me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"]; me.fontMatrix[0][2] = 1; @@ -112,8 +113,8 @@ var windDESPage = { if (me.items >= 2) { wind = fmgc.windController.des_winds[computer_temp].wind2; if (wind.altitude != "") { - me.L2 = [wind.heading ~ "/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; - me.fontMatrix[0][1] = 0; + me.L2 = [wind.heading ~ "°/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; + me.fontMatrix[0][1] = 1; } else { me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"]; me.fontMatrix[0][1] = 1; @@ -125,8 +126,8 @@ var windDESPage = { if (me.items >= 1) { wind = fmgc.windController.des_winds[computer_temp].wind1; if (wind.altitude != "") { - me.L1 = [wind.heading ~ "/" ~ wind.magnitude ~ "/" ~ wind.altitude, "TRU WIND/ALT", "blu"]; - me.fontMatrix[0][0] = 0; + me.L1 = [wind.heading ~ "°/" ~ wind.magnitude ~ "/" ~ wind.altitude, "TRU WIND/ALT", "blu"]; + me.fontMatrix[0][0] = 1; } else { me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"]; me.fontMatrix[0][0] = 1; @@ -138,8 +139,8 @@ var windDESPage = { if (getprop("/FMGC/internal/alt-set")) { wind = fmgc.windController.des_winds[computer_temp].alt1; if (wind.heading != 0 and wind.magnitude != 0) { - me.R1 = [wind.heading ~ "/" ~ wind.magnitude, "ALTN WIND ", "blu"]; - me.fontMatrix[1][0] = 0; + me.R1 = [wind.heading ~ "°/" ~ wind.magnitude, "ALTN WIND ", "blu"]; + me.fontMatrix[1][0] = 1; } else { me.R1 = ["[ ]/[ ]", "ALTN WIND ", "blu"]; me.fontMatrix[1][0] = 1; @@ -169,7 +170,8 @@ var windDESPage = { me.L6 = [" CANCEL", " WIND", "amb"]; me.R6 = ["UPDATE ", "WIND ", "amb"]; me.arrowsMatrix[0][5] = 0; - #draft title + me.title = "DRAFT DES WIND"; + me.titleColour = "yel"; canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); } else { me.L1[2] = "blu"; @@ -181,7 +183,8 @@ var windDESPage = { me.L6 = [" RETURN", nil, "wht"]; me.R6 = [nil, nil, "ack"]; me.arrowsMatrix[0][5] = 1; - #draft title + me.title = "DES WIND"; + me.titleColour = "wht"; canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); } }, From 3ff34c66dafefe26c561065125f5d68d0d4023f1 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sun, 14 Jun 2020 12:56:10 +0100 Subject: [PATCH 37/53] Formatting: remove need for leading zeroes, sprintf() on wind_heading / magnitude --- Nasal/MCDU/WINDCLB.nas | 18 +++++++++--------- Nasal/MCDU/WINDCRZ.nas | 29 ++++++++++++++--------------- Nasal/MCDU/WINDDES.nas | 26 +++++++++++++------------- 3 files changed, 36 insertions(+), 37 deletions(-) diff --git a/Nasal/MCDU/WINDCLB.nas b/Nasal/MCDU/WINDCLB.nas index f9b0dab7..78ed19e2 100644 --- a/Nasal/MCDU/WINDCLB.nas +++ b/Nasal/MCDU/WINDCLB.nas @@ -73,7 +73,7 @@ var windCLBPage = { var wind = 0; wind = fmgc.windController.clb_winds[computer_temp].wind5; if (wind.altitude != "") { - me.L5 = [wind.heading ~ "°/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; + me.L5 = [sprintf("%03.0f", wind.heading) ~ "°/" ~ sprintf("%03.0f", wind.magnitude) ~ "/" ~ wind.altitude, nil, "blu"]; me.fontMatrix[0][4] = 1; } else { me.L5 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -86,7 +86,7 @@ var windCLBPage = { if (me.items >= 4) { wind = fmgc.windController.clb_winds[computer_temp].wind4; if (wind.altitude != "") { - me.L4 = [wind.heading ~ "°/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; + me.L4 = [sprintf("%03.0f", wind.heading) ~ "°/" ~ sprintf("%03.0f", wind.magnitude) ~ "/" ~ wind.altitude, nil, "blu"]; me.fontMatrix[0][3] = 1; } else { me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -99,7 +99,7 @@ var windCLBPage = { if (me.items >= 3) { wind = fmgc.windController.clb_winds[computer_temp].wind3; if (wind.altitude != "") { - me.L3 = [wind.heading ~ "°/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; + me.L3 = [sprintf("%03.0f", wind.heading) ~ "°/" ~ sprintf("%03.0f", wind.magnitude) ~ "/" ~ wind.altitude, nil, "blu"]; me.fontMatrix[0][2] = 1; } else { me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -112,7 +112,7 @@ var windCLBPage = { if (me.items >= 2) { wind = fmgc.windController.clb_winds[computer_temp].wind2; if (wind.altitude != "") { - me.L2 = [wind.heading ~ "°/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; + me.L2 = [sprintf("%03.0f", wind.heading) ~ "°/" ~ sprintf("%03.0f", wind.magnitude) ~ "/" ~ wind.altitude, nil, "blu"]; me.fontMatrix[0][1] = 1; } else { me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -125,7 +125,7 @@ var windCLBPage = { if (me.items >= 1) { wind = fmgc.windController.clb_winds[computer_temp].wind1; if (wind.altitude != "") { - me.L1 = [wind.heading ~ "°/" ~ wind.magnitude ~ "/" ~ wind.altitude, "TRU WIND/ALT", "blu"]; + me.L1 = [sprintf("%03.0f", wind.heading) ~ "°/" ~ sprintf("%03.0f", wind.magnitude) ~ "/" ~ wind.altitude, "TRU WIND/ALT", "blu"]; me.fontMatrix[0][0] = 1; } else { me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"]; @@ -192,11 +192,11 @@ var windCLBPage = { } else if (index == 6) { setprop("/MCDU[" ~ me.computer ~ "]/page", fmgc.windController.accessPage[me.computer]); } else if (me.items >= index) { - if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) == 13) { + if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) >= 5 and size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) <= 13) { var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad); - if (size(winds[0]) == 3 and num(winds[0]) != nil and winds[0] >= 0 and winds[0] <= 360 and - size(winds[1]) == 3 and num(winds[1]) != nil and winds[1] >= 0 and winds[1] <= 200 and - size(winds[2]) == 5 and ((num(winds[2]) != nil and winds[2] >= 1000 and winds[2] <= 39000) or + if (size(winds[0]) >= 1 and size(winds[0]) <= 3 and num(winds[0]) != nil and winds[0] >= 0 and winds[0] <= 360 and + size(winds[1]) >= 1 and size(winds[1]) <= 3 and num(winds[1]) != nil and winds[1] >= 0 and winds[1] <= 200 and + size(winds[2]) >= 4 and size(winds[2]) <= 5 and ((num(winds[2]) != nil and winds[2] >= 1000 and winds[2] <= 39000) or (num(split("FL", winds[2])[1]) != nil and split("FL", winds[2])[1] >= 10 and split("FL", winds[2])[1] <= 390))) { me.makeTmpy(); var computer_temp = 2; diff --git a/Nasal/MCDU/WINDCRZ.nas b/Nasal/MCDU/WINDCRZ.nas index a37761ed..541f4d8c 100644 --- a/Nasal/MCDU/WINDCRZ.nas +++ b/Nasal/MCDU/WINDCRZ.nas @@ -98,7 +98,7 @@ var windCRZPage = { if (me.items >= 4) { wind = fmgc.windController.crz_winds[computer_temp].wind4; if (wind.altitude != "") { - me.L4 = [wind.heading ~ "°/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; + me.L4 = [sprintf("%03.0f", wind.heading) ~ "°/" ~ sprintf("%03.0f", wind.magnitude) ~ "/" ~ wind.altitude, nil, "blu"]; me.fontMatrix[0][3] = 1; } else { me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -111,7 +111,7 @@ var windCRZPage = { if (me.items >= 3) { wind = fmgc.windController.crz_winds[computer_temp].wind3; if (wind.altitude != "") { - me.L3 = [wind.heading ~ "°/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; + me.L3 = [sprintf("%03.0f", wind.heading) ~ "°/" ~ sprintf("%03.0f", wind.magnitude) ~ "/" ~ wind.altitude, nil, "blu"]; me.fontMatrix[0][2] = 1; } else { me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -124,7 +124,7 @@ var windCRZPage = { if (me.items >= 2) { wind = fmgc.windController.crz_winds[computer_temp].wind2; if (wind.altitude != "") { - me.L2 = [wind.heading ~ "°/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; + me.L2 = [sprintf("%03.0f", wind.heading) ~ "°/" ~ sprintf("%03.0f", wind.magnitude) ~ "/" ~ wind.altitude, nil, "blu"]; me.fontMatrix[0][1] = 1; } else { me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -137,7 +137,7 @@ var windCRZPage = { if (me.items >= 1) { wind = fmgc.windController.crz_winds[computer_temp].wind1; if (wind.altitude != "") { - me.L1 = [wind.heading ~ "°/" ~ wind.magnitude ~ "/" ~ wind.altitude, "TRU WIND/ALT", "blu"]; + me.L1 = [sprintf("%03.0f", wind.heading) ~ "°/" ~ sprintf("%03.0f", wind.magnitude) ~ "/" ~ wind.altitude, "TRU WIND/ALT", "blu"]; me.fontMatrix[0][0] = 1; } else { me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"]; @@ -157,7 +157,7 @@ var windCRZPage = { if (me.items >= 4) { wind = fmgc.windController.winds[computer_temp][me.match_location].wind4; if (wind.altitude != "") { - me.L4 = [wind.heading ~ "°/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; + me.L4 = [sprintf("%03.0f", wind.heading) ~ "°/" ~sprintf("%03.0f", wind.magnitude) ~ "/" ~ wind.altitude, nil, "blu"]; me.fontMatrix[0][3] = 1; } else { me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -170,7 +170,7 @@ var windCRZPage = { if (me.items >= 3) { wind = fmgc.windController.winds[computer_temp][me.match_location].wind3; if (wind.altitude != "") { - me.L3 = [wind.heading ~ "°/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; + me.L3 = [sprintf("%03.0f", wind.heading) ~ "°/" ~ sprintf("%03.0f", wind.magnitude) ~ "/" ~ wind.altitude, nil, "blu"]; me.fontMatrix[0][2] = 1; } else { me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -183,7 +183,7 @@ var windCRZPage = { if (me.items >= 2) { wind = fmgc.windController.winds[computer_temp][me.match_location].wind2; if (wind.altitude != "") { - me.L2 = [wind.heading ~ "°/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; + me.L2 = [sprintf("%03.0f", wind.heading) ~ "°/" ~ sprintf("%03.0f", wind.magnitude) ~ "/" ~ wind.altitude, nil, "blu"]; me.fontMatrix[0][1] = 1; } else { me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -196,7 +196,7 @@ var windCRZPage = { if (me.items >= 1) { wind = fmgc.windController.winds[computer_temp][me.match_location].wind1; if (wind.altitude != "") { - me.L1 = [wind.heading ~ "°/" ~ wind.magnitude ~ "/" ~ wind.altitude, "TRU WIND/ALT", "blu"]; + me.L1 = [sprintf("%03.0f", wind.heading) ~ "°/" ~ sprintf("%03.0f", wind.magnitude) ~ "/" ~ wind.altitude, "TRU WIND/ALT", "blu"]; me.fontMatrix[0][0] = 1; } else { me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"]; @@ -281,11 +281,10 @@ var windCRZPage = { } else if (index == 6) { setprop("/MCDU[" ~ me.computer ~ "]/page", fmgc.windController.accessPage[me.computer]); } else if (index == 5) { - var sts = size(mcdu_scratchpad.scratchpads[me.computer].scratchpad); - if (sts >= 7 and sts <= 9) { + if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) >= 6 and size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) <= 9) { var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad); if (size(winds[0]) >= 1 and size(winds[0]) <= 3 and num(winds[0]) != nil and winds[0] >= -99 and winds[0] <= 99 and - size(winds[1]) == 5 and ((num(winds[1]) != nil and winds[1] >= 1000 and winds[1] <= 39000) or + size(winds[1]) >= 4 and size(winds[1]) <= 5 and ((num(winds[1]) != nil and winds[1] >= 1000 and winds[1] <= 39000) or (num(split("FL", winds[1])[1]) != nil and split("FL", winds[1])[1] >= 10 and split("FL", winds[1])[1] <= 390))) { me.makeTmpy(); var computer_temp = 2; @@ -326,11 +325,11 @@ var windCRZPage = { mcdu_message(me.computer, "NOT ALLOWED"); } } else if (me.items >= index) { - if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) == 13) { + if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) >= 5 and size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) <= 13) { var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad); - if (size(winds[0]) == 3 and num(winds[0]) != nil and winds[0] >= 0 and winds[0] <= 360 and - size(winds[1]) == 3 and num(winds[1]) != nil and winds[1] >= 0 and winds[1] <= 200 and - size(winds[2]) == 5 and ((num(winds[2]) != nil and winds[2] >= 1000 and winds[2] <= 39000) or + if (size(winds[0]) >= 1 and size(winds[0]) <= 3 and num(winds[0]) != nil and winds[0] >= 0 and winds[0] <= 360 and + size(winds[1]) >= 1 and size(winds[1]) <= 3 and num(winds[1]) != nil and winds[1] >= 0 and winds[1] <= 200 and + size(winds[2]) >= 4 and size(winds[2]) <= 5 and ((num(winds[2]) != nil and winds[2] >= 1000 and winds[2] <= 39000) or (num(split("FL", winds[2])[1]) != nil and split("FL", winds[2])[1] >= 10 and split("FL", winds[2])[1] <= 390))) { me.makeTmpy(); var computer_temp = 2; diff --git a/Nasal/MCDU/WINDDES.nas b/Nasal/MCDU/WINDDES.nas index 4829c4d5..b6c18613 100644 --- a/Nasal/MCDU/WINDDES.nas +++ b/Nasal/MCDU/WINDDES.nas @@ -74,7 +74,7 @@ var windDESPage = { var wind = 0; wind = fmgc.windController.des_winds[computer_temp].wind5; if (wind.altitude != "") { - me.L5 = [wind.heading ~ "°/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; + me.L5 = [sprintf("%03.0f", wind.heading) ~ "°/" ~ sprintf("%03.0f", wind.magnitude) ~ "/" ~ wind.altitude, nil, "blu"]; me.fontMatrix[0][4] = 1; } else { me.L5 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -87,7 +87,7 @@ var windDESPage = { if (me.items >= 4) { wind = fmgc.windController.des_winds[computer_temp].wind4; if (wind.altitude != "") { - me.L4 = [wind.heading ~ "°/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; + me.L4 = [sprintf("%03.0f", wind.heading) ~ "°/" ~ sprintf("%03.0f", wind.magnitude) ~ "/" ~ wind.altitude, nil, "blu"]; me.fontMatrix[0][3] = 1; } else { me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -100,7 +100,7 @@ var windDESPage = { if (me.items >= 3) { wind = fmgc.windController.des_winds[computer_temp].wind3; if (wind.altitude != "") { - me.L3 = [wind.heading ~ "°/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; + me.L3 = [sprintf("%03.0f", wind.heading) ~ "°/" ~ sprintf("%03.0f", wind.magnitude) ~ "/" ~ wind.altitude, nil, "blu"]; me.fontMatrix[0][2] = 1; } else { me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -113,7 +113,7 @@ var windDESPage = { if (me.items >= 2) { wind = fmgc.windController.des_winds[computer_temp].wind2; if (wind.altitude != "") { - me.L2 = [wind.heading ~ "°/" ~ wind.magnitude ~ "/" ~ wind.altitude, nil, "blu"]; + me.L2 = [sprintf("%03.0f", wind.heading) ~ "°/" ~ sprintf("%03.0f", wind.magnitude) ~ "/" ~ wind.altitude, nil, "blu"]; me.fontMatrix[0][1] = 1; } else { me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -126,7 +126,7 @@ var windDESPage = { if (me.items >= 1) { wind = fmgc.windController.des_winds[computer_temp].wind1; if (wind.altitude != "") { - me.L1 = [wind.heading ~ "°/" ~ wind.magnitude ~ "/" ~ wind.altitude, "TRU WIND/ALT", "blu"]; + me.L1 = [sprintf("%03.0f", wind.heading) ~ "°/" ~ sprintf("%03.0f", wind.magnitude) ~ "/" ~ wind.altitude, "TRU WIND/ALT", "blu"]; me.fontMatrix[0][0] = 1; } else { me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"]; @@ -139,7 +139,7 @@ var windDESPage = { if (getprop("/FMGC/internal/alt-set")) { wind = fmgc.windController.des_winds[computer_temp].alt1; if (wind.heading != 0 and wind.magnitude != 0) { - me.R1 = [wind.heading ~ "°/" ~ wind.magnitude, "ALTN WIND ", "blu"]; + me.R1 = [sprintf("%03.0f", wind.heading) ~ "°/" ~ sprintf("%03.0f", wind.magnitude), "ALTN WIND ", "blu"]; me.fontMatrix[1][0] = 1; } else { me.R1 = ["[ ]/[ ]", "ALTN WIND ", "blu"]; @@ -208,11 +208,11 @@ var windDESPage = { } else if (index == 6) { setprop("/MCDU[" ~ me.computer ~ "]/page", fmgc.windController.accessPage[me.computer]); } else if (me.items >= index) { - if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) == 13) { + if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) >= 5 and size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) <= 13) { var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad); - if (size(winds[0]) == 3 and num(winds[0]) != nil and winds[0] >= 0 and winds[0] <= 360 and - size(winds[1]) == 3 and num(winds[1]) != nil and winds[1] >= 0 and winds[1] <= 200 and - size(winds[2]) == 5 and ((num(winds[2]) != nil and winds[2] >= 1000 and winds[2] <= 39000) or + if (size(winds[0]) >= 0 and size(winds[0]) <= 3 and num(winds[0]) != nil and winds[0] >= 0 and winds[0] <= 360 and + size(winds[1]) >= 0 and size(winds[1]) <= 3 and num(winds[1]) != nil and winds[1] >= 0 and winds[1] <= 200 and + size(winds[2]) >= 4 and size(winds[2]) <= 5 and ((num(winds[2]) != nil and winds[2] >= 1000 and winds[2] <= 39000) or (num(split("FL", winds[2])[1]) != nil and split("FL", winds[2])[1] >= 10 and split("FL", winds[2])[1] <= 390))) { me.makeTmpy(); var computer_temp = 2; @@ -312,10 +312,10 @@ var windDESPage = { }, pushButtonRight: func(index) { if (index == 1 and getprop("/FMGC/internal/alt-set")) { - if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) == 7) { + if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) >= 3 and size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) <= 7) { var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad); - if (size(winds[0]) == 3 and num(winds[0]) != nil and winds[0] >= 0 and winds[0] <= 360 and - size(winds[1]) == 3 and num(winds[1]) != nil and winds[1] >= 0 and winds[1] <= 200) { + if (size(winds[0]) >= 1 and size(winds[0]) <= 3 and num(winds[0]) != nil and winds[0] >= 0 and winds[0] <= 360 and + size(winds[1]) >= 1 and size(winds[1]) <= 3 and num(winds[1]) != nil and winds[1] >= 0 and winds[1] <= 200) { me.makeTmpy(); var computer_temp = 2; if (fmgc.flightPlanController.temporaryFlag[me.computer]) { From 34a5d6a795183a54dc9b6b2b61db8d969cae26f2 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sun, 14 Jun 2020 14:42:58 +0100 Subject: [PATCH 38/53] Holding patterns - populate information from database on HOLD page, if exists. Fix for LAT REV --- Models/Instruments/MCDU/MCDU.nas | 2 ++ Nasal/MCDU/HOLD.nas | 43 ++++++++++++++++++++++++-------- Nasal/MCDU/LATREV.nas | 2 ++ 3 files changed, 36 insertions(+), 11 deletions(-) diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index c09a593d..c7dee501 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -3335,6 +3335,8 @@ var canvas_MCDU_base = { if (myLatRev[i] != nil) { me["Simple_Title"].setText(sprintf("%s", myLatRev[i].title[0] ~ myLatRev[i].title[1] ~ myLatRev[i].title[2])); + me["Simple_Title"].setColor(getprop("/MCDUC/colors/" ~ myLatRev[i].titleColour ~ "/r"), getprop("/MCDUC/colors/" ~ myLatRev[i].titleColour ~ "/g"), getprop("/MCDUC/colors/" ~ myLatRev[i].titleColour ~ "/b")); + if (myLatRev[i].subtitle[0] != nil) { me["Simple_Center"].show(); diff --git a/Nasal/MCDU/HOLD.nas b/Nasal/MCDU/HOLD.nas index b25be522..4b0399da 100644 --- a/Nasal/MCDU/HOLD.nas +++ b/Nasal/MCDU/HOLD.nas @@ -40,21 +40,42 @@ var holdPage = { _setupPageWithData: func() { me.title = ["HOLD", " AT ", me.waypoint.wp_name]; me.titleColour = "wht"; - me.L1 = [" [ ]", "INB CRS", "blu"]; - me.L2 = [" R", " TURN", "blu"]; - if (pts.Instrumentation.Altimeter.indicatedFt.getValue() >= 14000) { - me.L2 = [" 1.5/----", "TIME/DIST", "blu"]; + me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [1, 1, 0, 0, 0, 0]]; + me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["wht", "wht", "ack", "ack", "ack", "ack"]]; + me.fontMatrix = [[1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]; + if (me.waypoint.fly_type == "Hold") { + me.makeTmpy(); + me.L1 = [" " ~ sprintf("%03.0f", me.waypoint.hold_inbound_radial), "INB CRS", "blu"]; + me.fontMatrix[0][0] = 0; + + if (me.waypoint.hold_is_left_handed) { + me.L2 = [" L", " TURN", "blu"]; + } else { + me.L2 = [" R", " TURN", "blu"]; + } + + if (me.waypoint.hold_is_distance) { + me.L2 = [" -.-/" ~ me.waypoint.hold_time_or_distance, "TIME/DIST", "blu"]; + } else { + me.L2 = [" " ~ sprintf("%3.1f", (me.waypoint.hold_time_or_distance / 60)) ~ "/----", "TIME/DIST", "blu"]; + } + me.R1 = ["COMPUTED ", nil, "wht"]; + me.R2 = ["DATABASE ", nil, "yel"]; + me.arrowsMatrix[1][1] = 0; } else { - me.L2 = [" 1.0/----", "TIME/DIST", "blu"]; + me.L1 = [" 100", "INB CRS", "blu"]; + me.L2 = [" R", " TURN", "blu"]; + if (pts.Instrumentation.Altimeter.indicatedFt.getValue() >= 14000) { + me.L2 = [" 1.5/----", "TIME/DIST", "blu"]; + } else { + me.L2 = [" 1.0/----", "TIME/DIST", "blu"]; + } + me.R1 = ["COMPUTED ", nil, "wht"]; + me.R2 = ["DATABASE ", nil, "wht"]; } me.L6 = [" RETURN", nil, "wht"]; me.C4 = ["LAST EXIT", nil, "wht"]; me.C5 = ["---- ---.-", "UTC FUEL", "wht"]; - me.R1 = ["COMPUTED ", nil, "wht"]; - me.R2 = ["DATABASE ", nil, "wht"]; - me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [1, 1, 0, 0, 0, 0]]; - me.arrowsColour = [["ack", "ack", "ack", "ack", "ack", "wht"], ["wht", "wht", "ack", "ack", "ack", "ack"]]; - me.fontMatrix = [[1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]; canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); }, makeTmpy: func() { @@ -67,7 +88,7 @@ var holdPage = { me.L1[2] = "yel"; me.L2[2] = "yel"; me.L6 = [" F-PLN", " TMPY", "yel"]; - me.R6 = ["INSERT* ", " TMPY", "yel"]; + me.R6 = ["INSERT ", " TMPY", "yel"]; me.arrowsColour[0][5] = "yel"; me.titleColour = "yel"; canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); diff --git a/Nasal/MCDU/LATREV.nas b/Nasal/MCDU/LATREV.nas index f60900b6..30a0dadc 100644 --- a/Nasal/MCDU/LATREV.nas +++ b/Nasal/MCDU/LATREV.nas @@ -1,5 +1,6 @@ var latRev = { title: [nil, nil, nil], + titleColour: "wht", subtitle: [nil, nil], fontMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]], arrowsMatrix: [[0, 0, 0, 0, 0, 0],[0, 0, 0, 0, 0, 0]], @@ -36,6 +37,7 @@ var latRev = { _checkTmpy: func() { if (fmgc.flightPlanController.temporaryFlag[me.computer]) { me.L6 = [" F-PLN", " TMPY", "yel"]; + me.titleColour = "yel"; me.arrowsColour[0][5] = "yel"; me.R2[2] = "yel"; me.R3[2] = "yel"; From b0807111a9af6b010f9049d8f9faf4c93af72642 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Sun, 14 Jun 2020 13:22:18 -0400 Subject: [PATCH 39/53] Allow GRND in descent wind --- Models/Instruments/MCDU/MCDU.nas | 4 ++++ Nasal/MCDU/MCDU.nas | 2 ++ Nasal/MCDU/WINDDES.nas | 6 +++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index c7dee501..75985eee 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -210,6 +210,8 @@ var dest_qnh = props.globals.getNode("/FMGC/internal/dest-qnh", 1); var dest_temp = props.globals.getNode("/FMGC/internal/dest-temp", 1); var dest_mag = props.globals.getNode("/FMGC/internal/dest-mag", 1); var dest_wind = props.globals.getNode("/FMGC/internal/dest-wind", 1); +# var grnd_mag = props.globals.getNode("/FMGC/internal/dest-mag-grnd", 1); +# var grnd_wind = props.globals.getNode("/FMGC/internal/dest-wind-grnd", 1); var vapp_speed_set = props.globals.getNode("/FMGC/internal/vapp-speed-set", 1); var final = props.globals.getNode("/FMGC/internal/final", 1); var radio = props.globals.getNode("/FMGC/internal/radio", 1); @@ -2974,6 +2976,8 @@ var canvas_MCDU_base = { me["Simple_L3S"].setText("MAG WIND"); if (dest_mag.getValue() != -1 and dest_wind.getValue() != -1) { me["Simple_L3"].setText(sprintf("%03.0fg", dest_mag.getValue()) ~ sprintf("/%.0f", dest_wind.getValue())); + # } else if (grnd_mag.getValue() != -1 and grnd_wind.getValue() != -1) { +# me["Simple_L3"].setText(sprintf("%03.0fg", grnd_mag.getValue()) ~ sprintf("/%.0f", grnd_wind.getValue())); } else { me["Simple_L3"].setText("---g/---");; } diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 3773c3ed..576b7a67 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -167,6 +167,8 @@ var MCDU_reset = func(i) { setprop("/FMGC/internal/dest-temp", -999); setprop("/FMGC/internal/dest-mag", -1); setprop("/FMGC/internal/dest-wind", -1); + # setprop("/FMGC/internal/dest-mag-grnd", -1); +# setprop("/FMGC/internal/dest-wind-grnd", -1); setprop("/FMGC/internal/vapp-speed-set", 0); setprop("/FMGC/internal/final", ""); setprop("/FMGC/internal/baro", 99999); diff --git a/Nasal/MCDU/WINDDES.nas b/Nasal/MCDU/WINDDES.nas index b6c18613..a8a0f5f1 100644 --- a/Nasal/MCDU/WINDDES.nas +++ b/Nasal/MCDU/WINDDES.nas @@ -212,13 +212,17 @@ var windDESPage = { var winds = split("/", mcdu_scratchpad.scratchpads[me.computer].scratchpad); if (size(winds[0]) >= 0 and size(winds[0]) <= 3 and num(winds[0]) != nil and winds[0] >= 0 and winds[0] <= 360 and size(winds[1]) >= 0 and size(winds[1]) <= 3 and num(winds[1]) != nil and winds[1] >= 0 and winds[1] <= 200 and - size(winds[2]) >= 4 and size(winds[2]) <= 5 and ((num(winds[2]) != nil and winds[2] >= 1000 and winds[2] <= 39000) or + size(winds[2]) >= 4 and size(winds[2]) <= 5 and (winds[2] == "GRND" or (num(winds[2]) != nil and winds[2] >= 1000 and winds[2] <= 39000) or (num(split("FL", winds[2])[1]) != nil and split("FL", winds[2])[1] >= 10 and split("FL", winds[2])[1] <= 390))) { me.makeTmpy(); var computer_temp = 2; if (fmgc.flightPlanController.temporaryFlag[me.computer]) { computer_temp = me.computer; } + # if (winds[2] == "GRND") { +# setprop("/FMGC/internal/dest-mag-grnd", winds[0]); +# setprop("/FMGC/internal/dest-wind-grnd", winds[1]); +# } #print(computer_temp); if (index == 5) { fmgc.windController.des_winds[computer_temp].wind5.heading = winds[0]; From ed66593c1b669ae6b6bcee27f4adefb742ba8b9c Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sun, 14 Jun 2020 18:30:58 +0100 Subject: [PATCH 40/53] Improvements to winds format entry, fixes for nasal error --- Models/Instruments/MCDU/MCDU.nas | 4 +-- Nasal/FMGC/FMGC-b.nas | 6 ++++ Nasal/FMGC/FMGC.nas | 4 +-- Nasal/MCDU/LATREV.nas | 4 +-- Nasal/MCDU/PERFAPPR.nas | 4 +-- Nasal/MCDU/WINDCLB.nas | 32 ++++++++--------- Nasal/MCDU/WINDCRZ.nas | 61 ++++++++++++++++---------------- Nasal/MCDU/WINDDES.nas | 36 +++++++++---------- 8 files changed, 78 insertions(+), 73 deletions(-) diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index 75985eee..32c7852a 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -2296,7 +2296,7 @@ var canvas_MCDU_base = { me["Simple_L4S"].setText("TRANS ALT"); me["Simple_L5S"].setText("THR RED/ACC"); me["Simple_L6S"].setText(" UPLINK"); - me["Simple_R2"].setText("[ ] "); + me["Simple_R2"].setText("[ ] "); me["Simple_R5"].setText(sprintf("%3.0f", engOutAcc.getValue())); me["Simple_R6"].setText("PHASE "); me["Simple_R1S"].setText("RWY "); @@ -2372,7 +2372,7 @@ var canvas_MCDU_base = { } else { me["Simple_R3"].setFont(symbol); me["Simple_R3"].setFontSize(small); - me["Simple_R3"].setText("[ ]/[ ]"); + me["Simple_R3"].setText("[ ]/[ ]"); } if (flexSet.getValue() == 1) { me["Simple_R4"].setFont(default); diff --git a/Nasal/FMGC/FMGC-b.nas b/Nasal/FMGC/FMGC-b.nas index 229a098f..2bed42dc 100644 --- a/Nasal/FMGC/FMGC-b.nas +++ b/Nasal/FMGC/FMGC-b.nas @@ -430,6 +430,12 @@ var ITAF = { if (FPLN.wp0Dist.getValue() <= FPLN.turnDist and !Gear.wow1.getBoolValue()) { flightPlanController.autoSequencing(); } + + #if (FPLN.wp0Dist.getValue() <= FPLN.turnDist and !Gear.wow1.getBoolValue() and fmgc.flightPlanController.flightplans[2].getWP(FPLN.currentWPTemp).fly_type == "flyBy") { + # flightPlanController.autoSequencing(); + #} elsif (FPLN.wp0Dist.getValue() <= 0.1) { + # flightPlanController.autoSequencing(); + #} } } }, diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index bbc31c76..b38d756f 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -269,9 +269,9 @@ var updateFuel = func { temp = getprop("/FMGC/internal/cruise-temp"); dist = flightPlanController.arrivalDist; - wind = getprop("/FMGC/internal/trip-wind"); + trpWind = getprop("/FMGC/internal/trip-wind"); wind_value = getprop("/FMGC/internal/trip-wind-value"); - if (find("HD", wind) != -1 or find("-", wind) != -1 or find("H", wind) != -1) { + if (find("HD", trpWind) != -1 or find("-", trpWind) != -1 or find("H", trpWind) != -1) { wind_value = wind_value * -1; } dist = dist - (dist * wind_value * 0.002); diff --git a/Nasal/MCDU/LATREV.nas b/Nasal/MCDU/LATREV.nas index 30a0dadc..0896a37a 100644 --- a/Nasal/MCDU/LATREV.nas +++ b/Nasal/MCDU/LATREV.nas @@ -52,7 +52,7 @@ var latRev = { me.L3 = [" HOLD", nil, "wht"]; me.L6 = [" RETURN", nil, "wht"]; me.R1 = ["FIX INFO ", nil, "wht"]; - me.R2 = ["[ ]°/[ ]°/[ ]", "LL XING/INCR/NO", "blu"]; + me.R2 = ["[ ]°/[ ]°/[ ]", "LL XING/INCR/NO", "blu"]; me.arrowsMatrix = [[0, 1, 1, 0, 0, 1], [1, 0, 0, 0, 0, 0]]; me.arrowsColour = [["ack", "wht", "wht", "ack", "ack", "wht"], ["wht", "ack", "ack", "ack", "ack", "ack"]]; me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0]]; @@ -77,7 +77,7 @@ var latRev = { me.L2 = [" OFFSET", nil, "wht"]; me.L6 = [" RETURN", nil, "wht"]; me.R1 = ["FIX INFO ", nil, "wht"]; - me.R2 = ["[ ]°/[ ]°/[ ]", "LL XING/INCR/NO", "blu"]; + me.R2 = ["[ ]°/[ ]°/[ ]", "LL XING/INCR/NO", "blu"]; me.R3 = ["[ ]", "NEXT WPT ", "blu"]; me.R4 = ["[ ]", "NEW DEST", "blu"]; me.arrowsMatrix = [[1, 1, 0, 0, 0, 1], [1, 0, 0, 0, 0, 0]]; diff --git a/Nasal/MCDU/PERFAPPR.nas b/Nasal/MCDU/PERFAPPR.nas index 2e986681..a59aff03 100644 --- a/Nasal/MCDU/PERFAPPR.nas +++ b/Nasal/MCDU/PERFAPPR.nas @@ -35,12 +35,10 @@ var perfAPPRInput = func(key, i) { mcdu_scratchpad.scratchpads[i].empty(); } else if (tfs >= 3 and tfs <= 7 and find("/", scratchpad) != -1) { var weather = split("/", scratchpad); - var mag = int(weather[0]); var mags = size(weather[0]); - var wind = int(weather[1]); var winds = size(weather[1]); if (mags >= 1 and mags <= 3 and winds >= 1 and winds <= 3) { - if (mag != nil and wind != nil and mag >= 0 and mag <= 360 and wind >= 0 and wind <= 200) { + if (num(weather[0]) != nil and num(weather[1]) != nil and int(weather[0]) >= 0 and int(weather[0]) <= 360 and int(weather[1]) >= 0 and int(weather[1]) <= 200) { setprop("/FMGC/internal/dest-mag", weather[0]); setprop("/FMGC/internal/dest-wind", weather[1]); mcdu_scratchpad.scratchpads[i].empty(); diff --git a/Nasal/MCDU/WINDCLB.nas b/Nasal/MCDU/WINDCLB.nas index 78ed19e2..4cddc0ba 100644 --- a/Nasal/MCDU/WINDCLB.nas +++ b/Nasal/MCDU/WINDCLB.nas @@ -70,10 +70,10 @@ var windCLBPage = { } if (me.items >= 5) { - var wind = 0; - wind = fmgc.windController.clb_winds[computer_temp].wind5; - if (wind.altitude != "") { - me.L5 = [sprintf("%03.0f", wind.heading) ~ "°/" ~ sprintf("%03.0f", wind.magnitude) ~ "/" ~ wind.altitude, nil, "blu"]; + var windStore = 0; + windStore = fmgc.windController.clb_winds[computer_temp].wind5; + if (windStore.altitude != "") { + me.L5 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][4] = 1; } else { me.L5 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -84,9 +84,9 @@ var windCLBPage = { } if (me.items >= 4) { - wind = fmgc.windController.clb_winds[computer_temp].wind4; - if (wind.altitude != "") { - me.L4 = [sprintf("%03.0f", wind.heading) ~ "°/" ~ sprintf("%03.0f", wind.magnitude) ~ "/" ~ wind.altitude, nil, "blu"]; + windStore = fmgc.windController.clb_winds[computer_temp].wind4; + if (windStore.altitude != "") { + me.L4 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][3] = 1; } else { me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -97,9 +97,9 @@ var windCLBPage = { } if (me.items >= 3) { - wind = fmgc.windController.clb_winds[computer_temp].wind3; - if (wind.altitude != "") { - me.L3 = [sprintf("%03.0f", wind.heading) ~ "°/" ~ sprintf("%03.0f", wind.magnitude) ~ "/" ~ wind.altitude, nil, "blu"]; + windStore = fmgc.windController.clb_winds[computer_temp].wind3; + if (windStore.altitude != "") { + me.L3 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][2] = 1; } else { me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -110,9 +110,9 @@ var windCLBPage = { } if (me.items >= 2) { - wind = fmgc.windController.clb_winds[computer_temp].wind2; - if (wind.altitude != "") { - me.L2 = [sprintf("%03.0f", wind.heading) ~ "°/" ~ sprintf("%03.0f", wind.magnitude) ~ "/" ~ wind.altitude, nil, "blu"]; + windStore = fmgc.windController.clb_winds[computer_temp].wind2; + if (windStore.altitude != "") { + me.L2 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][1] = 1; } else { me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -123,9 +123,9 @@ var windCLBPage = { } if (me.items >= 1) { - wind = fmgc.windController.clb_winds[computer_temp].wind1; - if (wind.altitude != "") { - me.L1 = [sprintf("%03.0f", wind.heading) ~ "°/" ~ sprintf("%03.0f", wind.magnitude) ~ "/" ~ wind.altitude, "TRU WIND/ALT", "blu"]; + windStore = fmgc.windController.clb_winds[computer_temp].wind1; + if (windStore.altitude != "") { + me.L1 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, "TRU WIND/ALT", "blu"]; me.fontMatrix[0][0] = 1; } else { me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"]; diff --git a/Nasal/MCDU/WINDCRZ.nas b/Nasal/MCDU/WINDCRZ.nas index 541f4d8c..2573912f 100644 --- a/Nasal/MCDU/WINDCRZ.nas +++ b/Nasal/MCDU/WINDCRZ.nas @@ -96,9 +96,10 @@ var windCRZPage = { # load data if (me.singleCRZ == 1) { if (me.items >= 4) { - wind = fmgc.windController.crz_winds[computer_temp].wind4; - if (wind.altitude != "") { - me.L4 = [sprintf("%03.0f", wind.heading) ~ "°/" ~ sprintf("%03.0f", wind.magnitude) ~ "/" ~ wind.altitude, nil, "blu"]; + var windStore = 0; + windStore = fmgc.windController.crz_winds[computer_temp].wind4; + if (windStore.altitude != "") { + me.L4 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][3] = 1; } else { me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -109,9 +110,9 @@ var windCRZPage = { } if (me.items >= 3) { - wind = fmgc.windController.crz_winds[computer_temp].wind3; - if (wind.altitude != "") { - me.L3 = [sprintf("%03.0f", wind.heading) ~ "°/" ~ sprintf("%03.0f", wind.magnitude) ~ "/" ~ wind.altitude, nil, "blu"]; + windStore = fmgc.windController.crz_winds[computer_temp].wind3; + if (windStore.altitude != "") { + me.L3 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][2] = 1; } else { me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -122,9 +123,9 @@ var windCRZPage = { } if (me.items >= 2) { - wind = fmgc.windController.crz_winds[computer_temp].wind2; - if (wind.altitude != "") { - me.L2 = [sprintf("%03.0f", wind.heading) ~ "°/" ~ sprintf("%03.0f", wind.magnitude) ~ "/" ~ wind.altitude, nil, "blu"]; + windStore = fmgc.windController.crz_winds[computer_temp].wind2; + if (windStore.altitude != "") { + me.L2 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][1] = 1; } else { me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -135,9 +136,9 @@ var windCRZPage = { } if (me.items >= 1) { - wind = fmgc.windController.crz_winds[computer_temp].wind1; - if (wind.altitude != "") { - me.L1 = [sprintf("%03.0f", wind.heading) ~ "°/" ~ sprintf("%03.0f", wind.magnitude) ~ "/" ~ wind.altitude, "TRU WIND/ALT", "blu"]; + windStore = fmgc.windController.crz_winds[computer_temp].wind1; + if (windStore.altitude != "") { + me.L1 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, "TRU WIND/ALT", "blu"]; me.fontMatrix[0][0] = 1; } else { me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"]; @@ -145,9 +146,9 @@ var windCRZPage = { } } - wind = fmgc.windController.crz_winds[computer_temp].sat1; - if (wind.altitude != "") { - me.L5 = [wind.temp ~ "/" ~ wind.altitude, "SAT / ALT", "blu"]; + windStore = fmgc.windController.crz_winds[computer_temp].sat1; + if (windStore.altitude != "") { + me.L5 = [windStore.temp ~ "/" ~ windStore.altitude, "SAT / ALT", "blu"]; me.fontMatrix[0][4] = 1; } else { me.L5 = ["[ ]/[ ]", "SAT / ALT", "blu"]; @@ -155,9 +156,9 @@ var windCRZPage = { } } else { if (me.items >= 4) { - wind = fmgc.windController.winds[computer_temp][me.match_location].wind4; - if (wind.altitude != "") { - me.L4 = [sprintf("%03.0f", wind.heading) ~ "°/" ~sprintf("%03.0f", wind.magnitude) ~ "/" ~ wind.altitude, nil, "blu"]; + windStore = fmgc.windController.winds[computer_temp][me.match_location].wind4; + if (windStore.altitude != "") { + me.L4 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][3] = 1; } else { me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -168,9 +169,9 @@ var windCRZPage = { } if (me.items >= 3) { - wind = fmgc.windController.winds[computer_temp][me.match_location].wind3; - if (wind.altitude != "") { - me.L3 = [sprintf("%03.0f", wind.heading) ~ "°/" ~ sprintf("%03.0f", wind.magnitude) ~ "/" ~ wind.altitude, nil, "blu"]; + windStore = fmgc.windController.winds[computer_temp][me.match_location].wind3; + if (windStore.altitude != "") { + me.L3 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][2] = 1; } else { me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -181,9 +182,9 @@ var windCRZPage = { } if (me.items >= 2) { - wind = fmgc.windController.winds[computer_temp][me.match_location].wind2; - if (wind.altitude != "") { - me.L2 = [sprintf("%03.0f", wind.heading) ~ "°/" ~ sprintf("%03.0f", wind.magnitude) ~ "/" ~ wind.altitude, nil, "blu"]; + windStore = fmgc.windController.winds[computer_temp][me.match_location].wind2; + if (windStore.altitude != "") { + me.L2 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][1] = 1; } else { me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -194,9 +195,9 @@ var windCRZPage = { } if (me.items >= 1) { - wind = fmgc.windController.winds[computer_temp][me.match_location].wind1; - if (wind.altitude != "") { - me.L1 = [sprintf("%03.0f", wind.heading) ~ "°/" ~ sprintf("%03.0f", wind.magnitude) ~ "/" ~ wind.altitude, "TRU WIND/ALT", "blu"]; + windStore = fmgc.windController.winds[computer_temp][me.match_location].wind1; + if (windStore.altitude != "") { + me.L1 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, "TRU WIND/ALT", "blu"]; me.fontMatrix[0][0] = 1; } else { me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"]; @@ -204,9 +205,9 @@ var windCRZPage = { } } - wind = fmgc.windController.winds[computer_temp][me.match_location].sat1; - if (wind.altitude != "") { - me.L5 = [wind.temp ~ "/" ~ wind.altitude, "SAT / ALT", "blu"]; + windStore = fmgc.windController.winds[computer_temp][me.match_location].sat1; + if (windStore.altitude != "") { + me.L5 = [windStore.temp ~ "/" ~ windStore.altitude, "SAT / ALT", "blu"]; me.fontMatrix[0][4] = 1; } else { me.L5 = ["[ ]/[ ]", "SAT / ALT", "blu"]; diff --git a/Nasal/MCDU/WINDDES.nas b/Nasal/MCDU/WINDDES.nas index a8a0f5f1..997d64c5 100644 --- a/Nasal/MCDU/WINDDES.nas +++ b/Nasal/MCDU/WINDDES.nas @@ -71,10 +71,10 @@ var windDESPage = { } if (me.items >= 5) { - var wind = 0; - wind = fmgc.windController.des_winds[computer_temp].wind5; + var windStore = 0; + windStore = fmgc.windController.des_winds[computer_temp].wind5; if (wind.altitude != "") { - me.L5 = [sprintf("%03.0f", wind.heading) ~ "°/" ~ sprintf("%03.0f", wind.magnitude) ~ "/" ~ wind.altitude, nil, "blu"]; + me.L5 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][4] = 1; } else { me.L5 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -85,9 +85,9 @@ var windDESPage = { } if (me.items >= 4) { - wind = fmgc.windController.des_winds[computer_temp].wind4; - if (wind.altitude != "") { - me.L4 = [sprintf("%03.0f", wind.heading) ~ "°/" ~ sprintf("%03.0f", wind.magnitude) ~ "/" ~ wind.altitude, nil, "blu"]; + windStore = fmgc.windController.des_winds[computer_temp].wind4; + if (windStore.altitude != "") { + me.L4 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][3] = 1; } else { me.L4 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -98,9 +98,9 @@ var windDESPage = { } if (me.items >= 3) { - wind = fmgc.windController.des_winds[computer_temp].wind3; - if (wind.altitude != "") { - me.L3 = [sprintf("%03.0f", wind.heading) ~ "°/" ~ sprintf("%03.0f", wind.magnitude) ~ "/" ~ wind.altitude, nil, "blu"]; + windStore = fmgc.windController.des_winds[computer_temp].wind3; + if (windStore.altitude != "") { + me.L3 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][2] = 1; } else { me.L3 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -111,9 +111,9 @@ var windDESPage = { } if (me.items >= 2) { - wind = fmgc.windController.des_winds[computer_temp].wind2; - if (wind.altitude != "") { - me.L2 = [sprintf("%03.0f", wind.heading) ~ "°/" ~ sprintf("%03.0f", wind.magnitude) ~ "/" ~ wind.altitude, nil, "blu"]; + windStore = fmgc.windController.des_winds[computer_temp].wind2; + if (windStore.altitude != "") { + me.L2 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][1] = 1; } else { me.L2 = ["[ ]/[ ]/[ ]", nil, "blu"]; @@ -124,9 +124,9 @@ var windDESPage = { } if (me.items >= 1) { - wind = fmgc.windController.des_winds[computer_temp].wind1; - if (wind.altitude != "") { - me.L1 = [sprintf("%03.0f", wind.heading) ~ "°/" ~ sprintf("%03.0f", wind.magnitude) ~ "/" ~ wind.altitude, "TRU WIND/ALT", "blu"]; + windStore = fmgc.windController.des_winds[computer_temp].wind1; + if (windStore.altitude != "") { + me.L1 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, "TRU WIND/ALT", "blu"]; me.fontMatrix[0][0] = 1; } else { me.L1 = ["[ ]/[ ]/[ ]", "TRU WIND/ALT", "blu"]; @@ -137,9 +137,9 @@ var windDESPage = { me.L6 = [" RETURN", nil, "wht"]; if (getprop("/FMGC/internal/alt-set")) { - wind = fmgc.windController.des_winds[computer_temp].alt1; - if (wind.heading != 0 and wind.magnitude != 0) { - me.R1 = [sprintf("%03.0f", wind.heading) ~ "°/" ~ sprintf("%03.0f", wind.magnitude), "ALTN WIND ", "blu"]; + windStore = fmgc.windController.des_winds[computer_temp].alt1; + if (windStore.heading != 0 and windStore.magnitude != 0) { + me.R1 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude), "ALTN WIND ", "blu"]; me.fontMatrix[1][0] = 1; } else { me.R1 = ["[ ]/[ ]", "ALTN WIND ", "blu"]; From 4a66cdf2a5c343821bd8af05101a00beec2dddc5 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Sun, 14 Jun 2020 14:38:10 -0400 Subject: [PATCH 41/53] Variables fixes --- Nasal/MCDU/WINDCLB.nas | 11 +++++------ Nasal/MCDU/WINDCRZ.nas | 21 ++++++++++----------- Nasal/MCDU/WINDDES.nas | 15 +++++++-------- 3 files changed, 22 insertions(+), 25 deletions(-) diff --git a/Nasal/MCDU/WINDCLB.nas b/Nasal/MCDU/WINDCLB.nas index 4cddc0ba..e7619834 100644 --- a/Nasal/MCDU/WINDCLB.nas +++ b/Nasal/MCDU/WINDCLB.nas @@ -70,8 +70,7 @@ var windCLBPage = { } if (me.items >= 5) { - var windStore = 0; - windStore = fmgc.windController.clb_winds[computer_temp].wind5; + var windStore = fmgc.windController.clb_winds[computer_temp].wind5; if (windStore.altitude != "") { me.L5 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][4] = 1; @@ -84,7 +83,7 @@ var windCLBPage = { } if (me.items >= 4) { - windStore = fmgc.windController.clb_winds[computer_temp].wind4; + var windStore = fmgc.windController.clb_winds[computer_temp].wind4; if (windStore.altitude != "") { me.L4 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][3] = 1; @@ -97,7 +96,7 @@ var windCLBPage = { } if (me.items >= 3) { - windStore = fmgc.windController.clb_winds[computer_temp].wind3; + var windStore = fmgc.windController.clb_winds[computer_temp].wind3; if (windStore.altitude != "") { me.L3 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][2] = 1; @@ -110,7 +109,7 @@ var windCLBPage = { } if (me.items >= 2) { - windStore = fmgc.windController.clb_winds[computer_temp].wind2; + var windStore = fmgc.windController.clb_winds[computer_temp].wind2; if (windStore.altitude != "") { me.L2 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][1] = 1; @@ -123,7 +122,7 @@ var windCLBPage = { } if (me.items >= 1) { - windStore = fmgc.windController.clb_winds[computer_temp].wind1; + var windStore = fmgc.windController.clb_winds[computer_temp].wind1; if (windStore.altitude != "") { me.L1 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, "TRU WIND/ALT", "blu"]; me.fontMatrix[0][0] = 1; diff --git a/Nasal/MCDU/WINDCRZ.nas b/Nasal/MCDU/WINDCRZ.nas index 2573912f..f69d45cd 100644 --- a/Nasal/MCDU/WINDCRZ.nas +++ b/Nasal/MCDU/WINDCRZ.nas @@ -96,8 +96,7 @@ var windCRZPage = { # load data if (me.singleCRZ == 1) { if (me.items >= 4) { - var windStore = 0; - windStore = fmgc.windController.crz_winds[computer_temp].wind4; + var windStore = fmgc.windController.crz_winds[computer_temp].wind4; if (windStore.altitude != "") { me.L4 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][3] = 1; @@ -110,7 +109,7 @@ var windCRZPage = { } if (me.items >= 3) { - windStore = fmgc.windController.crz_winds[computer_temp].wind3; + var windStore = fmgc.windController.crz_winds[computer_temp].wind3; if (windStore.altitude != "") { me.L3 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][2] = 1; @@ -123,7 +122,7 @@ var windCRZPage = { } if (me.items >= 2) { - windStore = fmgc.windController.crz_winds[computer_temp].wind2; + var windStore = fmgc.windController.crz_winds[computer_temp].wind2; if (windStore.altitude != "") { me.L2 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][1] = 1; @@ -136,7 +135,7 @@ var windCRZPage = { } if (me.items >= 1) { - windStore = fmgc.windController.crz_winds[computer_temp].wind1; + var windStore = fmgc.windController.crz_winds[computer_temp].wind1; if (windStore.altitude != "") { me.L1 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, "TRU WIND/ALT", "blu"]; me.fontMatrix[0][0] = 1; @@ -146,7 +145,7 @@ var windCRZPage = { } } - windStore = fmgc.windController.crz_winds[computer_temp].sat1; + var windStore = fmgc.windController.crz_winds[computer_temp].sat1; if (windStore.altitude != "") { me.L5 = [windStore.temp ~ "/" ~ windStore.altitude, "SAT / ALT", "blu"]; me.fontMatrix[0][4] = 1; @@ -156,7 +155,7 @@ var windCRZPage = { } } else { if (me.items >= 4) { - windStore = fmgc.windController.winds[computer_temp][me.match_location].wind4; + var windStore = fmgc.windController.winds[computer_temp][me.match_location].wind4; if (windStore.altitude != "") { me.L4 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][3] = 1; @@ -169,7 +168,7 @@ var windCRZPage = { } if (me.items >= 3) { - windStore = fmgc.windController.winds[computer_temp][me.match_location].wind3; + var windStore = fmgc.windController.winds[computer_temp][me.match_location].wind3; if (windStore.altitude != "") { me.L3 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][2] = 1; @@ -182,7 +181,7 @@ var windCRZPage = { } if (me.items >= 2) { - windStore = fmgc.windController.winds[computer_temp][me.match_location].wind2; + var windStore = fmgc.windController.winds[computer_temp][me.match_location].wind2; if (windStore.altitude != "") { me.L2 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][1] = 1; @@ -195,7 +194,7 @@ var windCRZPage = { } if (me.items >= 1) { - windStore = fmgc.windController.winds[computer_temp][me.match_location].wind1; + var windStore = fmgc.windController.winds[computer_temp][me.match_location].wind1; if (windStore.altitude != "") { me.L1 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, "TRU WIND/ALT", "blu"]; me.fontMatrix[0][0] = 1; @@ -205,7 +204,7 @@ var windCRZPage = { } } - windStore = fmgc.windController.winds[computer_temp][me.match_location].sat1; + var windStore = fmgc.windController.winds[computer_temp][me.match_location].sat1; if (windStore.altitude != "") { me.L5 = [windStore.temp ~ "/" ~ windStore.altitude, "SAT / ALT", "blu"]; me.fontMatrix[0][4] = 1; diff --git a/Nasal/MCDU/WINDDES.nas b/Nasal/MCDU/WINDDES.nas index 997d64c5..b2f14947 100644 --- a/Nasal/MCDU/WINDDES.nas +++ b/Nasal/MCDU/WINDDES.nas @@ -71,9 +71,8 @@ var windDESPage = { } if (me.items >= 5) { - var windStore = 0; - windStore = fmgc.windController.des_winds[computer_temp].wind5; - if (wind.altitude != "") { + var windStore = fmgc.windController.des_winds[computer_temp].wind5; + if (windStore.altitude != "") { me.L5 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][4] = 1; } else { @@ -85,7 +84,7 @@ var windDESPage = { } if (me.items >= 4) { - windStore = fmgc.windController.des_winds[computer_temp].wind4; + var windStore = fmgc.windController.des_winds[computer_temp].wind4; if (windStore.altitude != "") { me.L4 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][3] = 1; @@ -98,7 +97,7 @@ var windDESPage = { } if (me.items >= 3) { - windStore = fmgc.windController.des_winds[computer_temp].wind3; + var windStore = fmgc.windController.des_winds[computer_temp].wind3; if (windStore.altitude != "") { me.L3 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][2] = 1; @@ -111,7 +110,7 @@ var windDESPage = { } if (me.items >= 2) { - windStore = fmgc.windController.des_winds[computer_temp].wind2; + var windStore = fmgc.windController.des_winds[computer_temp].wind2; if (windStore.altitude != "") { me.L2 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, nil, "blu"]; me.fontMatrix[0][1] = 1; @@ -124,7 +123,7 @@ var windDESPage = { } if (me.items >= 1) { - windStore = fmgc.windController.des_winds[computer_temp].wind1; + var windStore = fmgc.windController.des_winds[computer_temp].wind1; if (windStore.altitude != "") { me.L1 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude) ~ "/" ~ windStore.altitude, "TRU WIND/ALT", "blu"]; me.fontMatrix[0][0] = 1; @@ -137,7 +136,7 @@ var windDESPage = { me.L6 = [" RETURN", nil, "wht"]; if (getprop("/FMGC/internal/alt-set")) { - windStore = fmgc.windController.des_winds[computer_temp].alt1; + var windStore = fmgc.windController.des_winds[computer_temp].alt1; if (windStore.heading != 0 and windStore.magnitude != 0) { me.R1 = [sprintf("%03.0f", windStore.heading) ~ "°/" ~ sprintf("%03.0f", windStore.magnitude), "ALTN WIND ", "blu"]; me.fontMatrix[1][0] = 1; From 41fe5cbb5d64574f615954938e54c148bac58267 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sun, 14 Jun 2020 20:26:07 +0100 Subject: [PATCH 42/53] Fix RAD NAV --- Models/Instruments/MCDU/MCDU.nas | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index 32c7852a..fccf7832 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -986,7 +986,7 @@ var canvas_MCDU_base = { } else { me["Simple_L5"].setFont(symbol); me["Simple_L5"].setFontSize(small); - me["Simple_L5"].setText("[ ]/[ . ]"); + me["Simple_L5"].setText("[ ]/[ ]"); } if (vor2FreqSet.getValue() == 1) { @@ -1006,7 +1006,7 @@ var canvas_MCDU_base = { } else { me["Simple_R5"].setFont(symbol); me["Simple_R5"].setFontSize(small); - me["Simple_R5"].setText("[ . ]/[ ]"); + me["Simple_R5"].setText("[ ]/[ ]"); } me["Simple_L1"].setText(" " ~ vor1.getValue()); @@ -1020,7 +1020,7 @@ var canvas_MCDU_base = { me["Simple_L5S"].setText("ADF1/FREQ"); me["Simple_R1"].setText(" " ~ vor2.getValue()); me["Simple_R2"].setText(sprintf("%3.0f", vor2CRS.getValue())); - me["Simple_R3"].setText("[ ]/[ ]"); + me["Simple_R3"].setText("[ ]/[ ]"); me["Simple_R4"].setText("-.- [ ]"); me["Simple_R1S"].setText("FREQ/VOR2"); me["Simple_R2S"].setText("CRS"); From 2d051f15c3f8b7a8b5adb12ef7cac42c8190a1ee Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Mon, 15 Jun 2020 16:32:29 +0100 Subject: [PATCH 43/53] Bugfix nasal error --- Nasal/MCDU/F-PLN.nas | 2 +- Nasal/MCDU/VERTREV.nas | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Nasal/MCDU/F-PLN.nas b/Nasal/MCDU/F-PLN.nas index 468c6caf..236bd5b4 100644 --- a/Nasal/MCDU/F-PLN.nas +++ b/Nasal/MCDU/F-PLN.nas @@ -164,7 +164,7 @@ var fplnItem = { if (fmgc.flightPlanController.temporaryFlag[me.computer]) { if (me.index == fmgc.flightPlanController.arrivalIndex[me.computer]) { canvas_mcdu.myVertRev[me.computer] = vertRev.new(1, left(me.wp.wp_name, 4), me.index, me.computer); - } if (left(me.wp.wp_name, 4) == fmgc.flightPlanController.flightplans[me.computer].departure.id) { + } elsif (left(me.wp.wp_name, 4) == fmgc.flightPlanController.flightplans[me.computer].departure.id) { canvas_mcdu.myVertRev[me.computer] = vertRev.new(0, left(me.wp.wp_name, 4), me.index, me.computer); } elsif (me.index == (fmgc.flightPlanController.currentToWptIndex.getValue() - 1)) { canvas_mcdu.myVertRev[me.computer] = vertRev.new(3, me.wp.wp_name, me.index, me.computer); diff --git a/Nasal/MCDU/VERTREV.nas b/Nasal/MCDU/VERTREV.nas index bc647651..b138a914 100644 --- a/Nasal/MCDU/VERTREV.nas +++ b/Nasal/MCDU/VERTREV.nas @@ -53,7 +53,7 @@ var vertRev = { me.arrowsMatrix = [[0, 0, 0, 1, 1, 1], [0, 1, 0, 0, 0, 0]]; me.arrowsColour = [["ack", "ack", "ack", "wht", "wht", "wht"], ["ack", "wht", "ack", "ack", "wht", "wht"]]; me.fontMatrix = [[0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0]]; - } if (me.type == 2) { + } elsif (me.type == 2) { me.title = ["VERT REV", " AT ", me.id]; me.L1 = ["", " EFOB ---.-", "wht"]; me.R1 = ["", "EXTRA ---.- ", "wht"]; From eea0e1e51aa7458887db4e73a08b105ff8139587 Mon Sep 17 00:00:00 2001 From: Vladimir Jelovac Date: Mon, 15 Jun 2020 20:37:32 +0200 Subject: [PATCH 44/53] Ground services menu optimizations mentioned in #151 --- AircraftConfig/groundservices.xml | 532 +++++++++++++++++++++--------- AircraftConfig/main.xml | 144 -------- 2 files changed, 385 insertions(+), 291 deletions(-) diff --git a/AircraftConfig/groundservices.xml b/AircraftConfig/groundservices.xml index 48a25f1e..a6d7faf3 100644 --- a/AircraftConfig/groundservices.xml +++ b/AircraftConfig/groundservices.xml @@ -8,7 +8,7 @@ ground-services vbox - + hbox @@ -26,163 +26,159 @@ - + - + + + hbox + + + vbox + + hbox + + true + + + + + + true + + + + + + vbox + + hbox + + true + + + + + + true + + + + + + + hbox + + + vbox + + + left + + + /gear/gear[0]/wow + /gear/gear[1]/wow + /gear/gear[2]/wow + + + /services/chocks/nose + + dialog-apply + + true + + + + + left + + + /gear/gear[0]/wow + /gear/gear[1]/wow + /gear/gear[2]/wow + + + /services/chocks/left + + dialog-apply + + true + + + + + left + + + /gear/gear[0]/wow + /gear/gear[1]/wow + /gear/gear[2]/wow + + + /services/chocks/right + + dialog-apply + + true + + + + + vbox + + + + left + /services/stairs/l1 + + dialog-apply + + true + + + + + left + /services/stairs/l4 + + dialog-apply + + true + + + + + left + /services/stairs/cover + + dialog-apply + + true + + + + vbox - - - left - /services/deicing_truck/enable - - dialog-apply - - true - - - - - - - - - - - - - left - /services/catering/enable - - dialog-apply - - true - - - - - - - left - /services/baggage/enable - - dialog-apply - - true - - hbox - true - + true - - - - left - /services/stairs/l1 - - dialog-apply - - true - - - - - left - /services/stairs/l4 - - dialog-apply - - true - - - - - left - /services/stairs/cover - - dialog-apply - - true - - + + + + + hbox - - - true - - - - - - true - - - - - hbox /systems/apu/oil/allow-oil-consumption @@ -193,21 +189,263 @@ /systems/apu/oil/level-l 3.9 5.4 - true - + true + dialog-apply - + 10 200 - + %.1f litres /systems/apu/oil/level-l - true + true + + + + left + /controls/electrical/ground-cart + + property-assign + /controls/electrical/switches/ext-pwr + 0 + + + + + /controls/gear/brake-parking + /services/chocks/nose + /services/chocks/left + /services/chocks/right + + + /velocities/groundspeed-kt + 2 + + + + + dialog-apply + + true + + + + + left + /controls/pneumatic/switches/groundair + + property-toggle + /controls/pneumatic/switches/groundair + + + + + /controls/gear/brake-parking + /services/chocks/nose + /services/chocks/left + /services/chocks/right + + + /velocities/groundspeed-kt + 2 + + + + + dialog-apply + + true + + + + + left + /controls/hydraulic/hand-pump-yellow + + property-toggle + /controls/hydraulic/hand-pump-yellow + + + + + /controls/gear/brake-parking + /services/chocks/nose + /services/chocks/left + /services/chocks/right + + + /velocities/groundspeed-kt + 2 + + + /systems/electrical/bus/ac-2 + 115 + + + /controls/electrical/switches/ext-pwr + 0 + + + + + dialog-apply + + true + - + + + vbox + + + hbox + + true + + + + + + true + + + + + + left + /services/baggage/enable + + dialog-apply + + true + + + + vbox + + + hbox + + true + + + + + + true + + + + + + left + /services/catering/enable + + dialog-apply + + true + + + + + + hbox + + true + + + + + + true + + + + + + + hbox + + true + + + + + + true + + + + + + left + /services/deicing_truck/enable + + dialog-apply + + true + + + + + + diff --git a/AircraftConfig/main.xml b/AircraftConfig/main.xml index eeb97261..e99c51c3 100644 --- a/AircraftConfig/main.xml +++ b/AircraftConfig/main.xml @@ -220,150 +220,6 @@ - - - left - - - /gear/gear[0]/wow - /gear/gear[1]/wow - /gear/gear[2]/wow - - - /services/chocks/nose - - dialog-apply - - true - - - - - left - - - /gear/gear[0]/wow - /gear/gear[1]/wow - /gear/gear[2]/wow - - - /services/chocks/left - - dialog-apply - - true - - - - - left - - - /gear/gear[0]/wow - /gear/gear[1]/wow - /gear/gear[2]/wow - - - /services/chocks/right - - dialog-apply - - true - - - - - left - /controls/electrical/ground-cart - - property-assign - /controls/electrical/switches/ext-pwr - 0 - - - - - /controls/gear/brake-parking - /services/chocks/nose - /services/chocks/left - /services/chocks/right - - - /velocities/groundspeed-kt - 2 - - - - - dialog-apply - - true - - - - - left - /controls/pneumatic/switches/groundair - - property-toggle - /controls/pneumatic/switches/groundair - - - - - /controls/gear/brake-parking - /services/chocks/nose - /services/chocks/left - /services/chocks/right - - - /velocities/groundspeed-kt - 2 - - - - - dialog-apply - - true - - - - - left - /controls/hydraulic/hand-pump-yellow - - property-toggle - /controls/hydraulic/hand-pump-yellow - - - - - /controls/gear/brake-parking - /services/chocks/nose - /services/chocks/left - /services/chocks/right - - - /velocities/groundspeed-kt - 2 - - - /systems/electrical/bus/ac-2 - 115 - - - /controls/electrical/switches/ext-pwr - 0 - - - - - dialog-apply - - true - - From b9783e78c9baba01f57b6ba46ed83faa3717c44c Mon Sep 17 00:00:00 2001 From: Vladimir Jelovac Date: Mon, 15 Jun 2020 22:58:36 +0200 Subject: [PATCH 45/53] #151 Reordered some elements and switched to vertical layout due to semantics. --- AircraftConfig/groundservices.xml | 456 ++++++++++++++---------------- 1 file changed, 218 insertions(+), 238 deletions(-) diff --git a/AircraftConfig/groundservices.xml b/AircraftConfig/groundservices.xml index a6d7faf3..80109d8e 100644 --- a/AircraftConfig/groundservices.xml +++ b/AircraftConfig/groundservices.xml @@ -30,131 +30,71 @@ - hbox + vbox - vbox - - hbox - - true - - - - - - true - - + hbox + + true + + + + + + true + - - vbox - - hbox - - true - - - - - - true - - - - + + + left + + + /gear/gear[0]/wow + /gear/gear[1]/wow + /gear/gear[2]/wow + + + /services/chocks/nose + + dialog-apply + + true + - - hbox + + + left + + + /gear/gear[0]/wow + /gear/gear[1]/wow + /gear/gear[2]/wow + + + /services/chocks/left + + dialog-apply + + true + - - vbox - - - left - - - /gear/gear[0]/wow - /gear/gear[1]/wow - /gear/gear[2]/wow - - - /services/chocks/nose - - dialog-apply - - true - - - - - left - - - /gear/gear[0]/wow - /gear/gear[1]/wow - /gear/gear[2]/wow - - - /services/chocks/left - - dialog-apply - - true - - - - - left - - - /gear/gear[0]/wow - /gear/gear[1]/wow - /gear/gear[2]/wow - - - /services/chocks/right - - dialog-apply - - true - - - - - vbox - - - - left - /services/stairs/l1 - - dialog-apply - - true - - - - - left - /services/stairs/l4 - - dialog-apply - - true - - - - - left - /services/stairs/cover - - dialog-apply - - true - - + + + left + + + /gear/gear[0]/wow + /gear/gear[1]/wow + /gear/gear[2]/wow + + + /services/chocks/right + + dialog-apply + + true + @@ -302,6 +242,49 @@ vbox + + hbox + + true + + + + + + true + + + + + + left + /services/stairs/l1 + + dialog-apply + + true + + + + + left + /services/stairs/l4 + + dialog-apply + + true + + + + + left + /services/stairs/cover + + dialog-apply + + true + + hbox @@ -325,127 +308,124 @@ true + - vbox - - - hbox - - true - - - - - - true - - - - - - left - /services/catering/enable - - dialog-apply - - true - - - - - - hbox - - true - - - - - - true - - - - - - - hbox - - true - - - - - - true - - - - - - left - /services/deicing_truck/enable - - dialog-apply - - true - - - + hbox + + true + + + + + + true + + + + + left + /services/catering/enable + + dialog-apply + + true + + + + + + hbox + + true + + + + + + true + + + + + + + hbox + + true + + + + + + true + + + + + + left + /services/deicing_truck/enable + + dialog-apply + + true + + + From af32913f509eda3f707c62c4e3be5a5817946604 Mon Sep 17 00:00:00 2001 From: Vladimir Jelovac Date: Mon, 15 Jun 2020 23:33:45 +0200 Subject: [PATCH 46/53] #151 Merged main gear left and right chokes under a single checkbox. --- AircraftConfig/groundservices.xml | 94 +++++++++++++++---------------- 1 file changed, 46 insertions(+), 48 deletions(-) diff --git a/AircraftConfig/groundservices.xml b/AircraftConfig/groundservices.xml index 80109d8e..b517a4d1 100644 --- a/AircraftConfig/groundservices.xml +++ b/AircraftConfig/groundservices.xml @@ -45,56 +45,54 @@ - - - left - - - /gear/gear[0]/wow - /gear/gear[1]/wow - /gear/gear[2]/wow - - - /services/chocks/nose - - dialog-apply - - true - + + hbox - - - left - - - /gear/gear[0]/wow - /gear/gear[1]/wow - /gear/gear[2]/wow - - - /services/chocks/left - - dialog-apply - - true - + + vbox + + + left + + + /gear/gear[0]/wow + /gear/gear[1]/wow + /gear/gear[2]/wow + + + /services/chocks/nose + + dialog-apply + + true + + - - - left - - - /gear/gear[0]/wow - /gear/gear[1]/wow - /gear/gear[2]/wow - - - /services/chocks/right - - dialog-apply - - true - + + vbox + + + left + + + /gear/gear[0]/wow + /gear/gear[1]/wow + /gear/gear[2]/wow + + + + property-toggle + /services/chocks/left + + + property-toggle + /services/chocks/right + + true + + + + From 11e15172a7710031fa96202c087906fce32abda7 Mon Sep 17 00:00:00 2001 From: Vladimir Jelovac Date: Tue, 16 Jun 2020 19:14:19 +0200 Subject: [PATCH 47/53] #151 Merging front and main gear chocks under a single checkbox --- AircraftConfig/groundservices.xml | 70 +++++++++++-------------------- 1 file changed, 24 insertions(+), 46 deletions(-) diff --git a/AircraftConfig/groundservices.xml b/AircraftConfig/groundservices.xml index b517a4d1..7e0d0079 100644 --- a/AircraftConfig/groundservices.xml +++ b/AircraftConfig/groundservices.xml @@ -46,52 +46,31 @@ - hbox - - - vbox - - - left - - - /gear/gear[0]/wow - /gear/gear[1]/wow - /gear/gear[2]/wow - - + vbox + + + left + + + /gear/gear[0]/wow + /gear/gear[1]/wow + /gear/gear[2]/wow + + + + property-toggle + /services/chocks/left + + + property-toggle + /services/chocks/right + + + property-toggle /services/chocks/nose - - dialog-apply - - true - - - - - vbox - - - left - - - /gear/gear[0]/wow - /gear/gear[1]/wow - /gear/gear[2]/wow - - - - property-toggle - /services/chocks/left - - - property-toggle - /services/chocks/right - - true - - - + + true + @@ -306,7 +285,6 @@ true - hbox From 1380fc3a371fcbba1e0dfd8e503ed61738260351 Mon Sep 17 00:00:00 2001 From: Vladimir Jelovac Date: Tue, 16 Jun 2020 19:32:18 +0200 Subject: [PATCH 48/53] #151 Adding missing property in order to set the checkbox state, --- AircraftConfig/groundservices.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/AircraftConfig/groundservices.xml b/AircraftConfig/groundservices.xml index 7e0d0079..e1b3bde3 100644 --- a/AircraftConfig/groundservices.xml +++ b/AircraftConfig/groundservices.xml @@ -57,6 +57,7 @@ /gear/gear[2]/wow + /services/chocks/nose property-toggle /services/chocks/left From 9a56678e947c9878036cb0ff58b347f7bcaf0bc1 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Wed, 17 Jun 2020 10:38:21 +0100 Subject: [PATCH 49/53] Bugfix for loading flightplans - thanks LemiCandy! --- Nasal/FMGC/flightplan.nas | 61 +++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 31 deletions(-) diff --git a/Nasal/FMGC/flightplan.nas b/Nasal/FMGC/flightplan.nas index 60741f1d..0022705a 100644 --- a/Nasal/FMGC/flightplan.nas +++ b/Nasal/FMGC/flightplan.nas @@ -106,8 +106,6 @@ var flightPlanController = { print(err[0]); print("Load failed."); } - # try to fix fgfp - me.flightplans[3].destination = airportinfo(getprop("/FMGC/internal/arr-arpt")); me.destroyTemporaryFlightPlan(3, 1); }, @@ -117,34 +115,36 @@ var flightPlanController = { me.resetFlightplan(2); me.flightplans[2] = me.flightplans[n].clone(); - if (mcdu.isNoSid[n] == 1) { - mcdu.isNoSid[2] = 1; - } else { - mcdu.isNoSid[2] = 0; - } - - if (mcdu.isNoStar[n] == 1) { - mcdu.isNoStar[2] = 1; - } else { - mcdu.isNoStar[2] = 0; - } - - if (mcdu.isNoVia[n] == 1) { - mcdu.isNoVia[2] = 1; - } else { - mcdu.isNoVia[2] = 0; - } - - if (mcdu.isNoTransDep[n] == 1) { - mcdu.isNoTransDep[2] = 1; - } else { - mcdu.isNoTransDep[2] = 0; - } - - if (mcdu.isNoTransArr[n] == 1) { - mcdu.isNoTransArr[2] = 1; - } else { - mcdu.isNoTransArr[2] = 0; + if (n != 3) { + if (mcdu.isNoSid[n] == 1) { + mcdu.isNoSid[2] = 1; + } else { + mcdu.isNoSid[2] = 0; + } + + if (mcdu.isNoStar[n] == 1) { + mcdu.isNoStar[2] = 1; + } else { + mcdu.isNoStar[2] = 0; + } + + if (mcdu.isNoVia[n] == 1) { + mcdu.isNoVia[2] = 1; + } else { + mcdu.isNoVia[2] = 0; + } + + if (mcdu.isNoTransDep[n] == 1) { + mcdu.isNoTransDep[2] = 1; + } else { + mcdu.isNoTransDep[2] = 0; + } + + if (mcdu.isNoTransArr[n] == 1) { + mcdu.isNoTransArr[2] = 1; + } else { + mcdu.isNoTransArr[2] = 0; + } } me.flightPlanChanged(2); @@ -171,7 +171,6 @@ var flightPlanController = { } me.addDiscontinuity(1, plan); - #debug.dump(me.flightplans[2]); # reset mcdu if it exists if (canvas_mcdu.myFpln[0] != nil) { canvas_mcdu.myFpln[0].scroll = 0; } if (canvas_mcdu.myFpln[1] != nil) { canvas_mcdu.myFpln[1].scroll = 0; } From b504ed18a11e70b4652552becba12d59a81c9b86 Mon Sep 17 00:00:00 2001 From: Vladimir Jelovac Date: Wed, 17 Jun 2020 21:58:46 +0200 Subject: [PATCH 50/53] Using a single property for all gear chocks #151 --- A320-main.xml | 4 +--- AircraftConfig/autopush-config.xml | 2 +- AircraftConfig/groundservices.xml | 25 +++++-------------------- Models/A320-groundservices.xml | 6 +++--- Nasal/Libraries/libraries.nas | 2 +- Nasal/Systems/brakesystem.nas | 4 ++-- Nasal/Systems/ground_services.nas | 4 +--- Systems/a320-fcs.xml | 11 ++--------- 8 files changed, 16 insertions(+), 42 deletions(-) diff --git a/A320-main.xml b/A320-main.xml index 2726fd11..95919679 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -951,9 +951,7 @@ - 0 - 0 - 0 + 0 0 diff --git a/AircraftConfig/autopush-config.xml b/AircraftConfig/autopush-config.xml index 0e9926c0..fbe49dbf 100644 --- a/AircraftConfig/autopush-config.xml +++ b/AircraftConfig/autopush-config.xml @@ -5,7 +5,7 @@ 0.0 15 5.0 - + 1 false diff --git a/AircraftConfig/groundservices.xml b/AircraftConfig/groundservices.xml index e1b3bde3..1598bb0e 100644 --- a/AircraftConfig/groundservices.xml +++ b/AircraftConfig/groundservices.xml @@ -57,18 +57,9 @@ /gear/gear[2]/wow - /services/chocks/nose + /services/chocks/enable - property-toggle - /services/chocks/left - - - property-toggle - /services/chocks/right - - - property-toggle - /services/chocks/nose + dialog-apply true @@ -136,9 +127,7 @@ /controls/gear/brake-parking - /services/chocks/nose - /services/chocks/left - /services/chocks/right + /services/chocks/enable /velocities/groundspeed-kt @@ -164,9 +153,7 @@ /controls/gear/brake-parking - /services/chocks/nose - /services/chocks/left - /services/chocks/right + /services/chocks/enable /velocities/groundspeed-kt @@ -192,9 +179,7 @@ /controls/gear/brake-parking - /services/chocks/nose - /services/chocks/left - /services/chocks/right + /services/chocks/enable /velocities/groundspeed-kt diff --git a/Models/A320-groundservices.xml b/Models/A320-groundservices.xml index 321dd5e9..b964707f 100644 --- a/Models/A320-groundservices.xml +++ b/Models/A320-groundservices.xml @@ -132,7 +132,7 @@ Aircraft/A320-family/Models/Services/Chocks/chock_nose.ac - services/chocks/nose + services/chocks/enable 1 @@ -147,7 +147,7 @@ Aircraft/A320-family/Models/Services/Chocks/chock_left.ac - services/chocks/left + services/chocks/enable 1 @@ -163,7 +163,7 @@ Aircraft/A320-family/Models/Services/Chocks/chock_right.ac - services/chocks/right + services/chocks/enable 1 diff --git a/Nasal/Libraries/libraries.nas b/Nasal/Libraries/libraries.nas index a7644a60..9c21a954 100644 --- a/Nasal/Libraries/libraries.nas +++ b/Nasal/Libraries/libraries.nas @@ -250,7 +250,7 @@ var systemsLoop = maketimer(0.1, func { systems.APUController.loop(); systems.HFLoop(); - if ((getprop("/controls/pneumatic/switches/groundair") or getprop("/controls/electrical/ground-cart")) and ((getprop("/velocities/groundspeed-kt") > 2) or (getprop("/controls/gear/brake-parking") == 0 and getprop("/services/chocks/nose") == 0 and getprop("/services/chocks/left") == 0 and getprop("/services/chocks/right") == 0))) { + if ((getprop("/controls/pneumatic/switches/groundair") or getprop("/controls/electrical/ground-cart")) and ((getprop("/velocities/groundspeed-kt") > 2) or (getprop("/controls/gear/brake-parking") == 0 and getprop("/services/chocks/enable") == 0))) { setprop("/controls/electrical/ground-cart", 0); setprop("/controls/pneumatic/switches/groundair", 0); } diff --git a/Nasal/Systems/brakesystem.nas b/Nasal/Systems/brakesystem.nas index 13aebae2..0e70979b 100755 --- a/Nasal/Systems/brakesystem.nas +++ b/Nasal/Systems/brakesystem.nas @@ -169,7 +169,7 @@ var BrakeSystem = var V2_R = V1 - me.BrakeDecel * dt * RBrakeLevel; LThermalEnergy += (Mass * getprop("gear/gear[1]/compression-norm") * (math.pow(V1, 2) - math.pow(V2_L, 2)) / 2); - if (getprop("services/chocks/left")) { + if (getprop("services/chocks/enable")) { if (!getprop("controls/gear/brake-parking")) { # cooling effect: reduce thermal energy by (LnCoolFactor) * dt LThermalEnergy = LThermalEnergy * math.exp(LnCoolFactor * dt); @@ -202,7 +202,7 @@ var BrakeSystem = }; RThermalEnergy += (Mass * getprop("gear/gear[2]/compression-norm") * (math.pow(V1, 2) - math.pow(V2_R, 2)) / 2); - if (getprop("services/chocks/right")) { + if (getprop("services/chocks/enable")) { if (!getprop("controls/gear/brake-parking")) { # cooling effect: reduce thermal energy by (RnCoolFactor) * dt RThermalEnergy = RThermalEnergy * math.exp(RnCoolFactor * dt); diff --git a/Nasal/Systems/ground_services.nas b/Nasal/Systems/ground_services.nas index 164e8919..88541e28 100644 --- a/Nasal/Systems/ground_services.nas +++ b/Nasal/Systems/ground_services.nas @@ -20,9 +20,7 @@ var ground_services = { # Set them all to 0 if the aircraft is not stationary if (getprop("velocities/groundspeed-kt") >= 2) { - setprop("services/chocks/nose", 0); - setprop("services/chocks/left", 0); - setprop("services/chocks/right", 0); + setprop("services/chocks/enable", 0); setprop("services/fuel-truck/enable", 0); setprop("services/deicing_truck/enable", 0); setprop("services/catering/enable", 0); diff --git a/Systems/a320-fcs.xml b/Systems/a320-fcs.xml index a3ddad8d..0d8af793 100644 --- a/Systems/a320-fcs.xml +++ b/Systems/a320-fcs.xml @@ -930,16 +930,10 @@ 20 - - /services/chocks/nose - 0.5 - - /controls/gear/brake-left /controls/gear/brake-parking - /services/chocks/nose-half - /services/chocks/left + /services/chocks/enable 0 1 @@ -957,8 +951,7 @@ /controls/gear/brake-right /controls/gear/brake-parking - /services/chocks/nose-half - /services/chocks/right + /services/chocks/enable 0 1 From df0fa8887104d07f4a7f800e7a80fcfe92605c43 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Mon, 15 Jun 2020 16:29:05 +0100 Subject: [PATCH 51/53] Set constraints on FPLNt push --- Nasal/MCDU/F-PLN.nas | 92 ++++++++++++++++++++++++++++++-------------- 1 file changed, 64 insertions(+), 28 deletions(-) diff --git a/Nasal/MCDU/F-PLN.nas b/Nasal/MCDU/F-PLN.nas index f48a2af8..90adf249 100644 --- a/Nasal/MCDU/F-PLN.nas +++ b/Nasal/MCDU/F-PLN.nas @@ -156,33 +156,73 @@ var fplnItem = { setprop("MCDU[" ~ me.computer ~ "]/page", "LATREV"); }, pushButtonRight: func() { - if (canvas_mcdu.myVertRev[me.computer] != nil) { - canvas_mcdu.myVertRev[me.computer].del(); - } - canvas_mcdu.myVertRev[me.computer] = nil; - - if (fmgc.flightPlanController.temporaryFlag[me.computer]) { - if (me.index == fmgc.flightPlanController.arrivalIndex[me.computer]) { - canvas_mcdu.myVertRev[me.computer] = vertRev.new(1, left(me.wp.wp_name, 4), me.index, me.computer, me.wp, me.plan); - } elsif (left(me.wp.wp_name, 4) == fmgc.flightPlanController.flightplans[me.computer].departure.id) { - canvas_mcdu.myVertRev[me.computer] = vertRev.new(0, left(me.wp.wp_name, 4), me.index, me.computer, me.wp, me.plan); - } elsif (me.index == (fmgc.flightPlanController.currentToWptIndex.getValue() - 1)) { - canvas_mcdu.myVertRev[me.computer] = vertRev.new(3, me.wp.wp_name, me.index, me.computer, me.wp, me.plan); + if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) == 0) { + if (canvas_mcdu.myVertRev[me.computer] != nil) { + canvas_mcdu.myVertRev[me.computer].del(); + } + canvas_mcdu.myVertRev[me.computer] = nil; + + if (fmgc.flightPlanController.temporaryFlag[me.computer]) { + if (me.index == fmgc.flightPlanController.arrivalIndex[me.computer]) { + canvas_mcdu.myVertRev[me.computer] = vertRev.new(1, left(me.wp.wp_name, 4), me.index, me.computer, me.wp, me.plan); + } if (left(me.wp.wp_name, 4) == fmgc.flightPlanController.flightplans[me.computer].departure.id) { + canvas_mcdu.myVertRev[me.computer] = vertRev.new(0, left(me.wp.wp_name, 4), me.index, me.computer, me.wp, me.plan); + } elsif (me.index == (fmgc.flightPlanController.currentToWptIndex.getValue() - 1)) { + canvas_mcdu.myVertRev[me.computer] = vertRev.new(3, me.wp.wp_name, me.index, me.computer, me.wp, me.plan); + } else { + canvas_mcdu.myVertRev[me.computer] = vertRev.new(2, me.wp.wp_name, me.index, me.computer, me.wp, me.plan); + } } else { - canvas_mcdu.myVertRev[me.computer] = vertRev.new(2, me.wp.wp_name, me.index, me.computer, me.wp, me.plan); + if (me.index == fmgc.flightPlanController.arrivalIndex[2]) { + canvas_mcdu.myVertRev[me.computer] = vertRev.new(1, left(me.wp.wp_name, 4), me.index, me.computer, me.wp, me.plan); + } elsif (left(me.wp.wp_name, 4) == fmgc.flightPlanController.flightplans[2].departure.id) { + canvas_mcdu.myVertRev[me.computer] = vertRev.new(0, left(me.wp.wp_name, 4), me.index, me.computer, me.wp, me.plan); + } elsif (me.index == (fmgc.flightPlanController.currentToWptIndex.getValue() - 1)) { + canvas_mcdu.myVertRev[me.computer] = vertRev.new(3, me.wp.wp_name, me.index, me.computer, me.wp, me.plan); + } else { + canvas_mcdu.myVertRev[me.computer] = vertRev.new(2, me.wp.wp_name, me.index, me.computer, me.wp, me.plan); + } + } + setprop("MCDU[" ~ me.computer ~ "]/page", "VERTREV"); + } elsif (me.index != 0) { # todo - only apply to climb, descent, or missed waypoints + var scratchpadStore = mcdu_scratchpad.scratchpads[me.computer].scratchpad; + + if (scratchpadStore == "CLR") { + me.wp.setSpeed("delete"); + me.wp.setAltitude("delete"); + mcdu_scratchpad.scratchpads[me.computer].empty(); + } elsif (find("/", scratchpadStore) != -1) { + var scratchpadSplit = split("/", scratchpadStore); + + if (size(scratchpadSplit[0]) == 0) { + if (num(scratchpadSplit[1]) != nil and (size(scratchpadSplit[1]) == 4 or size(scratchpadSplit[1]) == 5) and scratchpadSplit[1] >= 0 and scratchpadSplit[1] <= 39000) { + me.wp.setAltitude(math.round(scratchpadSplit[1], 10), "at"); + mcdu_scratchpad.scratchpads[me.computer].empty(); + } else { + mcdu_message(me.computer, "FORMAT ERROR"); + } + } else { + if (num(scratchpadSplit[0]) != nil and size(scratchpadSplit[0]) == 3 and scratchpadSplit[0] >= 100 and scratchpadSplit[0] <= 350 and + num(scratchpadSplit[1]) != nil and (size(scratchpadSplit[1]) == 4 or size(scratchpadSplit[1]) == 5) and scratchpadSplit[1] >= 0 and scratchpadSplit[1] <= 39000) { + me.wp.setSpeed(scratchpadSplit[0], "at"); + me.wp.setAltitude(math.round(scratchpadSplit[1], 10), "at"); + mcdu_scratchpad.scratchpads[me.computer].empty(); + } elsif (num(scratchpadSplit[0]) != nil and size(scratchpadSplit[0]) == 3 and scratchpadSplit[0] >= 100 and scratchpadSplit[0] <= 350 and size(scratchpadSplit[1]) == 0) { + me.wp.setSpeed(scratchpadSplit[0], "at"); + mcdu_scratchpad.scratchpads[me.computer].empty(); + } else { + mcdu_message(me.computer, "FORMAT ERROR"); + } + } + } elsif (num(scratchpadStore) != nil and size(scratchpadStore) == 3 and scratchpadStore >= 100 and scratchpadStore <= 350) { + me.wp.setSpeed(scratchpadStore, "at"); + mcdu_scratchpad.scratchpads[me.computer].empty(); + } else { + mcdu_message(me.computer, "FORMAT ERROR"); } } else { - if (me.index == fmgc.flightPlanController.arrivalIndex[2]) { - canvas_mcdu.myVertRev[me.computer] = vertRev.new(1, left(me.wp.wp_name, 4), me.index, me.computer, me.wp, me.plan); - } elsif (left(me.wp.wp_name, 4) == fmgc.flightPlanController.flightplans[2].departure.id) { - canvas_mcdu.myVertRev[me.computer] = vertRev.new(0, left(me.wp.wp_name, 4), me.index, me.computer, me.wp, me.plan); - } elsif (me.index == (fmgc.flightPlanController.currentToWptIndex.getValue() - 1)) { - canvas_mcdu.myVertRev[me.computer] = vertRev.new(3, me.wp.wp_name, me.index, me.computer, me.wp, me.plan); - } else { - canvas_mcdu.myVertRev[me.computer] = vertRev.new(2, me.wp.wp_name, me.index, me.computer, me.wp, me.plan); - } + mcdu_message(me.computer, "NOT ALLOWED"); } - setprop("MCDU[" ~ me.computer ~ "]/page", "VERTREV"); }, }; @@ -446,11 +486,7 @@ var fplnPage = { # this one is only created once, and then updated - remember th } } else { if (size(me.outputList) >= index) { - if (size(mcdu_scratchpad.scratchpads[me.computer].scratchpad) > 0) { - mcdu_message(me.computer, "NOT ALLOWED"); - } else { - me.outputList[index - 1].pushButtonRight(); - } + me.outputList[index - 1].pushButtonRight(); } else { mcdu_message(me.computer, "NOT ALLOWED"); } From 3adabd6317354589edbec587d32e9879d9aa2d75 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Tue, 23 Jun 2020 00:07:00 +0100 Subject: [PATCH 52/53] Bugfix for landing - reset arrival index (thanks @stdg!) --- Nasal/FMGC/flightplan.nas | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Nasal/FMGC/flightplan.nas b/Nasal/FMGC/flightplan.nas index 0022705a..5e515566 100644 --- a/Nasal/FMGC/flightplan.nas +++ b/Nasal/FMGC/flightplan.nas @@ -168,6 +168,7 @@ var flightPlanController = { me.destroyTemporaryFlightPlan(0, 0); me.destroyTemporaryFlightPlan(1, 0); me.currentToWptIndex.setValue(0); + me.arrivalIndex = [0, 0, 0]; # reset arrival index calculations } me.addDiscontinuity(1, plan); @@ -823,6 +824,12 @@ var flightPlanController = { } } } + + if (me.flightplans[2].getWP(me.arrivalIndex[2]) == nil or me.flightplans[2].getWP(1) == nil) { + me.arrivalDist = 9999; + print(me.arrivalIndex[2]); + } + me.arrivalDist = me.flightplans[2].getWP(me.arrivalIndex[2]).distance_along_route - me.flightplans[2].getWP(1).leg_distance + me._arrivalDist; me.updateMCDUDriver(n); }, From 3023fd45f2eceb26b62d118c239cc48232a5552b Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Tue, 23 Jun 2020 07:13:55 +0100 Subject: [PATCH 53/53] Sim: Formatting --- .github/ISSUE_TEMPLATE/bug_report.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 0eae042d..7d9304b3 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -23,9 +23,9 @@ A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. -** System (please complete the following information):** - - OS: - - FlightGear version: +**System (please complete the following information):** + - OS: + - FlightGear version: **Additional context**