From 5e7d132c19cd1295130b3b956ecb1d017d7d7c8c Mon Sep 17 00:00:00 2001 From: Jonathan Redpath Date: Mon, 23 May 2022 17:34:54 +0100 Subject: [PATCH] Remove the MANUAL discontinuity; because it kept adding more discontinuities --- Nasal/FMGC/FCU.nas | 2 +- Nasal/FMGC/flightplan-delegates.nas | 12 ++++++------ Nasal/FMGC/flightplan.nas | 11 +++++------ 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/Nasal/FMGC/FCU.nas b/Nasal/FMGC/FCU.nas index 87f0851c..1c925f0f 100644 --- a/Nasal/FMGC/FCU.nas +++ b/Nasal/FMGC/FCU.nas @@ -264,7 +264,7 @@ var FCUController = { if (me.FCUworking) { if (fmgc.Output.fd1.getBoolValue() or fmgc.Output.fd2.getBoolValue() or fmgc.Output.ap1.getBoolValue() or fmgc.Output.ap2.getBoolValue()) { var wp = fmgc.flightPlanController.flightplans[2].getWP(fmgc.flightPlanController.currentToWptIndex.getValue()); - if (wp != nil and wp.wp_type != "discontinuity") { + if (wp != nil and wp.wp_type != "discontinuity" and wp.wp_type != "vectors") { fmgc.Input.lat.setValue(1); } } diff --git a/Nasal/FMGC/flightplan-delegates.nas b/Nasal/FMGC/flightplan-delegates.nas index fff9b3d5..553e45fe 100644 --- a/Nasal/FMGC/flightplan-delegates.nas +++ b/Nasal/FMGC/flightplan-delegates.nas @@ -75,12 +75,6 @@ var A320RouteManagerDelegate = { } me.flightplan.insertWaypoints(wps, 1); - - for (var wpIdx = 0; wpIdx < me.flightplan.getPlanSize(); wpIdx = wpIdx + 1) { - if (me.flightplan.getWP(wpIdx).wp_type == "vectors" and (me.flightplan.getWP(wpIdx + 1) == nil or me.flightplan.getWP(wpIdx + 1).wp_type != "discontinuity")) { - me.flightplan.insertWP(createDiscontinuity(), wpIdx + 1); - } - } }, arrivalChanged: func @@ -272,6 +266,12 @@ var A320GPSDelegate = { } elsif (me.flightplan.nextWP().wp_type != 'discontinuity' and me.flightplan.nextWP().wp_type != 'vectors') { logprint(LOG_INFO, "default GPS sequencing to next WP"); me.flightplan.current = me.flightplan.current + 1; + } else { + logprint(LOG_INFO, "default GPS sequencing to next WP (special)"); + fmgc.Input.lat.setValue(3); + if (me.flightplan.nextWP().wp_type == 'vectors') { + me.flightplan.current = me.flightplan.current + 2; + } } } else { # OBS, do nothing diff --git a/Nasal/FMGC/flightplan.nas b/Nasal/FMGC/flightplan.nas index da218879..1be9fe10 100644 --- a/Nasal/FMGC/flightplan.nas +++ b/Nasal/FMGC/flightplan.nas @@ -226,14 +226,11 @@ var flightPlanController = { # TODO - triple click - confirm, is it only with DES disengage, or also with the NAV loss? # TODO - I think that it only goes to VS when in DES mode - if (me.flightplans[2].getWP(me.currentToWptIndexTemp + 1).wp_type == "discontinuity") { + if (me.flightplans[2].getWP(me.currentToWptIndexTemp + 1).wp_type == "discontinuity" or me.flightplans[2].getWP(me.currentToWptIndexTemp + 1).wp_type == "vectors") { fmgc.Input.lat.setValue(3); + me.currentToWptIndex.setValue(me.currentToWptIndexTemp + 2); + me.lastSequencedCurrentWP = me.currentToWptIndexTemp + 2; } else { - if (me.flightplans[2].getWP(me.currentToWptIndexTemp + 1).wp_type == "vectors") { - fmgc.Input.lat.setValue(3); - me.flightplans[2].deleteWP(me.currentToWptIndexTemp + 2); - } - me.currentToWptIndex.setValue(me.currentToWptIndexTemp + 1); me.lastSequencedCurrentWP = me.currentToWptIndexTemp + 1; @@ -271,8 +268,10 @@ var flightPlanController = { # Optional flag DEBUG_DISCONT to disable discontinuities totally addDiscontinuity: func(index, plan, force = 0) { if (DEBUG_DISCONT) { return; } + if (force) { me.flightplans[plan].insertWP(createDiscontinuity(), index); + return; } if (me.flightplans[plan].getWP(index) != nil) { # index is not nil