From 25132937ab18f90b0d6f173149e9a61254117437 Mon Sep 17 00:00:00 2001 From: legoboyvdlp R Date: Fri, 24 Apr 2020 16:47:13 +0100 Subject: [PATCH] Add debug statements, fix bounced landing breaking FMGC phases --- Nasal/FMGC/FMGC.nas | 3 ++- Nasal/FMGC/flightplan.nas | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Nasal/FMGC/FMGC.nas b/Nasal/FMGC/FMGC.nas index e311aa77..3426e912 100644 --- a/Nasal/FMGC/FMGC.nas +++ b/Nasal/FMGC/FMGC.nas @@ -523,7 +523,7 @@ var masterFMGC = maketimer(0.2, func { }); var reset_FMGC = func { - setprop("FMGC/status/phase", "7"); + setprop("FMGC/status/phase", "0"); fd1 = getprop("it-autoflight/input/fd1"); fd2 = getprop("it-autoflight/input/fd2"); spd = getprop("it-autoflight/input/spd-kts"); @@ -811,6 +811,7 @@ var switchDatabase = func { setlistener("gear/gear[1]/wow", func() { if (timer30secLanding.isRunning) { timer30secLanding.stop(); + setprop("FMGC/internal/landing-time", -99); } if (getprop("gear/gear[1]/wow") == 1 and getprop("FMGC/internal/landing-time") == -99) { diff --git a/Nasal/FMGC/flightplan.nas b/Nasal/FMGC/flightplan.nas index 9d02d59c..2e132eb6 100644 --- a/Nasal/FMGC/flightplan.nas +++ b/Nasal/FMGC/flightplan.nas @@ -510,6 +510,7 @@ var flightPlanController = { if (wpt == 1) { if (me.flightplans[n].getWP(wpt).wp_name != "DISCONTINUITY" and me.flightplans[n].getWP(wpt).wp_type != "vectors" and me.flightplans[n].getWP(wpt).wp_type != "hdgToAlt" and wpt <= me.arrivalIndex[n]) { + # print("Adding " ~ courseDistanceFrom[1] ~ " miles for waypoint " ~ me.flightplans[n].getWP(wpt).wp_name); me._arrivalDist += courseDistanceFrom[1]; # distance to next waypoint, therafter to end of flightplan } } @@ -528,7 +529,8 @@ var flightPlanController = { wpDistancePrev[n][wpt].setValue(courseDistanceFromPrev[1]); if (wpt > 1) { if (me.flightplans[n].getWP(wpt - 1).wp_name != "DISCONTINUITY" and me.flightplans[n].getWP(wpt).wp_name != "DISCONTINUITY" and me.flightplans[n].getWP(wpt - 1).wp_type != "vectors" and me.flightplans[n].getWP(wpt - 1).wp_type != "hdgToAlt" and me.flightplans[n].getWP(wpt).wp_type != "vectors" and me.flightplans[n].getWP(wpt).wp_type != "hdgToAlt" and wpt <= me.arrivalIndex[n]) { - me._arrivalDist += courseDistanceFromPrev[1]; # todo - buggy. Neglect discontinuity + # print("Adding " ~ courseDistanceFromPrev[1] ~ " miles for waypoint " ~ me.flightplans[n].getWP(wpt).wp_name); + me._arrivalDist += courseDistanceFromPrev[1]; } } } else { @@ -549,6 +551,7 @@ var flightPlanController = { } } } + # print("Total: " ~ me._arrivalDist); me.arrivalDist = me._arrivalDist; me.updateMCDUDriver(n); },