From 9a56678e947c9878036cb0ff58b347f7bcaf0bc1 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Wed, 17 Jun 2020 10:38:21 +0100 Subject: [PATCH 01/13] 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 02/13] 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 03/13] 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 04/13] 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 05/13] 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** From 46ab42be56b03c0f887acf022075d0056183ccb9 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Fri, 26 Jun 2020 17:11:27 -0400 Subject: [PATCH 06/13] Improvements to ZFW/ZFWCG (correct order, add constraints, check decimal size) --- Models/Instruments/MCDU/MCDU.nas | 62 +- Models/Instruments/MCDU/res/mcdu.svg | 4428 +++++++++++++------------- Nasal/MCDU/FUELPRED.nas | 85 +- Nasal/MCDU/INITB.nas | 72 +- Nasal/MCDU/MCDU.nas | 4 +- 5 files changed, 2336 insertions(+), 2315 deletions(-) diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index fccf7832..9c668347 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -294,8 +294,8 @@ var canvas_MCDU_base = { "Simple_R6","Simple_R1S","Simple_R2S","Simple_R3S","Simple_R4S","Simple_R5S","Simple_R6S","Simple_R1_Arrow","Simple_R2_Arrow","Simple_R3_Arrow", "Simple_R4_Arrow","Simple_R5_Arrow","Simple_R6_Arrow","Simple_C1","Simple_C2","Simple_C3","Simple_C3B","Simple_C4","Simple_C4B","Simple_C5","Simple_C6","Simple_C1S", "Simple_C2S","Simple_C3S","Simple_C4S","Simple_C5S","Simple_C6S","INITA","INITA_CoRoute","INITA_FltNbr","INITA_CostIndex","INITA_CruiseFLTemp", - "INITA_FromTo","INITA_InitRequest","INITA_AlignIRS","INITB","INITB_ZFWCG","INITB_ZFW","INITB_ZFW_S","INITB_Block","FUELPRED","FUELPRED_ZFW", - "FUELPRED_ZFWCG","FUELPRED_ZFW_S","PROG","PROG_UPDATE","PERFTO","PERFTO_V1","PERFTO_VR","PERFTO_V2","PERFTO_FE","PERFTO_SE","PERFTO_OE","PERFAPPR", + "INITA_FromTo","INITA_InitRequest","INITA_AlignIRS","INITB","INITB_ZFWCG","INITB_ZFW","INITB_ZFWCG_S","INITB_Block","FUELPRED","FUELPRED_ZFW", + "FUELPRED_ZFWCG","FUELPRED_ZFWCG_S","PROG","PROG_UPDATE","PERFTO","PERFTO_V1","PERFTO_VR","PERFTO_V2","PERFTO_FE","PERFTO_SE","PERFTO_OE","PERFAPPR", "PERFAPPR_FE","PERFAPPR_SE","PERFAPPR_OE","PERFAPPR_LDG_3","PERFAPPR_LDG_F","PERFGA","PERFGA_FE","PERFGA_SE","PERFGA_OE","FPLN","FPLN_From", "FPLN_TMPY_group","FPLN_FROM","FPLN_Callsign","departureTMPY", "arrowsDepArr","arrow1L","arrow2L","arrow3L","arrow4L","arrow5L","arrow1R","arrow2R", "arrow3R","arrow4R","arrow5R","DIRTO_TMPY_group","IRSINIT","IRSINIT_1","IRSINIT_2","IRSINIT_star"]; @@ -1483,7 +1483,7 @@ var canvas_MCDU_base = { me.fontRightS(default, default, default, default, default, default); me.fontSizeLeft(small, small, small, small, small, small); - me.fontSizeCenter(small, small, small, small, small, small); + me.fontSizeCenter(normal, small, small, small, small, small); me.fontSizeRight(normal, normal, normal, small, small, small); me["Simple_C4B"].setFontSize(small); @@ -1754,28 +1754,30 @@ var canvas_MCDU_base = { } } - me["Simple_R1S"].setText("ZFWCG/ ZFW"); - me["Simple_R1"].setText(sprintf("%3.1f", zfw.getValue())); + me["Simple_R1S"].setText("ZFW/ZFWCG"); + me["Simple_R1"].setText(sprintf("%3.1f", zfwcg.getValue())); + me["INITB_ZFWCG"].hide(); + me["INITB_ZFWCG_S"].show(); + me["Simple_R1"].show(); if (zfwcgSet.getValue() == 1) { - me["Simple_C1"].setFontSize(normal); - me["Simple_C1"].setText(" " ~ sprintf("%3.1f", zfwcg.getValue())); - me["INITB_ZFWCG"].hide(); + me["Simple_R1"].setFontSize(normal); } else { - me["Simple_C1"].setFontSize(small); - me["Simple_C1"].setText(" " ~ sprintf("%3.1f", zfwcg.getValue())); - me["INITB_ZFWCG"].hide(); + me["Simple_R1"].setFontSize(small); } if (zfwSet.getValue() == 1) { + if (zfw.getValue() < 100) { + me["Simple_C1"].setText(" " ~ sprintf("%3.1f", zfw.getValue())); + } else { + me["Simple_C1"].setText(" " ~ sprintf("%3.1f", zfw.getValue())); + } + me["Simple_C1"].show(); me["INITB_ZFW"].hide(); - me["INITB_ZFW_S"].show(); - me["Simple_R1"].show(); } else { + me["Simple_C1"].hide(); me["INITB_ZFW"].show(); - me["INITB_ZFW_S"].hide(); - me["Simple_R1"].hide(); } - + if (taxi_fuel_set.getValue() == 1) { me["Simple_L1"].setFontSize(normal); } else { @@ -1860,7 +1862,7 @@ var canvas_MCDU_base = { me.fontRightS(default, default, default, default, default, default); me.fontSizeLeft(normal, normal, small, small, small, small); - me.fontSizeCenter(small, small, small, small, small, small); + me.fontSizeCenter(small, small, normal, small, small, small); me.fontSizeRight(normal, normal, normal, small, small, small); me["Simple_C3B"].setFontSize(small); @@ -2026,26 +2028,28 @@ var canvas_MCDU_base = { me.colorRight("ack", "ack", "blu", "grn", "grn", "grn"); } - me["Simple_R3S"].setText("ZFWCG/ZFW"); - me["Simple_R3"].setText(sprintf("%3.1f", zfw.getValue())); + me["Simple_R3S"].setText("ZFW/ZFWCG"); + me["Simple_R3"].setText(sprintf("%3.1f", zfwcg.getValue())); + me["Simple_R3"].show(); + me["FUELPRED_ZFWCG"].hide(); + me["FUELPRED_ZFWCG_S"].show(); if (zfwcgSet.getValue() == 1) { - me["Simple_C3"].setFontSize(normal); - me["Simple_C3"].setText(" " ~ sprintf("%3.1f", zfwcg.getValue())); - me["FUELPRED_ZFWCG"].hide(); + me["Simple_R3"].setFontSize(normal); } else { - me["Simple_C3"].setFontSize(small); - me["Simple_C3"].setText(" " ~ sprintf("%3.1f", zfwcg.getValue())); - me["FUELPRED_ZFWCG"].hide(); + me["Simple_R3"].setFontSize(small); } if (zfwSet.getValue() == 1) { + if (zfw.getValue() < 100) { + me["Simple_C3"].setText(" " ~ sprintf("%3.1f", zfw.getValue())); + } else { + me["Simple_C3"].setText(" " ~ sprintf("%3.1f", zfw.getValue())); + } + me["Simple_C3"].show(); me["FUELPRED_ZFW"].hide(); - me["FUELPRED_ZFW_S"].show(); - me["Simple_R3"].show(); } else { + me["Simple_C3"].hide(); me["FUELPRED_ZFW"].show(); - me["FUELPRED_ZFW_S"].hide(); - me["Simple_R3"].hide(); } if (rte_rsv_set.getValue() == 1) { diff --git a/Models/Instruments/MCDU/res/mcdu.svg b/Models/Instruments/MCDU/res/mcdu.svg index 35f4ac4f..a2659979 100644 --- a/Models/Instruments/MCDU/res/mcdu.svg +++ b/Models/Instruments/MCDU/res/mcdu.svg @@ -7,13 +7,13 @@ xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - sodipodi:docname="mcdu.svg" - inkscape:version="1.0beta2 (2b71d25, 2019-12-03)" - id="svg2" - version="1.1" - viewBox="0 0 1024 864" + width="1280" height="1080" - width="1280"> + viewBox="0 0 1024 864" + version="1.1" + id="svg2" + inkscape:version="1.0beta2 (2b71d25, 2019-12-03)" + sodipodi:docname="mcdu.svg"> @@ -29,749 +29,656 @@ + borderopacity="1" + objecttolerance="20" + gridtolerance="20" + guidetolerance="20" + inkscape:pageopacity="1" + inkscape:pageshadow="2" + inkscape:window-width="1920" + inkscape:window-height="1035" + id="namedview371" + showgrid="true" + inkscape:zoom="1.1488097" + inkscape:cx="846.91312" + inkscape:cy="326.27773" + inkscape:window-x="0" + inkscape:window-y="23" + inkscape:window-maximized="0" + inkscape:current-layer="FUELPRED" + showguides="false" + inkscape:snap-global="false" + units="px" + inkscape:document-rotation="0"> + type="xygrid" + id="grid5153" /> SCRATCHPAD + x="20.138426" + id="tspan4242" + sodipodi:role="line">SCRATCHPAD + transform="translate(-1.2,-0.2)"> - - - - - + + + + + + inkscape:label="Simple"> + inkscape:label="Simple_Center"> TEXT + x="521.1662" + y="187.10254" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:70px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1">TEXT TEXT + x="521.1662" + id="tspan4243" + sodipodi:role="line">TEXT TEXT - TEXT TEXT TEXT TEXT + TEXT + x="520.20905" + id="tspan4266" + sodipodi:role="line">TEXT TEXT + x="520.20905" + y="247.74202" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:56px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1">TEXT TEXT + x="520.20905" + id="tspan4274" + sodipodi:role="line">TEXT TEXT - TEXT TEXT TEXT + id="tspan4286" + x="520.20905" + y="717.159" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:56px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1">TEXT TEXT + TEXT TITLE + x="521.74713" + y="69.238266" + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:70px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1">TITLE X/X + id="tspan4217" + sodipodi:role="line">X/X + cy="15.471865" + r="1.5" /> + cy="15.754708" + r="1.5" /> + cy="16.320395" + r="1.5" /> + cx="796.48511" + cy="13.774809" + r="3" /> TEXT - - - - - TEXT - - - - - TEXT - - - - - TEXT - - - - - TEXT - - - - - TEXT - - - - - TEXT - TEXT - TEXT - TEXT - TEXT - TEXT - TEXT + id="Simple_L1_Arrow" + style="fill:#ffffff;fill-opacity:1"> TEXT + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:70px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:start;text-anchor:start;fill:#ffffff;fill-opacity:1">TEXT + transform="matrix(1.0000018,0,0,0.99998906,-895.98862,236.8439)" + style="fill:#ffffff;fill-opacity:1"> TEXT + id="Simple_L3_Arrow" + style="fill:#ffffff;fill-opacity:1"> TEXT + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:70px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:start;text-anchor:start;fill:#ffffff;fill-opacity:1">TEXT + transform="matrix(1.0000018,0,0,0.99998906,-895.98862,473.56068)" + style="fill:#ffffff;fill-opacity:1"> TEXT + + + + + TEXT + + + + + TEXT + TEXT + TEXT + TEXT + TEXT + TEXT + TEXT + + + + + TEXT + id="Simple_R2_Arrow" + style="fill:#ffffff;fill-opacity:1"> @@ -779,1534 +686,1024 @@ xml:space="preserve" style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;text-align:start;letter-spacing:0px;word-spacing:0px;text-anchor:start;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" x="1022.194" - y="773.87396" - id="Simple_R6" + y="421.81125" + id="Simple_R3" transform="scale(0.991516,1.0085566)" inkscape:label="#text4244">TEXT + transform="matrix(-1.000002,0,0,0.99998904,1919.9892,355.20231)" + style="fill:#ffffff;fill-opacity:1"> - TEXT TEXT - TEXT - TEXT - TEXT - TEXT - TEXT - - - - - - - - - - - - - CALLSIG - - TMPY - - ERASE - TMPY - - - - - - - - TMPY - INSERT - - - - - - - - - FROM - - - - ERASE - DIR TO - - - - - - - - DIR TO - INSERT - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + id="Simple_R4_Arrow" + style="fill:#ffffff;fill-opacity:1"> + style="fill:#ffffff;fill-opacity:1;stroke:#cdcdcd;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + TEXT + id="Simple_R5_Arrow" + inkscape:label="#g4241" + transform="matrix(-1.000002,0,0,0.99998904,1919.9892,591.91912)" + style="fill:#ffffff;fill-opacity:1"> - + id="path4319" + d="M 936.70791,62.1688 921.8587,47.4328" + style="fill:#ffffff;fill-opacity:1;stroke:#cdcdcd;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + + TEXT + + id="path4327" + d="M 936.70791,32.6968 921.8587,47.4328" + style="fill:#ffffff;fill-opacity:1;stroke:#cdcdcd;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + + + TEXT + TEXT + TEXT + TEXT + TEXT + TEXT + TEXT + + + + + + + + + inkscape:label="INITA" + id="INITA-9" + style="display:inline" /> + + + / + style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:56px;line-height:1.25;font-family:BoeingCDULarge;-inkscape-font-specification:BoeingCDULarge;text-align:center;text-anchor:middle;fill:#ffffff;fill-opacity:1" + y="69.238258" + x="750.78857" + id="tspan4388" + sodipodi:role="line">CALLSIG - - - - + id="FPLN_TMPY_group" + inkscape:label="#g3767"> + TMPY + + ERASE + TMPY + + + + + + + + TMPY + INSERT + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - / + id="FPLN_FROM" + y="68.861366" + x="177.72771" + style="font-style:normal;font-weight:normal;line-height:0%;font-family:sans-serif;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#ffff00;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" + xml:space="preserve">FROM + + + + ERASE + DIR TO + + + + + + + + DIR TO + INSERT + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + inkscape:groupmode="layer" + id="INITA" + inkscape:label="INITA"> - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - / - . - / - - - - - - - - - - - - - . - - - . - - - - - - - - - / - - . - / - - - - - - - - - - - - - . - - - - + id="path4490" + d="M 998.71909,284.70793 H 970.18944" + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + style="fill:none;stroke:#bb6100;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + + / + + + + + + + + + + + + + + + + + + + + + + + + + + id="INITA_FltNbr" + transform="translate(-833.84951,236.71687)"> + + id="rect4377" + style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#bb6100;stroke-width:4.03199;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> + id="rect4381" + style="fill:none;fill-opacity:1;fill-rule:nonzero;stroke:#bb6100;stroke-width:4.03199;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;paint-order:fill markers stroke" /> + + + + + + + + + + + + + + + + + + / + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + / + + . + / + + + + + + + + + + + + + . + + + . + + + + + + + + + / + + . + / + + + + + + + + + + + + + . + + + + + + + + + + + id="PERFTO_VR" + transform="translate(-833.84951,118.3616)"> - F + + + + + F + S + S - O - = + x="398.21817" + id="tspan4399" + sodipodi:role="line">O = = + = - F + inkscape:label="PERFAPPR"> F + S + S - O - = + x="398.21817" + id="tspan1085" + sodipodi:role="line">O = = + = + + + + + + - - - - - - + inkscape:connector-curvature="0" + sodipodi:nodetypes="cc" /> - - - - - - - - + - + style="fill:none;stroke:#179ab7;stroke-width:4.08;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" /> + + + + + + + + - F + inkscape:label="PERFGA"> F + S + S - O - = + x="398.21817" + id="tspan1135" + sodipodi:role="line">O = = + = diff --git a/Nasal/MCDU/FUELPRED.nas b/Nasal/MCDU/FUELPRED.nas index 63000cf2..c71ea930 100644 --- a/Nasal/MCDU/FUELPRED.nas +++ b/Nasal/MCDU/FUELPRED.nas @@ -148,14 +148,14 @@ var fuelPredInput = func(key, i) { if (scratchpad == "CLR") { mcdu_message(i, "NOT ALLOWED"); } else { - if (!getprop("/FMGC/internal/cost-index-set")) { + if (!getprop("/FMGC/internal/cost-index-set") and getprop("/FMGC/internal/tofrom-set")) { mcdu_message(i, "USING COST INDEX N", getprop("/FMGC/internal/last-cost-index")); setprop("/FMGC/internal/cost-index-set", 1); setprop("/FMGC/internal/cost-index", getprop("/FMGC/internal/last-cost-index")); } - - var tfs = size(scratchpad); - if (tfs == 0) { + var zfw_min = 80.6; #make based on performance + var zfw_max = 137.8; #make based on performance + if (size(scratchpad) == 0) { var zfw = getprop("/fdm/jsbsim/inertia/weight-lbs") - getprop("/consumables/fuel/total-fuel-lbs"); setprop("/FMGC/internal/zfw", sprintf("%3.1f", math.round(zfw / 1000, 0.1))); setprop("/FMGC/internal/zfw-set", 1); @@ -167,26 +167,45 @@ var fuelPredInput = func(key, i) { setprop("/FMGC/internal/block-calculating", 0); setprop("/FMGC/internal/block-confirmed", 1); } - } else if (tfs >= 2 and tfs <= 11 and find("/", scratchpad) != -1) { + mcdu_scratchpad.scratchpads[i].empty(); + } else if (find("/", scratchpad) != -1) { var zfwi = split("/", scratchpad); - var zfwcg = num(zfwi[0]); - var zfw = num(zfwi[1]); - var zfwcgs = size(zfwi[0]); - var zfws = size(zfwi[1]); - if (zfwcg != nil and zfwcgs >= 1 and zfwcgs <= 5 and zfwcg > 0 and zfwcg <= 99.9) { - setprop("/FMGC/internal/zfwcg", zfwcg); - setprop("/FMGC/internal/zfwcg-set", 1); - if (getprop("/FMGC/internal/block-set") != 1) { - setprop("/FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000)); - setprop("/FMGC/internal/block-set", 1); - setprop("/FMGC/internal/fuel-request-set", 1); - setprop("/FMGC/internal/fuel-calculating", 1); - setprop("/FMGC/internal/block-calculating", 0); - setprop("/FMGC/internal/block-confirmed", 1); + var zfw = num(zfwi[0]); + var zfwcg = num(zfwi[1]); + var zfws = size(zfwi[0]); + var zfwcgs = size(zfwi[1]); + if (zfw != nil and zfws > 0 and zfws <= 5 and size(split(".", zfwi[0])[1]) <= 1 and zfwcg != nil and zfwcgs > 0 and zfwcgs <= 4 and size(split(".", zfwi[1])[1]) <= 1) { + if (zfw >= zfw_min and zfw <= zfw_max and zfwcg >= 8.0 and zfwcg <= 45.0) { + setprop("/FMGC/internal/zfw", zfw); + setprop("/FMGC/internal/zfw-set", 1); + setprop("/FMGC/internal/zfwcg", zfwcg); + setprop("/FMGC/internal/zfwcg-set", 1); + if (getprop("/FMGC/internal/block-set") != 1) { + setprop("/FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000)); + setprop("/FMGC/internal/block-set", 1); + setprop("/FMGC/internal/fuel-request-set", 1); + setprop("/FMGC/internal/fuel-calculating", 1); + setprop("/FMGC/internal/block-calculating", 0); + setprop("/FMGC/internal/block-confirmed", 1); + } + mcdu_scratchpad.scratchpads[i].empty(); + } else { + mcdu_message(i, "ENTRY OUT OF RANGE"); } + } else if (zfws == 0 and zfwcg != nil and zfwcgs > 0 and zfwcgs <= 4 and size(split(".", zfwi[1])[1]) <= 1) { + if (zfwcg >= 8.0 and zfwcg <= 45.0) { + setprop("/FMGC/internal/zfwcg", zfwcg); + setprop("/FMGC/internal/zfwcg-set", 1); + mcdu_scratchpad.scratchpads[i].empty(); + } else { + mcdu_message(i, "ENTRY OUT OF RANGE"); + } + } else { + mcdu_message(i, "NOT ALLOWED"); } - if (zfw != nil and zfws >= 1 and zfws <= 5 and zfw > 0 and zfw <= 999.9) { - setprop("/FMGC/internal/zfw", zfw); + } else if (num(scratchpad) != nil and size(scratchpad) > 0 and size(scratchpad) <= 5 and size(split(".", scratchpad)[1]) <= 1) { + if (scratchpad >= zfw_min and scratchpad <= zfw_max) { + setprop("/FMGC/internal/zfw", scratchpad); setprop("/FMGC/internal/zfw-set", 1); if (getprop("/FMGC/internal/block-set") != 1) { setprop("/FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000)); @@ -196,31 +215,9 @@ var fuelPredInput = func(key, i) { setprop("/FMGC/internal/block-calculating", 0); setprop("/FMGC/internal/block-confirmed", 1); } - if (getprop("/FMGC/internal/block-confirmed")) { - setprop("/FMGC/internal/fuel-calculating", 1); - } - } - if ((zfwcg != nil and zfwcgs >= 1 and zfwcgs <= 5 and zfwcg > 0 and zfwcg <= 99.9) or (zfw != nil and zfws >= 1 and zfws <= 5 and zfw > 0 and zfw <= 999.9)) { mcdu_scratchpad.scratchpads[i].empty(); } else { - mcdu_message(i, "NOT ALLOWED"); - } - } else if (tfs >= 1 and tfs <= 5) { - var zfwcg = size(scratchpad); - if (num(scratchpad) != nil and zfwcg >= 1 and zfwcg <= 5 and scratchpad > 0 and scratchpad <= 99.9) { - setprop("/FMGC/internal/zfwcg", scratchpad); - setprop("/FMGC/internal/zfwcg-set", 1); - if (getprop("/FMGC/internal/block-set") != 1) { - setprop("/FMGC/internal/block", num(getprop("consumables/fuel/total-fuel-lbs") / 1000)); - setprop("/FMGC/internal/block-set", 1); - setprop("/FMGC/internal/fuel-request-set", 1); - setprop("/FMGC/internal/fuel-calculating", 1); - setprop("/FMGC/internal/block-calculating", 0); - setprop("/FMGC/internal/block-confirmed", 1); - } - mcdu_scratchpad.scratchpads[i].empty(); - } else { - mcdu_message(i, "NOT ALLOWED"); + mcdu_message(i, "ENTRY OUT OF RANGE"); } } else { mcdu_message(i, "NOT ALLOWED"); diff --git a/Nasal/MCDU/INITB.nas b/Nasal/MCDU/INITB.nas index 0dd306f0..1195e122 100644 --- a/Nasal/MCDU/INITB.nas +++ b/Nasal/MCDU/INITB.nas @@ -148,14 +148,14 @@ var initInputB = func(key, i) { if (scratchpad == "CLR") { mcdu_message(i, "NOT ALLOWED"); } else { - if (!getprop("/FMGC/internal/cost-index-set")) { + if (!getprop("/FMGC/internal/cost-index-set") and getprop("/FMGC/internal/tofrom-set")) { mcdu_message(i, "USING COST INDEX N", getprop("/FMGC/internal/last-cost-index")); setprop("/FMGC/internal/cost-index-set", 1); setprop("/FMGC/internal/cost-index", getprop("/FMGC/internal/last-cost-index")); } - - var tfs = size(scratchpad); - if (tfs == 0) { + var zfw_min = 80.6; #make based on performance + var zfw_max = 137.8; #make based on performance + if (size(scratchpad) == 0) { var zfw = getprop("/fdm/jsbsim/inertia/weight-lbs") - getprop("/consumables/fuel/total-fuel-lbs"); setprop("/FMGC/internal/zfw", sprintf("%3.1f", math.round(zfw / 1000, 0.1))); setprop("/FMGC/internal/zfw-set", 1); @@ -171,18 +171,49 @@ var initInputB = func(key, i) { } else if (getprop("/FMGC/internal/fuel-request-set")) { setprop("/FMGC/internal/block-calculating", 1); } - } else if (tfs >= 2 and tfs <= 11 and find("/", scratchpad) != -1) { + mcdu_scratchpad.scratchpads[i].empty(); + } else if (find("/", scratchpad) != -1) { var zfwi = split("/", scratchpad); - var zfwcg = num(zfwi[0]); - var zfw = num(zfwi[1]); - var zfwcgs = size(zfwi[0]); - var zfws = size(zfwi[1]); - if (zfwcg != nil and zfwcgs >= 1 and zfwcgs <= 5 and zfwcg > 0 and zfwcg <= 99.9) { - setprop("/FMGC/internal/zfwcg", zfwi[0]); - setprop("/FMGC/internal/zfwcg-set", 1); + var zfw = num(zfwi[0]); + var zfwcg = num(zfwi[1]); + var zfws = size(zfwi[0]); + var zfwcgs = size(zfwi[1]); + if (zfw != nil and zfws > 0 and zfws <= 5 and size(split(".", zfwi[0])[1]) <= 1 and zfwcg != nil and zfwcgs > 0 and zfwcgs <= 4 and size(split(".", zfwi[1])[1]) <= 1) { + if (zfw >= zfw_min and zfw <= zfw_max and zfwcg >= 8.0 and zfwcg <= 45.0) { + setprop("/FMGC/internal/zfw", zfw); + setprop("/FMGC/internal/zfw-set", 1); + setprop("/FMGC/internal/zfwcg", zfwcg); + setprop("/FMGC/internal/zfwcg-set", 1); + if (!getprop("/FMGC/internal/block-confirmed") and getprop("/FMGC/internal/block-set")) { + setprop("/FMGC/internal/tow", num(getprop("/FMGC/internal/zfw") + getprop("/FMGC/internal/block") - getprop("/FMGC/internal/taxi-fuel"))); + setprop("/FMGC/internal/tow-set", 1); + setprop("/FMGC/internal/fuel-request-set", 1); + setprop("/FMGC/internal/fuel-calculating", 1); + setprop("/FMGC/internal/block-calculating", 0); + setprop("/FMGC/internal/block-confirmed", 1); + } else if (getprop("/FMGC/internal/block-confirmed")) { + setprop("/FMGC/internal/fuel-calculating", 1); + } else if (getprop("/FMGC/internal/fuel-request-set")) { + setprop("/FMGC/internal/block-calculating", 1); + } + mcdu_scratchpad.scratchpads[i].empty(); + } else { + mcdu_message(i, "ENTRY OUT OF RANGE"); + } + } else if (zfws == 0 and zfwcg != nil and zfwcgs > 0 and zfwcgs <= 4 and size(split(".", zfwi[1])[1]) <= 1) { + if (zfwcg >= 8.0 and zfwcg <= 45.0) { + setprop("/FMGC/internal/zfwcg", zfwcg); + setprop("/FMGC/internal/zfwcg-set", 1); + mcdu_scratchpad.scratchpads[i].empty(); + } else { + mcdu_message(i, "ENTRY OUT OF RANGE"); + } + } else { + mcdu_message(i, "NOT ALLOWED"); } - if (zfw != nil and zfws >= 1 and zfws <= 5 and zfw > 0 and zfw <= 999.9) { - setprop("/FMGC/internal/zfw", zfwi[1]); + } else if (num(scratchpad) != nil and size(scratchpad) > 0 and size(scratchpad) <= 5 and size(split(".", scratchpad)[1]) <= 1) { + if (scratchpad >= zfw_min and scratchpad <= zfw_max) { + setprop("/FMGC/internal/zfw", scratchpad); setprop("/FMGC/internal/zfw-set", 1); if (!getprop("/FMGC/internal/block-confirmed") and getprop("/FMGC/internal/block-set")) { setprop("/FMGC/internal/tow", num(getprop("/FMGC/internal/zfw") + getprop("/FMGC/internal/block") - getprop("/FMGC/internal/taxi-fuel"))); @@ -196,20 +227,9 @@ var initInputB = func(key, i) { } else if (getprop("/FMGC/internal/fuel-request-set")) { setprop("/FMGC/internal/block-calculating", 1); } - } - if ((zfwcg != nil and zfwcgs >= 1 and zfwcgs <= 5 and zfwcg > 0 and zfwcg <= 99.9) or (zfw != nil and zfws >= 1 and zfws <= 5 and zfw > 0 and zfw <= 999.9)) { mcdu_scratchpad.scratchpads[i].empty(); } else { - mcdu_message(i, "NOT ALLOWED"); - } - } else if (tfs >= 1 and tfs <= 5) { - var zfwcg = size(scratchpad); - if (num(scratchpad) != nil and zfwcg >= 1 and zfwcg <= 5 and scratchpad > 0 and scratchpad <= 99.9) { - setprop("/FMGC/internal/zfwcg", scratchpad); - setprop("/FMGC/internal/zfwcg-set", 1); - mcdu_scratchpad.scratchpads[i].empty(); - } else { - mcdu_message(i, "NOT ALLOWED"); + mcdu_message(i, "ENTRY OUT OF RANGE"); } } else { mcdu_message(i, "NOT ALLOWED"); diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 576b7a67..777f63ea 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -88,7 +88,7 @@ var MCDU_reset = func(i) { # INT-B setprop("/FMGC/internal/zfw", 0); setprop("/FMGC/internal/zfw-set", 0); - setprop("/FMGC/internal/zfwcg", 55.1); + setprop("/FMGC/internal/zfwcg", 25.0); setprop("/FMGC/internal/zfwcg-set", 0); setprop("/FMGC/internal/block", 0.0); setprop("/FMGC/internal/block-set", 0); @@ -168,7 +168,7 @@ var MCDU_reset = func(i) { 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/dest-wind-grnd", -1); setprop("/FMGC/internal/vapp-speed-set", 0); setprop("/FMGC/internal/final", ""); setprop("/FMGC/internal/baro", 99999); From 61d2d171fdb896f4a1fa81bb39402efb6065f186 Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Fri, 26 Jun 2020 17:35:48 -0400 Subject: [PATCH 07/13] Correct max ZFW to 61,000 kg --- Nasal/MCDU/FUELPRED.nas | 2 +- Nasal/MCDU/INITB.nas | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Nasal/MCDU/FUELPRED.nas b/Nasal/MCDU/FUELPRED.nas index c71ea930..9dbb490b 100644 --- a/Nasal/MCDU/FUELPRED.nas +++ b/Nasal/MCDU/FUELPRED.nas @@ -154,7 +154,7 @@ var fuelPredInput = func(key, i) { setprop("/FMGC/internal/cost-index", getprop("/FMGC/internal/last-cost-index")); } var zfw_min = 80.6; #make based on performance - var zfw_max = 137.8; #make based on performance + var zfw_max = 134.5; #61,000 kg, make based on performance if (size(scratchpad) == 0) { var zfw = getprop("/fdm/jsbsim/inertia/weight-lbs") - getprop("/consumables/fuel/total-fuel-lbs"); setprop("/FMGC/internal/zfw", sprintf("%3.1f", math.round(zfw / 1000, 0.1))); diff --git a/Nasal/MCDU/INITB.nas b/Nasal/MCDU/INITB.nas index 1195e122..b60063ab 100644 --- a/Nasal/MCDU/INITB.nas +++ b/Nasal/MCDU/INITB.nas @@ -154,7 +154,7 @@ var initInputB = func(key, i) { setprop("/FMGC/internal/cost-index", getprop("/FMGC/internal/last-cost-index")); } var zfw_min = 80.6; #make based on performance - var zfw_max = 137.8; #make based on performance + var zfw_max = 134.5; #61,000 kg, make based on performance if (size(scratchpad) == 0) { var zfw = getprop("/fdm/jsbsim/inertia/weight-lbs") - getprop("/consumables/fuel/total-fuel-lbs"); setprop("/FMGC/internal/zfw", sprintf("%3.1f", math.round(zfw / 1000, 0.1))); From 499786bb6ec1c9ae61615775bd867c87c1908bcc Mon Sep 17 00:00:00 2001 From: Matthew Maring <56924612+hayden2000@users.noreply.github.com> Date: Sat, 27 Jun 2020 07:11:53 -0400 Subject: [PATCH 08/13] Fix taxi fuel bug --- Nasal/MCDU/INITB.nas | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Nasal/MCDU/INITB.nas b/Nasal/MCDU/INITB.nas index b60063ab..5e44e127 100644 --- a/Nasal/MCDU/INITB.nas +++ b/Nasal/MCDU/INITB.nas @@ -20,9 +20,12 @@ var initInputB = func(key, i) { if (num(scratchpad) != nil and scratchpad >= 0.0 and scratchpad <= 9.9) { setprop("/FMGC/internal/taxi-fuel", scratchpad); setprop("/FMGC/internal/taxi-fuel-set", 1); - setprop("/FMGC/internal/fuel-calculating", 1); + if (getprop("/FMGC/internal/block-confirmed")) { + setprop("/FMGC/internal/fuel-calculating", 1); + } else if (getprop("/FMGC/internal/fuel-request-set")) { + setprop("/FMGC/internal/block-calculating", 1); + } mcdu_scratchpad.scratchpads[i].empty(); - fmgc.updateFuel(); } else { mcdu_message(i, "NOT ALLOWED"); } From 6cd65e9ac09516f5f9e170daecfe2aaecc54dd93 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sat, 27 Jun 2020 23:26:36 +0100 Subject: [PATCH 09/13] Several major bugfixes reported by @julienlengele - many thanks! --- Nasal/FMGC/flightplan.nas | 4 ++-- Nasal/FMGC/mcdu-messages.nas | 2 +- Nasal/MCDU/DIRTO.nas | 2 ++ Nasal/MCDU/FUELPRED.nas | 11 ++++++----- Nasal/MCDU/RADNAV.nas | 2 +- 5 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Nasal/FMGC/flightplan.nas b/Nasal/FMGC/flightplan.nas index 5e515566..a3909c1b 100644 --- a/Nasal/FMGC/flightplan.nas +++ b/Nasal/FMGC/flightplan.nas @@ -368,8 +368,8 @@ 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.flightplans[plan].insertWP(createWP(waypointGhost, waypointGhost.id), 2); + fmgc.windController.insertWind(plan, 2, 0, waypointGhost.id); 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. diff --git a/Nasal/FMGC/mcdu-messages.nas b/Nasal/FMGC/mcdu-messages.nas index 4b1a247f..b66c25a3 100644 --- a/Nasal/FMGC/mcdu-messages.nas +++ b/Nasal/FMGC/mcdu-messages.nas @@ -170,7 +170,7 @@ var MessageController = { TypeIMessage.new("LIST OF 20 IN USE"),TypeIMessage.new("PILOT ELEMENT RETAINED"),TypeIMessage.new("NOT ALLOWED"), TypeIMessage.new("NOT IN DATA BASE"),TypeIMessage.new("ONLY SPD ENTRY ALLOWED"),TypeIMessage.new("REVISION IN PROGRESS"), TypeIMessage.new("TMPY F-PLN EXISTS", 1),TypeIMessage.new("SELECT DESIRED SYSTEM"),TypeIMessage.new("SELECT HDG/TRK FIRST"), - TypeIMessage.new("USING COST INDEX N", 1),TypeIMessage.new("WAIT FOR SYSTEM RESPONSE"), + TypeIMessage.new("USING COST INDEX N", 1),TypeIMessage.new("WAIT FOR SYSTEM RESPONSE"),TypeIMessage.new("RWY/LS MISMATCH"), ]), typeIIMessages: std.Vector.new([ TypeIIMessage.new("LAT DISCONT AHEAD", "amb", 0),TypeIIMessage.new("MORE DRAG"),TypeIIMessage.new("RWY/LS MISMATCH", "amb", 0),TypeIIMessage.new("STEP DELETED"), diff --git a/Nasal/MCDU/DIRTO.nas b/Nasal/MCDU/DIRTO.nas index d557490b..a440bb20 100644 --- a/Nasal/MCDU/DIRTO.nas +++ b/Nasal/MCDU/DIRTO.nas @@ -254,6 +254,7 @@ var dirTo = { dirToFlag = 0; fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 0); me.L1 = [" [ ]", " WAYPOINT", "blu"]; + me.fontMatrix = [[1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0]]; me.R1 = ["---- --- ", "UTC DIST ", "wht"]; } else { mcdu_message(me.computer, "NOT ALLOWED"); @@ -264,6 +265,7 @@ var dirTo = { dirToFlag = 0; fmgc.flightPlanController.destroyTemporaryFlightPlan(me.computer, 1); me.L1 = [" [ ]", " WAYPOINT", "blu"]; + me.fontMatrix = [[1, 0, 0, 0, 0, 0], [0, 0, 0, 1, 1, 0]]; me.R1 = ["---- --- ", "UTC DIST ", "wht"]; setprop("MCDU[" ~ me.computer ~ "]/page", "F-PLNA"); # todo - remember horizontal srcoll of f-plna? } else { diff --git a/Nasal/MCDU/FUELPRED.nas b/Nasal/MCDU/FUELPRED.nas index 9dbb490b..5bceb179 100644 --- a/Nasal/MCDU/FUELPRED.nas +++ b/Nasal/MCDU/FUELPRED.nas @@ -148,11 +148,6 @@ var fuelPredInput = func(key, i) { if (scratchpad == "CLR") { mcdu_message(i, "NOT ALLOWED"); } else { - if (!getprop("/FMGC/internal/cost-index-set") and getprop("/FMGC/internal/tofrom-set")) { - mcdu_message(i, "USING COST INDEX N", getprop("/FMGC/internal/last-cost-index")); - setprop("/FMGC/internal/cost-index-set", 1); - setprop("/FMGC/internal/cost-index", getprop("/FMGC/internal/last-cost-index")); - } var zfw_min = 80.6; #make based on performance var zfw_max = 134.5; #61,000 kg, make based on performance if (size(scratchpad) == 0) { @@ -222,6 +217,12 @@ var fuelPredInput = func(key, i) { } else { mcdu_message(i, "NOT ALLOWED"); } + + if (!getprop("/FMGC/internal/cost-index-set") and getprop("/FMGC/internal/tofrom-set")) { + mcdu_message(i, "USING COST INDEX N", getprop("/FMGC/internal/last-cost-index")); + setprop("/FMGC/internal/cost-index-set", 1); + setprop("/FMGC/internal/cost-index", getprop("/FMGC/internal/last-cost-index")); + } } } else if (key == "R4") { if (scratchpad == "CLR") { diff --git a/Nasal/MCDU/RADNAV.nas b/Nasal/MCDU/RADNAV.nas index 03af4246..4e73a397 100644 --- a/Nasal/MCDU/RADNAV.nas +++ b/Nasal/MCDU/RADNAV.nas @@ -68,7 +68,7 @@ var radnavInput = func(key, i) { setprop("/FMGC/internal/ils1freq-set", 1); mcdu_scratchpad.scratchpads[i].empty(); if (num(getprop("/FMGC/internal/ils1freq-calculated")) != 0 and num(getprop("/FMGC/internal/ils1freq-calculated")) != num(getprop("instrumentation/nav[0]/frequencies/selected-mhz"))) { - genericMessage(i, "RWY/LS MISMATCH", "amb"); + mcdu_message(i, "RWY/LS MISMATCH"); } } else { mcdu_message(i, "NOT ALLOWED"); From 02f02162d07a54f606e37c09efbc043637ae3ae5 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Sun, 28 Jun 2020 12:59:46 +0100 Subject: [PATCH 10/13] Bugfix for ARRIVAL page --- Models/Instruments/MCDU/MCDU.nas | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Models/Instruments/MCDU/MCDU.nas b/Models/Instruments/MCDU/MCDU.nas index 9c668347..c479e57a 100644 --- a/Models/Instruments/MCDU/MCDU.nas +++ b/Models/Instruments/MCDU/MCDU.nas @@ -3772,6 +3772,7 @@ var canvas_MCDU_base = { me["ArrowRight"].show(); me["arrowsDepArr"].show(); me["Simple_L1_Arrow"].hide(); + me["Simple_L2_Arrow"].hide(); me["Simple_L3_Arrow"].hide(); me["Simple_L4_Arrow"].hide(); me["Simple_L5_Arrow"].hide(); @@ -3782,7 +3783,8 @@ var canvas_MCDU_base = { me["Simple_R4_Arrow"].hide(); me["Simple_R5_Arrow"].hide(); me["Simple_R6_Arrow"].hide(); - + me["arrow2L"].hide(); + me["arrow2R"].hide(); me["Simple_L0S"].hide(); me["Simple_C3B"].hide(); me["Simple_C4B"].hide(); From 032009a7071339a644d4f47990cc9b6fdf51dbff Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Mon, 29 Jun 2020 21:33:57 +0100 Subject: [PATCH 11/13] Bugfix for newer versions of fg --- Nasal/MCDU/ARRIVAL.nas | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Nasal/MCDU/ARRIVAL.nas b/Nasal/MCDU/ARRIVAL.nas index 1aee5abe..2e8dffa8 100644 --- a/Nasal/MCDU/ARRIVAL.nas +++ b/Nasal/MCDU/ARRIVAL.nas @@ -74,7 +74,7 @@ var arrivalPage = { if (fmgc.flightPlanController.flightplans[2].approach != nil) { me.selectedApproach = fmgc.flightPlanController.flightplans[2].approach; - if (getprop("/sim/version/flightgear") == "2020.2.0") { + if (getprop("/sim/version/flightgear") == "2020.2.0" or getprop("/sim/version/flightgear") == "2020.2.1" or getprop("/sim/version/flightgear") == "2020.3.0") { if (fmgc.flightPlanController.flightplans[2].approach_trans != nil) { me.selectedVIA = fmgc.flightPlanController.flightplans[2].approach_trans; } elsif (isNoVia[2] == 1) { @@ -98,7 +98,7 @@ var arrivalPage = { } else { if (fmgc.flightPlanController.flightplans[me.computer].approach != nil) { me.selectedApproach = fmgc.flightPlanController.flightplans[me.computer].approach; - if (getprop("/sim/version/flightgear") == "2020.2.0") { + if (getprop("/sim/version/flightgear") == "2020.2.0" or getprop("/sim/version/flightgear") == "2020.2.1" or getprop("/sim/version/flightgear") == "2020.3.0") { if (fmgc.flightPlanController.flightplans[me.computer].approach_trans != nil) { me.selectedVIA = fmgc.flightPlanController.flightplans[me.computer].approach_trans; } elsif (isNoVia[me.computer] == 1) { @@ -107,7 +107,7 @@ var arrivalPage = { } } elsif (fmgc.flightPlanController.flightplans[2].approach != nil) { me.selectedApproach = fmgc.flightPlanController.flightplans[2].approach; - if (getprop("/sim/version/flightgear") == "2020.2.0") { + if (getprop("/sim/version/flightgear") == "2020.2.0" or getprop("/sim/version/flightgear") == "2020.2.1" or getprop("/sim/version/flightgear") == "2020.3.0") { if (fmgc.flightPlanController.flightplans[2].approach_trans != nil) { me.selectedVIA = fmgc.flightPlanController.flightplans[2].approach_trans; } @@ -232,7 +232,7 @@ var arrivalPage = { }, updateActiveVIAs: func() { - if (getprop("/sim/version/flightgear") != "2020.2.0") { return; } + if (getprop("/sim/version/flightgear") != "2020.2.0" and getprop("/sim/version/flightgear") != "2020.2.1" and getprop("/sim/version/flightgear") != "2020.3.0") { return; } if (me.selectedVIA == "NO VIA") { if (!fmgc.flightPlanController.temporaryFlag[me.computer]) { @@ -503,7 +503,7 @@ var arrivalPage = { canvas_mcdu.pageSwitch[me.computer].setBoolValue(0); }, updateVIAs: func() { - if (getprop("/sim/version/flightgear") != "2020.2.0") { return; } + if (getprop("/sim/version/flightgear") != "2020.2.0" and getprop("/sim/version/flightgear") != "2020.2.1" and getprop("/sim/version/flightgear") != "2020.3.0") { return; } if (me.selectedApproach == nil or me.activePage != 2) { me.clearVias(); return; @@ -746,7 +746,7 @@ var arrivalPage = { }, arrPushbuttonLeft: func(index) { if (index == 2 and me.activePage == 1 and me.selectedApproach != nil) { - if (getprop("/sim/version/flightgear") != "2020.2.0") { return; } + if (getprop("/sim/version/flightgear") != "2020.2.0" and getprop("/sim/version/flightgear") != "2020.2.1" and getprop("/sim/version/flightgear") != "2020.3.0") { return; } me.oldPage = me.activePage; me.activePage = 2; me.updatePage(); From 7d5de4bad94d7825ce107702519cefbdb32adcf3 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Mon, 29 Jun 2020 22:17:19 +0100 Subject: [PATCH 12/13] Bugfix for save last cost index --- AircraftConfig/acconfig.nas | 2 +- Nasal/MCDU/FUELPRED.nas | 4 ++-- Nasal/MCDU/INITB.nas | 11 ++++++----- Nasal/MCDU/MCDU.nas | 1 - 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/AircraftConfig/acconfig.nas b/AircraftConfig/acconfig.nas index 331298f7..731ac13e 100644 --- a/AircraftConfig/acconfig.nas +++ b/AircraftConfig/acconfig.nas @@ -497,7 +497,7 @@ var taxi_b = func { if (pts.Instrumentation.Altimeter.std.getBoolValue()) { libraries.toggleSTD(); } - setprop("/instrumentation/altimeter[0]/setting-inhg", getprop("/environment/pressure-sea-level-inhg")); + setprop("/instrumentation/altimeter[0]/setting-inhg", getprop("/environment/metar[0]/pressure-inhg") or 29.92); settimer(taxi_c, 2); } var taxi_c = func { diff --git a/Nasal/MCDU/FUELPRED.nas b/Nasal/MCDU/FUELPRED.nas index 5bceb179..544339da 100644 --- a/Nasal/MCDU/FUELPRED.nas +++ b/Nasal/MCDU/FUELPRED.nas @@ -219,9 +219,9 @@ var fuelPredInput = func(key, i) { } if (!getprop("/FMGC/internal/cost-index-set") and getprop("/FMGC/internal/tofrom-set")) { - mcdu_message(i, "USING COST INDEX N", getprop("/FMGC/internal/last-cost-index")); + mcdu_message(i, "USING COST INDEX N", getprop("/FMGC/internal/last-cost-index") or 0); setprop("/FMGC/internal/cost-index-set", 1); - setprop("/FMGC/internal/cost-index", getprop("/FMGC/internal/last-cost-index")); + setprop("/FMGC/internal/cost-index", getprop("/FMGC/internal/last-cost-index") or 0); } } } else if (key == "R4") { diff --git a/Nasal/MCDU/INITB.nas b/Nasal/MCDU/INITB.nas index 5e44e127..0a3231a8 100644 --- a/Nasal/MCDU/INITB.nas +++ b/Nasal/MCDU/INITB.nas @@ -151,11 +151,6 @@ var initInputB = func(key, i) { if (scratchpad == "CLR") { mcdu_message(i, "NOT ALLOWED"); } else { - if (!getprop("/FMGC/internal/cost-index-set") and getprop("/FMGC/internal/tofrom-set")) { - mcdu_message(i, "USING COST INDEX N", getprop("/FMGC/internal/last-cost-index")); - setprop("/FMGC/internal/cost-index-set", 1); - setprop("/FMGC/internal/cost-index", getprop("/FMGC/internal/last-cost-index")); - } var zfw_min = 80.6; #make based on performance var zfw_max = 134.5; #61,000 kg, make based on performance if (size(scratchpad) == 0) { @@ -237,6 +232,12 @@ var initInputB = func(key, i) { } else { mcdu_message(i, "NOT ALLOWED"); } + + if (!getprop("/FMGC/internal/cost-index-set") and getprop("/FMGC/internal/tofrom-set")) { + mcdu_message(i, "USING COST INDEX N", getprop("/FMGC/internal/last-cost-index") or 0); + setprop("/FMGC/internal/cost-index-set", 1); + setprop("/FMGC/internal/cost-index", getprop("/FMGC/internal/last-cost-index") or 0); + } } } else if (key == "R2" and !getprop("/FMGC/internal/fuel-calculating")) { if (scratchpad == "CLR") { diff --git a/Nasal/MCDU/MCDU.nas b/Nasal/MCDU/MCDU.nas index 777f63ea..f4741be6 100644 --- a/Nasal/MCDU/MCDU.nas +++ b/Nasal/MCDU/MCDU.nas @@ -59,7 +59,6 @@ var MCDU_reset = func(i) { setprop("/FMGC/internal/alt-set", 0); setprop("/FMGC/internal/cost-index", "0"); setprop("/FMGC/internal/cost-index-set", 0); - setprop("/FMGC/internal/last-cost-index", 0); setprop("/FMGC/internal/cruise-ft", 10000); setprop("/FMGC/internal/cruise-fl", 100); setprop("/FMGC/internal/cruise-lvl-set", 0); From 4ce2cfcaf653b8ee9004b0e63e4b592d31035ac1 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Tue, 30 Jun 2020 15:13:30 +0100 Subject: [PATCH 13/13] Bugfix DIRTO page --- Nasal/MCDU/DIRTO.nas | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Nasal/MCDU/DIRTO.nas b/Nasal/MCDU/DIRTO.nas index a440bb20..81480ff2 100644 --- a/Nasal/MCDU/DIRTO.nas +++ b/Nasal/MCDU/DIRTO.nas @@ -167,7 +167,7 @@ var dirTo = { # fix var fix = findFixesByID(text); if (size(fix) == 0) { - notInDataBase(me.computer); + mcdu_message(me.computer, "NOT IN DATA BASE"); } if (size(fix) == 1 or override) { @@ -189,7 +189,7 @@ var dirTo = { # airport var airport = findAirportsByICAO(text); if (size(airport) == 0) { - notInDataBase(me.computer); + mcdu_message(me.computer, "NOT IN DATA BASE"); } if (size(airport) == 1 or override) { @@ -211,7 +211,7 @@ var dirTo = { # navaid var navaid = findNavaidsByID(text); if (size(navaid) == 0) { - notInDataBase(me.computer); + mcdu_message(me.computer, "NOT IN DATA BASE"); } if (size(navaid) == 1 or override) {