From da624bfb2e09645f6fbdf9ace05f75965f4a7eac Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Sat, 15 Jan 2022 17:47:00 +0000 Subject: [PATCH] DATA / STATUS pages - cleanup with new font --- A320-main.xml | 1 - Models/Instruments/MCDU/MCDU.nas | 81 +++++++++++++++++++++++--------- Nasal/MCDU/CLOSESTAIRPORT.nas | 19 ++++---- Nasal/MCDU/MCDU.nas | 14 ++++-- Nasal/MCDU/STATUS.nas | 16 ------- 5 files changed, 80 insertions(+), 51 deletions(-) delete mode 100644 Nasal/MCDU/STATUS.nas diff --git a/A320-main.xml b/A320-main.xml index 531020ec..02e4a583 100644 --- a/A320-main.xml +++ b/A320-main.xml @@ -4837,7 +4837,6 @@ 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/STATUS.nas diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index 0a9ae3c5..7c3e1d78 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -373,18 +373,18 @@ var canvas_MCDU_base = { var degrees2 = int(dms2); var minutes2 = sprintf("%.1f",abs((dms2 - degrees2) * 60)); var sign2 = degrees2 >= 0 ? "E" : "W"; - return sprintf("%d %.1f%s/%03s %.1f%s",abs(degrees),minutes,sign,abs(degrees2),minutes2,sign2); + return sprintf("%d°%.1f%s/%03s°%.1f%s",abs(degrees),minutes,sign,abs(degrees2),minutes2,sign2); }, getIRSStatus: func(a,b = 0) { var irsstatus = "INVAL"; if (systems.ADIRS.ADIRunits[a].operative) { if (systems.ADIRS.Operating.aligned[a].getValue()) { - irsstatus = (systems.ADIRS.ADIRunits[a].mode == 2) ? "ATT" : "NAV"; + irsstatus = (systems.ADIRS.ADIRunits[a].mode == 2) ? " ATT" : "NAV"; } else { if (b) { - irsstatus = "ALIGN TTN" ~ sprintf("%2d",math.round(systems.ADIRS.ADIRunits[a]._alignTime) / 60); + irsstatus = " ALIGN TTN" ~ sprintf("%2d",math.round(systems.ADIRS.ADIRunits[a]._alignTime) / 60); } else { - irsstatus = "ALIGN"; + irsstatus = " ALIGN"; } } } @@ -436,6 +436,33 @@ var canvas_MCDU_base = { if (page != "ATISDETAIL") { me["ATISArrows"].hide(); } + if (page == "STATUS") { + me["Simple_R5S"].setFont("HoneywellMCDU.ttf"); + me["Simple_R5S"].setFontSize(normal); + } else { + me["Simple_R5S"].setFont("HoneywellMCDUSmall.ttf"); + me["Simple_R5S"].setFontSize(small); + } + if (page == "IRSMON") { + me["Simple_R1S"].setFont("HoneywellMCDU.ttf"); + me["Simple_R1S"].setFontSize(normal); + me["Simple_R2S"].setFont("HoneywellMCDU.ttf"); + me["Simple_R2S"].setFontSize(normal); + me["Simple_R3S"].setFont("HoneywellMCDU.ttf"); + me["Simple_R3S"].setFontSize(normal); + } else { + me["Simple_R1S"].setFont("HoneywellMCDUSmall.ttf"); + me["Simple_R1S"].setFontSize(small); + me["Simple_R2S"].setFont("HoneywellMCDUSmall.ttf"); + me["Simple_R2S"].setFontSize(small); + me["Simple_R3S"].setFont("HoneywellMCDUSmall.ttf"); + me["Simple_R3S"].setFontSize(small); + } + if (page != "POSMON") { + me["Simple_Title"].setFontSize(normal); + me["Simple_Title2"].setFontSize(normal); + } + if (page == "F-PLNA" or page == "F-PLNB") { if (!pageSwitch[i].getBoolValue()) { me["Simple"].show(); @@ -1989,7 +2016,7 @@ var canvas_MCDU_base = { me["arrowsDepArr"].show(); me["arrow1L"].hide(); me["arrow2L"].hide(); - me["arrow3L"].hide(); + me["arrow3L"].show(); me["arrow4L"].hide(); me["arrow5L"].hide(); me["arrow1R"].hide(); @@ -2007,15 +2034,15 @@ var canvas_MCDU_base = { showLeft(me,1, 1, 1, -1, -1, 1); me["Simple_L0S"].hide(); showLeftS(me,1, 1, 1, -1, -1, 1); - showLeftArrow(me,-1, -1, 1, -1, -1, -1); + showLeftArrow(me,-1, -1, -1, -1, -1, -1); showRight(me,-1, 1, -1, 1, 1, 1); showRightS(me,-1, -1, -1, 1, 1, 1); showRightArrow(me,-1, -1, -1, -1, -1, 1); me["Simple_C3B"].hide(); me["Simple_C4B"].hide(); - me.fontSizeLeft(normal, normal, normal, normal, small, normal); - me.fontSizeRight(normal, normal, normal, small, normal, normal); + me.fontSizeLeft(normal, normal, small, normal, normal, small); + me.fontSizeRight(normal, normal, normal, normal, normal, normal); me.colorLeft("grn", "blu", "blu", "wht", "blu", "grn"); me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); @@ -2027,7 +2054,7 @@ var canvas_MCDU_base = { if (fmgc.FMGCInternal.phase == 0 or fmgc.FMGCInternal.phase == 7) { # only on preflight and done phases me["Simple_L5S"].setText("CHG CODE"); me["Simple_L5S"].show(); - me["Simple_L5"].setText("[ ]"); + me["Simple_L5"].setText("[ ]"); me["Simple_L5"].show(); } @@ -2038,8 +2065,9 @@ var canvas_MCDU_base = { me["Simple_L6S"].setText("IDLE/PERF"); me["Simple_R6"].setText("STATUS/XLOAD "); me["Simple_R6S"].setText("SOFTWARE "); - me["Simple_R4S"].setText("PILOT STORED "); + me["Simple_R4S"].setText("PILOT STORED "); me["Simple_R4"].setText("00RTES 00RWYS "); + me["arrow3L"].setColor(BLUE); pageSwitch[i].setBoolValue(1); } @@ -2231,7 +2259,7 @@ var canvas_MCDU_base = { showRightArrow(me,-1, -1, -1, -1, -1, 1); me.standardFontSize(); - + me.fontSizeLeft(small, small, small, small, small, normal); me.colorLeft("wht", "wht", "wht", "wht", "grn", "blu"); me.colorLeftS("wht", "wht", "wht", "wht", "wht", "wht"); me.colorLeftArrow("wht", "wht", "wht", "wht", "wht", "blu"); @@ -2254,6 +2282,8 @@ var canvas_MCDU_base = { if (pageFreezed[i] == nil) { me["Simple_Title"].setText("POSITION MONITOR"); + me["Simple_Title"].setFontSize(normal); + me["Simple_Title2"].setFontSize(normal); me["Simple_Title2"].hide(); me["Simple_L6"].setText(" FREEZE"); @@ -2273,7 +2303,7 @@ var canvas_MCDU_base = { if (systems.ADIRS.Operating.aligned[0].getValue()) { # TODO real FMGC1 GPS data me["Simple_R1"].setText(latlog); me["Simple_R1"].setColor(GREEN); - me["Simple_L2S"].setText(sprintf("%16s","3IRS/GPS")); + me["Simple_L2S"].setText(sprintf(" %16s","3IRS/GPS")); } else { me["Simple_R1"].setText("----.--/-----.--"); me["Simple_R1"].setColor(WHITE); @@ -2283,7 +2313,7 @@ var canvas_MCDU_base = { if (systems.ADIRS.Operating.aligned[1].getValue()) { # TODO real FMGC2 GPS data me["Simple_R2"].setText(latlog); me["Simple_R2"].setColor(GREEN); - me["Simple_L3S"].setText(sprintf("%16s","3IRS/GPS")); + me["Simple_L3S"].setText(sprintf(" %16s","3IRS/GPS")); } else { me["Simple_R2"].setText("----.--/-----.--"); me["Simple_R2"].setColor(WHITE); @@ -2306,7 +2336,7 @@ var canvas_MCDU_base = { for ( var a=0; a<3; a+=1 ) { if (systems.ADIRS.Operating.aligned[a].getValue()) { - me[Simple_row5[a]].setText(sprintf("%-8s",(systems.ADIRS.ADIRunits[a].mode == 2) ? "ATT" : "NAV 0.0")); + me[Simple_row5[a]].setText(sprintf("%-8s",(systems.ADIRS.ADIRunits[a].mode == 2) ? "ATT" : "NAV 0.1")); } else { me[Simple_row5[a]].setText(sprintf("%-8s",me.getIRSStatus(a))); } @@ -2315,8 +2345,10 @@ var canvas_MCDU_base = { } else { me["Simple_Title"].setText("POSITION FROZEN AT "); + me["Simple_Title"].setFontSize(small); me["Simple_Title2"].setText(sprintf("%23s ",pageFreezed[i])); me["Simple_Title2"].show(); + me["Simple_Title2"].setFontSize(small); me["Simple_L6"].setText(" UNFREEZE"); } @@ -2330,7 +2362,12 @@ var canvas_MCDU_base = { if (!pageSwitch[i].getBoolValue()) { me.defaultHideWithCenter(); - me.standardFontSize(); + me.fontSizeLeft(normal, normal, normal, normal, normal, normal); + me.fontSizeLeftS(0, 0, 0, small, small, small); + me.fontSizeRight(normal, normal, normal, normal, normal, normal); + me.fontSizeRightS(small, small, small, small, small, small); + me.fontSizeCenter(normal, normal, normal, normal, normal, normal); + me.fontSizeCenterS(small, small, small, small, small, small); me.defaultPageNumbers(); @@ -2376,7 +2413,7 @@ var canvas_MCDU_base = { var rows = ["Simple_L2S","Simple_L3S","Simple_L4S"]; var center = ["Simple_C1","Simple_C2","Simple_C3"]; for (var a = 0; a<3; a+=1) { - me[rows[a]].setText(" " ~ me.getIRSStatus(a,1)); + me[rows[a]].setText(me.getIRSStatus(a,1)); if (systems.ADIRS.ADIRunits[a]._excessMotion) { me[center[a]].show(); } else { @@ -2385,8 +2422,8 @@ var canvas_MCDU_base = { } if (fmgc.FMGCInternal.phase == 7) { # DONE phase - if (fmgc.FMGCInternal.arrApt != nil and fmgc.flightPlanController.flightplans[2].departure_runway != nil) { - me["Simple_R1S"].setText(sprintf("DRIFT AT %7s ",fmgc.FMGCInternal.arrApt ~ fmgc.flightPlanController.flightplans[2].departure_runway.id)); + if (fmgc.FMGCInternal.arrApt != nil and fmgc.flightPlanController.flightplans[2].destination_runway != nil) { + me["Simple_R1S"].setText(sprintf("DRIFT AT %7s ",fmgc.FMGCInternal.arrApt ~ fmgc.flightPlanController.flightplans[2].destination_runway.id)); } me["Simple_R2S"].setText(sprintf("DRIFT %2.1fNM/H ",0)); me["Simple_R3S"].setText(sprintf("DRIFT %2.1fNM/H ",0)); @@ -2432,21 +2469,21 @@ var canvas_MCDU_base = { me["Simple_L1S"].setText("GPS1 POSITION"); me["Simple_L2S"].setText("TTRK"); me["Simple_L3S"].setText("MERIT"); - me["Simple_L3"].setText(sprintf("%3d",((rand() * 50) - 25) + 50) ~ "M"); + me["Simple_L3"].setText(sprintf("%s",int(((rand() * 50) - 25) + 50)) ~ "M"); me["Simple_L4S"].setText("GPS2 POSITION"); me["Simple_L5S"].setText("TTRK"); me["Simple_L6S"].setText("MERIT"); - me["Simple_L6"].setText(sprintf("%3d",((rand() * 50) - 25) + 50) ~ "M"); + me["Simple_L6"].setText(sprintf("%s",int(((rand() * 50) - 25) + 50)) ~ "M"); me["Simple_C2S"].setText("UTC"); me["Simple_C3S"].setText("GPS ALT"); me["Simple_C5S"].setText("UTC"); me["Simple_C6S"].setText("GPS ALT"); me["Simple_R2S"].setText("GS"); me["Simple_R3S"].setText("MODE/SAT"); - me["Simple_R3"].setText("NAV/" ~ sprintf("%s",int((rand() * 2) - 1) + 6) ~ " "); + me["Simple_R3"].setText("NAV/" ~ sprintf("%s",int((rand() * 2) - 1) + 6) ~ " "); me["Simple_R5S"].setText("GS"); me["Simple_R6S"].setText("MODE/SAT"); - me["Simple_R6"].setText("NAV/" ~ sprintf("%s",int((rand() * 2) - 1) + 6) ~ " "); + me["Simple_R6"].setText("NAV/" ~ sprintf("%s",int((rand() * 2) - 1) + 6) ~ " "); pageSwitch[i].setBoolValue(1); } me["Simple_L1"].setText(me.getLatLogFormatted2("/position/")); diff --git a/Nasal/MCDU/CLOSESTAIRPORT.nas b/Nasal/MCDU/CLOSESTAIRPORT.nas index 9fedc938..a50781fe 100644 --- a/Nasal/MCDU/CLOSESTAIRPORT.nas +++ b/Nasal/MCDU/CLOSESTAIRPORT.nas @@ -39,7 +39,9 @@ var closestAirportPage = { me.title = "CLOSEST AIRPORTS"; me.C1[1] = " BRG DIST"; me.R1[1] = "UTC "; - me.L5 = ["[ ]", nil, "blu"]; + me.L5 = ["[ ]", nil, "blu"]; + me.C5 = [nil, nil, "grn"]; + me.R5 = [nil, nil, "grn"]; me.L6 = [" FREEZE", nil, "blu"]; me.R6 = ["EFOB/WIND ", nil, "wht"]; me.arrowsMatrix = [[0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 1]]; @@ -96,31 +98,29 @@ var closestAirportPage = { var magvarLocal = magvar(); if (size(me.airports) >= 1) { me.cdVector[0] = courseAndDistance(me.airports[0]); - me.C1 = [math.round(me.cdVector[0][0] - magvarLocal) ~ " " ~ math.round(me.cdVector[0][1]), " BRG DIST", "grn"]; + me.C1 = [sprintf("%03d",me.cdVector[0][0] - magvarLocal) ~ "° " ~ math.round(me.cdVector[0][1]), " BRG DIST", "grn"]; } if (size(me.airports) >= 2) { me.cdVector[1] = courseAndDistance(me.airports[1]); - me.C2 = [math.round(me.cdVector[1][0] - magvarLocal) ~ " " ~ math.round(me.cdVector[1][1]) , nil, "grn"]; + me.C2 = [sprintf("%03d",me.cdVector[1][0] - magvarLocal) ~ "° " ~ math.round(me.cdVector[1][1]) , nil, "grn"]; } if (size(me.airports) >= 3) { me.cdVector[2] = courseAndDistance(me.airports[2]); - me.C3 = [math.round(me.cdVector[2][0] - magvarLocal) ~ " " ~ math.round(me.cdVector[2][1]), nil, "grn"]; + me.C3 = [sprintf("%03d",me.cdVector[2][0] - magvarLocal) ~ "° " ~ math.round(me.cdVector[2][1]), nil, "grn"]; } if (size(me.airports) >= 4) { me.cdVector[3] = courseAndDistance(me.airports[3]); - me.C4 = [math.round(me.cdVector[3][0] - magvarLocal) ~ " " ~ math.round(me.cdVector[3][1]), nil, "grn"]; + me.C4 = [sprintf("%03d",me.cdVector[3][0] - magvarLocal) ~ "° " ~ math.round(me.cdVector[3][1]), nil, "grn"]; } if (me.manAirport != nil) { - me.C5 = [math.round(courseAndDistance(me.manAirport)[0] - magvarLocal) ~ " " ~ math.round(courseAndDistance(me.manAirport)[1]), nil, "grn"]; + me.C5 = [sprintf("%03d",courseAndDistance(me.manAirport)[0] - magvarLocal) ~ "° " ~ math.round(courseAndDistance(me.manAirport)[1]), nil, "grn"]; } canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); }, manAirportCall: func(id) { if (id == "CLR") { me.manAirport = nil; - me.L5 = [nil, nil, "grn"]; - me.C5 = [nil, nil, "grn"]; - me.R5 = [nil, nil, "grn"]; + me._setupPageWithData(); return; } if (size(id) > 4) { @@ -131,6 +131,7 @@ var closestAirportPage = { me.manAirport = airportinfo(id); me.L5 = [id, nil, "grn"]; me.R5 = ["----", nil, "grn"]; + mcdu_scratchpad.scratchpads[i].empty(); } canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); } diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index d28566ef..e3531552 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -522,7 +522,7 @@ var lskbutton = func(btn, i) { } else if (page == "PERFAPPR") { perfAPPRInput("L3",i); } else if (page == "STATUS") { - statusInput("L3",i); + fmgc.switchDatabase(); } else if (page == "RADNAV") { radnavInput("L3",i); } else if (page == "DATA") { @@ -786,7 +786,6 @@ var lskbutton = func(btn, i) { canvas_mcdu.myDuplicate[i].pushButtonLeft(5); } else if (page == "CLOSESTAIRPORT") { canvas_mcdu.myClosestAirport[i].manAirportCall(mcdu_scratchpad.scratchpads[i].scratchpad); - mcdu_scratchpad.scratchpads[i].empty(); } else if (page == "ATCMENU") { pageNode[i].setValue("NOTIFICATION"); } else if (page == "FLTLOG") { @@ -1171,7 +1170,16 @@ var rskbutton = func(btn, i) { } pageNode[i].setValue("WINDDES"); } else if (page == "STATUS") { - statusInput("R5",i); + if (fmgc.WaypointDatabase.getCount() >= 1) { + if (fmgc.WaypointDatabase.confirm[i]) { + fmgc.WaypointDatabase.delete(i); + fmgc.WaypointDatabase.confirm[i] = 0; + } else { + fmgc.WaypointDatabase.confirm[i] = 1; + } + } else { + mcdu_message(i, "NOT ALLOWED"); + } } else if (page == "PERFTO") { perfTOInput("R5",i); } else if (page == "PERFAPPR") { diff --git a/Nasal/MCDU/STATUS.nas b/Nasal/MCDU/STATUS.nas deleted file mode 100644 index 754cac62..00000000 --- a/Nasal/MCDU/STATUS.nas +++ /dev/null @@ -1,16 +0,0 @@ -# A3XX mCDU by Joshua Davidson (Octal450), Jonathan Redpath, and Matthew Maring (mattmaring) - -# Copyright (c) 2020 Josh Davidson (Octal450) - -var statusInput = func(key, i) { - if (key == "L3") { - fmgc.switchDatabase(); - } elsif (key == "R5") { - if (fmgc.WaypointDatabase.confirm[i]) { - fmgc.WaypointDatabase.delete(i); - fmgc.WaypointDatabase.confirm[i] = 0; - } else { - fmgc.WaypointDatabase.confirm[i] = 1; - } - } -}