From ed66593c1b669ae6b6bcee27f4adefb742ba8b9c Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sun, 14 Jun 2020 18:30:58 +0100 Subject: [PATCH] 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"];