FMGC: LAT and LON out, ND: Fix a bug
This commit is contained in:
parent
d15f45f753
commit
74cf916ed6
2 changed files with 16 additions and 8 deletions
|
@ -233,7 +233,7 @@ canvas.NavDisplay.newMFD = func(canvas_group, parent=nil, nd_options=nil, update
|
|||
#print("navdisplay.mfd:ND layer setup completed");
|
||||
|
||||
# TODO: move this to RTE.lcontroller ?
|
||||
me.listen("/autopilot/route-manager/current-wp", func(activeWp) {
|
||||
me.listen("/FMGC/flightplan/r1/current-wp", func(activeWp) {
|
||||
canvas.updatewp( activeWp.getValue() );
|
||||
});
|
||||
|
||||
|
@ -297,19 +297,19 @@ canvas.NavDisplay.update_sub = func(){
|
|||
};
|
||||
# reposition the map, change heading & range:
|
||||
var pln_wpt_idx = getprop(me.efis_path ~ "/inputs/plan-wpt-index");
|
||||
if(me.in_mode("toggle_display_mode", ["PLAN"]) and pln_wpt_idx >= 0) {
|
||||
if(me.in_mode("toggle_display_mode", ["PLAN"]) and pln_wpt_idx >= 0) { # FIXME: Needs props fixed once flightplan.nas supports it
|
||||
if(me.route_driver != nil){
|
||||
var wp = me.route_driver.getPlanModeWP(pln_wpt_idx);
|
||||
if(wp != nil){
|
||||
pos.lat = wp.wp_lat;
|
||||
pos.lon = wp.wp_lon;
|
||||
} else {
|
||||
pos.lat = getprop("/autopilot/route-manager/route/wp["~pln_wpt_idx~"]/latitude-deg");
|
||||
pos.lon = getprop("/autopilot/route-manager/route/wp["~pln_wpt_idx~"]/longitude-deg");
|
||||
pos.lat = getprop("/FMGC/flightplan/r1/wp[" ~ pln_wpt_idx ~ "]/lat");
|
||||
pos.lon = getprop("/FMGC/flightplan/r1/wp[" ~ pln_wpt_idx ~ "]/lon");
|
||||
}
|
||||
} else {
|
||||
pos.lat = getprop("/autopilot/route-manager/route/wp["~pln_wpt_idx~"]/latitude-deg");
|
||||
pos.lon = getprop("/autopilot/route-manager/route/wp["~pln_wpt_idx~"]/longitude-deg");
|
||||
pos.lat = getprop("/FMGC/flightplan/r1/wp[" ~ pln_wpt_idx ~ "]/lat");
|
||||
pos.lon = getprop("/FMGC/flightplan/r1/wp[" ~ pln_wpt_idx ~ "]/lon");
|
||||
}
|
||||
} else {
|
||||
pos.lat = userLat;
|
||||
|
|
|
@ -33,6 +33,8 @@ var trueHDG = props.globals.getNode("/orientation/heading-deg", 1);
|
|||
|
||||
# props.nas for flightplan
|
||||
var wpID = [props.globals.initNode("/FMGC/flightplan/r1/wp[0]/id", "", "STRING")];
|
||||
var wpLat = [props.globals.initNode("/FMGC/flightplan/r1/wp[0]/lat", 0, "DOUBLE")];
|
||||
var wpLon = [props.globals.initNode("/FMGC/flightplan/r1/wp[0]/lon", 0, "DOUBLE")];
|
||||
var wpCourse = [props.globals.initNode("/FMGC/flightplan/r1/wp[0]/course", 0, "DOUBLE")];
|
||||
var wpDistance = [props.globals.initNode("/FMGC/flightplan/r1/wp[0]/distance", 0, "DOUBLE")];
|
||||
var wpCoursePrev = [props.globals.initNode("/FMGC/flightplan/r1/wp[0]/course-from-prev", 0, "DOUBLE")];
|
||||
|
@ -89,14 +91,18 @@ var flightplan = {
|
|||
}
|
||||
},
|
||||
deleteWP: func(i) {
|
||||
r1.deleteWP(i);
|
||||
canvas_nd.A3XXRouteDriver.triggerSignal("fp-removed");
|
||||
if (r1.getPlanSize() > 2) {
|
||||
r1.deleteWP(i);
|
||||
canvas_nd.A3XXRouteDriver.triggerSignal("fp-removed");
|
||||
}
|
||||
},
|
||||
checkWPOutputs: func() {
|
||||
canvas_nd.A3XXRouteDriver.triggerSignal("fp-added");
|
||||
sizeWP = size(wpID);
|
||||
for (var counter = sizeWP; counter < r1.getPlanSize(); counter += 1) {
|
||||
append(wpID, props.globals.initNode("/FMGC/flightplan/r1/wp[" ~ counter ~ "]/id", "", "STRING"));
|
||||
append(wpLat, props.globals.initNode("/FMGC/flightplan/r1/wp[" ~ counter ~ "]/lat", 0, "DOUBLE"));
|
||||
append(wpLon, props.globals.initNode("/FMGC/flightplan/r1/wp[" ~ counter ~ "]/lon", 0, "DOUBLE"));
|
||||
append(wpCourse, props.globals.initNode("/FMGC/flightplan/r1/wp[" ~ counter ~ "]/course", 0, "DOUBLE"));
|
||||
append(wpDistance, props.globals.initNode("/FMGC/flightplan/r1/wp[" ~ counter ~ "]/distance", 0, "DOUBLE"));
|
||||
append(wpCoursePrev, props.globals.initNode("/FMGC/flightplan/r1/wp[" ~ counter ~ "]/course-from-prev", 0, "DOUBLE"));
|
||||
|
@ -133,6 +139,8 @@ var flightplan = {
|
|||
|
||||
for (var i = 0; i < r1.getPlanSize(); i += 1) {
|
||||
wpID[i].setValue(r1.getWP(i).wp_name);
|
||||
wpLat[i].setValue(r1.getWP(i).wp_lat);
|
||||
wpLon[i].setValue(r1.getWP(i).wp_lon);
|
||||
courseDistanceFrom = r1.getWP(i).courseAndDistanceFrom(geoPos);
|
||||
wpCourse[i].setValue(courseDistanceFrom[0]);
|
||||
wpDistance[i].setValue(courseDistanceFrom[1]);
|
||||
|
|
Reference in a new issue