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] 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() {