diff --git a/Models/Instruments/ND/canvas/A3XX_ND.nas b/Models/Instruments/ND/canvas/A3XX_ND.nas index 0186fbd3..b690c788 100644 --- a/Models/Instruments/ND/canvas/A3XX_ND.nas +++ b/Models/Instruments/ND/canvas/A3XX_ND.nas @@ -29,10 +29,8 @@ var SymbolCache32x32 = canvas.SymbolCache32x32; var SymbolCache = canvas.SymbolCache; var Text = canvas.Text; -io.include("ND_config.nas"); io.include("framework/canvas.nas"); io.include("framework/navdisplay.nas"); -io.include("framework/MapDrivers.nas"); io.include("loaders.nas"); io.include("helpers.nas"); io.include("style.nas"); diff --git a/Models/Instruments/ND/canvas/ND_config.nas b/Models/Instruments/ND/canvas/ND_config.nas deleted file mode 100644 index c5f837b8..00000000 --- a/Models/Instruments/ND/canvas/ND_config.nas +++ /dev/null @@ -1,27 +0,0 @@ -# A3XX ND Canvas -# Joshua Davidson (Octal450) -# Based on work by artix - -# Copyright (c) 2020 Josh Davidson (Octal450) - -canvas.NDConfig = { - properties: { - des_apt: "/autopilot/route-manager/destination/airport", - dep_apt: "/autopilot/route-manager/departure/airport", - des_rwy: "/autopilot/route-manager/destination/runway", - dep_rwy: "/autopilot/route-manager/departure/runway", - fplan_active: "autopilot/route-manager/active", - athr: "/it-autoflight/output/athr", - cur_wp: "/autopilot/route-manager/current-wp", - vnav_node: "/autopilot/route-manager/vnav/", - spd_node: "/autopilot/route-manager/spd/", - holding: "/flight-management/hold", - holding_points: "/flight-management/hold/points", - adf1_frq: "instrumentation/adf[0]/frequencies/selected-khz", - adf2_frq: "instrumentation/adf[1]/frequencies/selected-khz", - nav1_frq: "instrumentation/nav[0]/frequencies/selected-mhz", - nav2_frq: "instrumentation/nav[1]/frequencies/selected-mhz", - lat_ctrl: "/it-autoflight/output/lat", - ver_ctrl: "/it-autoflight/output/vert", - } -}; diff --git a/Models/Instruments/ND/canvas/framework/MapDrivers.nas b/Models/Instruments/ND/canvas/framework/MapDrivers.nas deleted file mode 100644 index b6b7ecbc..00000000 --- a/Models/Instruments/ND/canvas/framework/MapDrivers.nas +++ /dev/null @@ -1,122 +0,0 @@ -# A3XX ND Canvas -# Joshua Davidson (Octal450) -# Based on work by artix - -# Copyright (c) 2020 Josh Davidson (Octal450) - -canvas.RouteDriver = { - new: func(){ - var m = { - parents: [canvas.RouteDriver], - }; - m.init(); - return m; - }, - init: func(){ - me.update(); - }, - update: func(){ - me.flightplan = flightplan(); - }, - getNumberOfFlightPlans: func(){1}, - getFlightPlanType: func(fpNum){"active"}, - getFlightPlan: func(fpNum){me.flightplan}, - getPlanSize: func(fpNum){me.flightplan.getPlanSize()}, - getWP: func(fpNum, idx){me.flightplan.getWP(idx)}, - getListeners: func(){[]}, - getPlanModeWP: func(plan_wp_idx){me.flightplan.getWP(plan_wp_idx)}, - hasDiscontinuity: func(fpNum, wpt){0}, - getHoldPattern: func(fpNum, wpt){nil}, - getHoldPatterns: func(fpNum){[]}, - shouldUpdate: func 1, - shouldDisplayWP: func(fpNum, idx) 1, - getCurrentWPIdx: func(fpNum) getprop("autopilot/route-manager/current-wp"), - getTimeConstraint: func (fpNum, wp_idx) {nil} -}; - -canvas.MultiRouteDriver = { - parents: [canvas.RouteDriver], - new: func(){ - var m = { - parents: [MultiRouteDriver], - _flightplans: [], - currentFlightPlan: 0 - }; - m.init(); - return m; - }, - addFlightPlan: func(type, plan){ - append(me._flightplans, { - type: type, - flightplan: plan - }); - }, - removeFlightPlanAtIndex: func(idx){ - var sz = size(me._flightplans); - if(idx < sz){ - if(sz == 1) - me._flightplans = []; - elsif(sz == 2 and idx == 0) - me._flightplans = [me._flightplans[1]]; - elsif(sz == 2 and idx == 1) - pop(me._flightplans); - else { - var subv_l = subvec(me._flightplans, 0, idx); - var subv_r = subvec(me._flightplans, idx + 1); - me._flightplans = subv_l ~ subv_r; - } - } - me.triggerSignal("fp-added"); - }, - removeFlightPlanOfType: func(type){ - var new_vec = []; - foreach(var fp; me._flightplans){ - if(fp["type"] != type) - append(new_vec, fp); - } - me._flightplans = new_vec; - me.triggerSignal("fp-removed"); - }, - getNumberOfFlightPlans: func(){ - size(me._flightplans); - }, - getFlightPlanType: func(fpNum){ - if(fpNum >= size(me._flightplans)) return nil; - var fp = me._flightplans[fpNum]; - return fp.type; - }, - getFlightPlan: func(fpNum){ - if(fpNum >= size(me._flightplans)) return nil; - return me._flightplans[fpNum]; - }, - getPlanSize: func(fpNum){ - if(fpNum >= size(me._flightplans)) return 0; - return me._flightplans[fpNum].getPlanSize(); - }, - getWP: func(fpNum, idx){ - if(fpNum >= size(me._flightplans)) return nil; - var fp = me._flightplans[fpNum]; - return fp.getWP(idx); - }, - getPlanModeWP: func(idx){ - if(me.currentFlightPlan >= size(me._flightplans)) return nil; - var fp = me._flightplans[me.currentFlightPlan]; - return fp.getWP(idx); - }, - triggerSignal: func(signal){ - setprop(me.signalPath(signal)); - }, - signalPath: func(signal){ - "autopilot/route-manager/signals/rd-"~ signal; - }, - getListeners: func(){[ - me.getSignal("fp-added"), - me.getSignal("fp-removed") - ]}, - getCurrentWPIdx: func(fpNum) { - var fp = me.getFlightPlan(fpNum); - var wp = fp.getWP(); - if (wp == nil) return -1; - return wp.index; - } -}; diff --git a/Models/Instruments/ND/canvas/framework/navdisplay.nas b/Models/Instruments/ND/canvas/framework/navdisplay.nas index e79d2818..3f90cf80 100644 --- a/Models/Instruments/ND/canvas/framework/navdisplay.nas +++ b/Models/Instruments/ND/canvas/framework/navdisplay.nas @@ -393,9 +393,9 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec me.symbols.vorR.setColor(0,0.6,0.85); me.symbols.dmeR.setText(""); me.symbols.dmeR.setColor(0,0.6,0.85); - if((var navident=getprop("instrumentation/adf[1]/ident")) != "") + if((var navident=getprop("/instrumentation/adf[1]/ident")) != "") me.symbols.vorRId.setText(navident); - else me.symbols.vorRId.setText(sprintf("%3d",getprop("instrumentation/adf[1]/frequencies/selected-khz"))); + else me.symbols.vorRId.setText(sprintf("%3d",getprop("/instrumentation/adf[1]/frequencies/selected-khz"))); me.symbols.vorRId.setColor(0,0.6,0.85); me.symbols.dmeRDist.setText(""); me.symbols.dmeRDist.setColor(0,0.6,0.85); @@ -407,8 +407,8 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec } # Hide heading bug 10 secs after change - var vhdg_bug = getprop("it-autoflight/input/hdg") or 0; - var hdg_bug_active = getprop("it-autoflight/custom/show-hdg"); + var vhdg_bug = getprop("/it-autoflight/input/hdg") or 0; + var hdg_bug_active = getprop("/it-autoflight/custom/show-hdg"); if (hdg_bug_active == nil) hdg_bug_active = 1; @@ -445,31 +445,31 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec var vorheading = userHdgTru; var adfheading = userHdgMag; } - if (getprop("instrumentation/nav[2]/heading-deg") != nil) { - var nav0hdg = getprop("instrumentation/nav[2]/heading-deg") - getprop("orientation/heading-deg"); + if (getprop("/instrumentation/nav[2]/heading-deg") != nil) { + var nav0hdg = getprop("/instrumentation/nav[2]/heading-deg") - getprop("orientation/heading-deg"); } else { var nav0hdg = 0; } - if (getprop("instrumentation/nav[3]/heading-deg") != nil) { - var nav1hdg = getprop("instrumentation/nav[3]/heading-deg") - getprop("orientation/heading-deg"); + if (getprop("/instrumentation/nav[3]/heading-deg") != nil) { + var nav1hdg = getprop("/instrumentation/nav[3]/heading-deg") - getprop("orientation/heading-deg"); } else { var nav1hdg = 0; } - var adf0hdg = getprop("instrumentation/adf/indicated-bearing-deg"); - var adf1hdg = getprop("instrumentation/adf[1]/indicated-bearing-deg"); + var adf0hdg = getprop("/instrumentation/adf/indicated-bearing-deg"); + var adf1hdg = getprop("/instrumentation/adf[1]/indicated-bearing-deg"); if(!me.get_switch("toggle_centered")) { if(me.in_mode("toggle_display_mode", ["PLAN"])) me.symbols.trkInd.hide(); else me.symbols.trkInd.show(); - if((getprop("instrumentation/nav[2]/in-range") and me.get_switch("toggle_lh_vor_adf") == 1)) { + if((getprop("/instrumentation/nav[2]/in-range") and me.get_switch("toggle_lh_vor_adf") == 1)) { me.symbols.staArrowL.setVisible(staPtrVis); me.symbols.staToL.setColor(0.195,0.96,0.097); me.symbols.staFromL.setColor(0.195,0.96,0.097); me.symbols.staArrowL.setRotation(nav0hdg*D2R); } - elsif(getprop("instrumentation/adf/in-range") and (me.get_switch("toggle_lh_vor_adf") == -1)) { + elsif(getprop("/instrumentation/adf/in-range") and (me.get_switch("toggle_lh_vor_adf") == -1)) { me.symbols.staArrowL.setVisible(staPtrVis); me.symbols.staToL.setColor(0,0.6,0.85); me.symbols.staFromL.setColor(0,0.6,0.85); @@ -477,12 +477,12 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec } else { me.symbols.staArrowL.hide(); } - if((getprop("instrumentation/nav[3]/in-range") and me.get_switch("toggle_rh_vor_adf") == 1)) { + if((getprop("/instrumentation/nav[3]/in-range") and me.get_switch("toggle_rh_vor_adf") == 1)) { me.symbols.staArrowR.setVisible(staPtrVis); me.symbols.staToR.setColor(0.195,0.96,0.097); me.symbols.staFromR.setColor(0.195,0.96,0.097); me.symbols.staArrowR.setRotation(nav1hdg*D2R); - } elsif(getprop("instrumentation/adf[1]/in-range") and (me.get_switch("toggle_rh_vor_adf") == -1)) { + } elsif(getprop("/instrumentation/adf[1]/in-range") and (me.get_switch("toggle_rh_vor_adf") == -1)) { me.symbols.staArrowR.setVisible(staPtrVis); me.symbols.staToR.setColor(0,0.6,0.85); me.symbols.staFromR.setColor(0,0.6,0.85); @@ -517,12 +517,12 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec me.symbols.selHdgLine.setVisible(staPtrVis and hdg_bug_active); } else { me.symbols.trkInd.hide(); - if((getprop("instrumentation/nav[2]/in-range") and me.get_switch("toggle_lh_vor_adf") == 1)) { + if((getprop("/instrumentation/nav[2]/in-range") and me.get_switch("toggle_lh_vor_adf") == 1)) { me.symbols.staArrowL2.setVisible(staPtrVis); me.symbols.staFromL2.setColor(0.195,0.96,0.097); me.symbols.staToL2.setColor(0.195,0.96,0.097); me.symbols.staArrowL2.setRotation(nav0hdg*D2R); - } elsif(getprop("instrumentation/adf/in-range") and (me.get_switch("toggle_lh_vor_adf") == -1)) { + } elsif(getprop("/instrumentation/adf/in-range") and (me.get_switch("toggle_lh_vor_adf") == -1)) { me.symbols.staArrowL2.setVisible(staPtrVis); me.symbols.staFromL2.setColor(0,0.6,0.85); me.symbols.staToL2.setColor(0,0.6,0.85); @@ -530,12 +530,12 @@ canvas.NavDisplay.update = func() # FIXME: This stuff is still too aircraft spec } else { me.symbols.staArrowL2.hide(); } - if((getprop("instrumentation/nav[3]/in-range") and me.get_switch("toggle_rh_vor_adf") == 1)) { + if((getprop("/instrumentation/nav[3]/in-range") and me.get_switch("toggle_rh_vor_adf") == 1)) { me.symbols.staArrowR2.setVisible(staPtrVis); me.symbols.staFromR2.setColor(0.195,0.96,0.097); me.symbols.staToR2.setColor(0.195,0.96,0.097); me.symbols.staArrowR2.setRotation(nav1hdg*D2R); - } elsif(getprop("instrumentation/adf[1]/in-range") and (me.get_switch("toggle_rh_vor_adf") == -1)) { + } elsif(getprop("/instrumentation/adf[1]/in-range") and (me.get_switch("toggle_rh_vor_adf") == -1)) { me.symbols.staArrowR2.setVisible(staPtrVis); me.symbols.staFromR2.setColor(0,0.6,0.85); me.symbols.staToR2.setColor(0,0.6,0.85); diff --git a/Models/Instruments/ND/canvas/map/WPT-airbus.lcontroller b/Models/Instruments/ND/canvas/map/WPT-airbus.lcontroller index 7f510dc4..64e684ca 100644 --- a/Models/Instruments/ND/canvas/map/WPT-airbus.lcontroller +++ b/Models/Instruments/ND/canvas/map/WPT-airbus.lcontroller @@ -56,7 +56,7 @@ var new = func(layer) { layer.searcher._equals = func(a,b) a.equals(b); var driver = opt_member(m.layer.options, 'route_driver'); if(driver == nil){ - driver = RouteDriver.new(); + driver = A3XXRouteDriver.new(); } var driver_listeners = driver.getListeners(); foreach(var listener; driver_listeners){ diff --git a/Models/Instruments/ND/canvas/style.nas b/Models/Instruments/ND/canvas/style.nas index 31f10d9a..68886194 100644 --- a/Models/Instruments/ND/canvas/style.nas +++ b/Models/Instruments/ND/canvas/style.nas @@ -632,7 +632,7 @@ canvas.NDStyles["Airbus"] = { update_on: ["toggle_display_mode"], predicate: func(nd, layer){ var map_mode = nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]); - var debug_actv = getprop("autopilot/route-manager/debug/active") or 0; + var debug_actv = getprop("/autopilot/route-manager/debug/active") or 0; var visible = (map_mode and debug_actv); layer.group.setVisible( visible ); if (visible) { @@ -676,7 +676,7 @@ canvas.NDStyles["Airbus"] = { id: "taOnly", # the SVG ID impl: { # implementation hash init: func(nd, symbol), # for updateCenter stuff, called during initialization in the ctor - predicate: func(nd) getprop("instrumentation/tcas/inputs/mode") == 2, # the condition + predicate: func(nd) getprop("/instrumentation/tcas/inputs/mode") == 2, # the condition is_true: func(nd) nd.symbols.taOnly.show(), # if true, run this is_false: func(nd) nd.symbols.taOnly.hide(), # if false, run this }, # end of taOnly behavior/callbacks @@ -687,7 +687,7 @@ canvas.NDStyles["Airbus"] = { init: func(nd,symbol), predicate: func(nd) nd.aircraft_source.get_spd() > 100, is_true: func(nd) { - nd.symbols.tas.setText(sprintf("%3.0f",getprop("velocities/TAS") )); + nd.symbols.tas.setText(sprintf("%3.0f",getprop("/velocities/TAS") )); nd.symbols.tas.show(); }, is_false: func(nd) nd.symbols.tas.hide(), @@ -741,7 +741,7 @@ canvas.NDStyles["Airbus"] = { impl: { init: func(nd,symbol), predicate: func(nd) getprop("/FMGC/flightplan[2]/current-leg") != nil and - getprop("FMGC/flightplan[2]/active") and + getprop("/FMGC/flightplan[2]/active") and nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]), is_true: func(nd) { nd.symbols.wpActiveId.setText(getprop("/FMGC/flightplan[2]/current-leg")); @@ -755,10 +755,10 @@ canvas.NDStyles["Airbus"] = { impl: { init: func(nd,symbol), predicate: func(nd) getprop("/FMGC/flightplan[2]/current-leg") != nil and - getprop("FMGC/flightplan[2]/active") and + getprop("/FMGC/flightplan[2]/active") and nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]), is_true: func(nd) { - #var cur_wp = getprop("autopilot/route-manager/current-wp"); + #var cur_wp = getprop("/autopilot/route-manager/current-wp"); if (nd.get_switch("toggle_true_north")) { var deg = math.round(getprop("/FMGC/flightplan[2]/current-leg-course")); } else { @@ -775,7 +775,7 @@ canvas.NDStyles["Airbus"] = { impl: { init: func(nd,symbol), predicate: func(nd) getprop("/FMGC/flightplan[2]/current-leg-dist") != nil and - getprop("FMGC/flightplan[2]/active") and + getprop("/FMGC/flightplan[2]/active") and nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]), is_true: func(nd) { var dst = getprop("/FMGC/flightplan[2]/current-leg-dist"); @@ -789,7 +789,7 @@ canvas.NDStyles["Airbus"] = { id: "wpActiveDistLbl", impl: { init: func(nd,symbol), - predicate: func(nd) getprop("/FMGC/flightplan[2]/current-leg-dist") != nil and getprop("FMGC/flightplan[2]/active") and nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]), + predicate: func(nd) getprop("/FMGC/flightplan[2]/current-leg-dist") != nil and getprop("/FMGC/flightplan[2]/active") and nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]), is_true: func(nd) { nd.symbols.wpActiveDistLbl.show(); if(getprop("/FMGC/flightplan[2]/current-leg-dist") > 1000) @@ -802,10 +802,10 @@ canvas.NDStyles["Airbus"] = { id: "eta", impl: { init: func(nd,symbol), - predicate: func(nd) getprop("autopilot/route-manager/wp/eta") != nil and getprop("FMGC/flightplan[2]/active") and nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]), + predicate: func(nd) getprop("/autopilot/route-manager/wp/eta") != nil and getprop("/FMGC/flightplan[2]/active") and nd.in_mode("toggle_display_mode", ["MAP", "PLAN"]), is_true: func(nd) { - var etaSec = getprop("sim/time/utc/day-seconds")+ - getprop("autopilot/route-manager/wp/eta-seconds"); + var etaSec = getprop("/sim/time/utc/day-seconds")+ + getprop("/autopilot/route-manager/wp/eta-seconds"); var h = math.floor(etaSec/3600); etaSec = etaSec-3600*h; var m = math.floor(etaSec/60); @@ -1182,9 +1182,9 @@ canvas.NDStyles["Airbus"] = { is_true: func(nd) { nd.symbols.vorCrsPtr.show(); if (is_ils) { - nd.symbols.vorCrsPtr.setRotation((getprop("instrumentation/nav[0]/radials/selected-deg")-nd.aircraft_source.get_hdg_mag())*D2R); + nd.symbols.vorCrsPtr.setRotation((getprop("/instrumentation/nav[0]/radials/selected-deg")-nd.aircraft_source.get_hdg_mag())*D2R); } else { - nd.symbols.vorCrsPtr.setRotation((getprop("instrumentation/nav[2]/radials/selected-deg")-nd.aircraft_source.get_hdg_mag())*D2R); + nd.symbols.vorCrsPtr.setRotation((getprop("/instrumentation/nav[2]/radials/selected-deg")-nd.aircraft_source.get_hdg_mag())*D2R); } }, @@ -1202,9 +1202,9 @@ canvas.NDStyles["Airbus"] = { var type = (is_ils ? "ils" : "vor"); var path = nd.get_nav_path(type, 0); if (is_ils) { - nd.symbols.vorCrsPtr2.setRotation((getprop("instrumentation/nav[0]/radials/selected-deg")-nd.aircraft_source.get_hdg_mag())*D2R); + nd.symbols.vorCrsPtr2.setRotation((getprop("/instrumentation/nav[0]/radials/selected-deg")-nd.aircraft_source.get_hdg_mag())*D2R); } else { - nd.symbols.vorCrsPtr2.setRotation((getprop("instrumentation/nav[2]/radials/selected-deg")-nd.aircraft_source.get_hdg_mag())*D2R); + nd.symbols.vorCrsPtr2.setRotation((getprop("/instrumentation/nav[2]/radials/selected-deg")-nd.aircraft_source.get_hdg_mag())*D2R); } var line = nd.symbols.vorCrsPtr2.getElementById("vorCrsPtr2_line"); if(!is_ils){ @@ -1224,8 +1224,8 @@ canvas.NDStyles["Airbus"] = { init: func(nd,symbol), predicate: func(nd) nd.in_mode("toggle_display_mode", ["APP"]), is_true: func(nd) { - if(getprop("instrumentation/nav/gs-needle-deflection-norm") != nil) - nd.symbols.gsDiamond.setTranslation(getprop("instrumentation/nav[0]/gs-needle-deflection-norm")*150,0); + if(getprop("/instrumentation/nav/gs-needle-deflection-norm") != nil) + nd.symbols.gsDiamond.setTranslation(getprop("/instrumentation/nav[0]/gs-needle-deflection-norm")*150,0); }, is_false: func(nd) nd.symbols.gsGroup.hide(), }, @@ -1234,10 +1234,10 @@ canvas.NDStyles["Airbus"] = { id:"locPtr", impl: { init: func(nd,symbol), - predicate: func(nd) (nd.in_mode("toggle_display_mode", ["APP","VOR"]) and !nd.get_switch("toggle_centered") and getprop("instrumentation/nav/in-range")), + predicate: func(nd) (nd.in_mode("toggle_display_mode", ["APP","VOR"]) and !nd.get_switch("toggle_centered") and getprop("/instrumentation/nav/in-range")), is_true: func(nd) { nd.symbols.locPtr.show(); - var deflection = getprop("instrumentation/nav[0]/heading-needle-deflection-norm"); + var deflection = getprop("/instrumentation/nav[0]/heading-needle-deflection-norm"); nd.symbols.locPtr.setTranslation(deflection*150,0); }, is_false: func(nd) nd.symbols.locPtr.hide(), @@ -1286,15 +1286,15 @@ canvas.NDStyles["Airbus"] = { impl: { init: func(nd,symbol), predicate: func(nd) { - var nav_id = getprop("instrumentation/nav/nav-id"); - var ils_mode = getprop("flight-management/freq/ils-mode"); + var nav_id = getprop("/instrumentation/nav/nav-id"); + var ils_mode = getprop("/Flight-management/freq/ils-mode"); var has_ils = (nav_id != nil and nav_id != ""); (nd.get_switch("toggle_display_mode") == "MAP" and !nd.get_switch("toggle_centered") and has_ils and ils_mode); }, is_true: func(nd) { nd.symbols.locTrkPointer.show(); - var crs = getprop("instrumentation/nav/radials/selected-deg"); + var crs = getprop("/instrumentation/nav/radials/selected-deg"); var rotation = (crs - nd.aircraft_source.get_hdg_tru())*D2R; nd.symbols.locTrkPointer.setRotation(rotation); }, @@ -1306,15 +1306,15 @@ canvas.NDStyles["Airbus"] = { impl: { init: func(nd,symbol), predicate: func(nd) { - var nav_id = getprop("instrumentation/nav/nav-id"); - var ils_mode = getprop("flight-management/freq/ils-mode"); + var nav_id = getprop("/instrumentation/nav/nav-id"); + var ils_mode = getprop("/Flight-management/freq/ils-mode"); var has_ils = (nav_id != nil and nav_id != ""); (nd.get_switch("toggle_display_mode") == "MAP" and nd.get_switch("toggle_centered") and has_ils and ils_mode); }, is_true: func(nd) { nd.symbols.locTrkPointer2.show(); - var crs = getprop("instrumentation/nav/radials/selected-deg"); + var crs = getprop("/instrumentation/nav/radials/selected-deg"); var rotation = (crs - nd.aircraft_source.get_hdg_tru())*D2R; nd.symbols.locTrkPointer2.setRotation(rotation); }, @@ -1365,7 +1365,7 @@ canvas.NDStyles["Airbus"] = { init: func(nd,symbol), predicate: func(nd) { var path = nd.get_nav_path("vor", 0); - return !(nd.in_mode("toggle_display_mode", ["PLAN"])) and nd.get_switch("toggle_centered") and ((getprop(path~ "in-range") and nd.get_switch("toggle_lh_vor_adf") == 1) or (getprop("instrumentation/adf/in-range") and nd.get_switch("toggle_lh_vor_adf") == -1)); + return !(nd.in_mode("toggle_display_mode", ["PLAN"])) and nd.get_switch("toggle_centered") and ((getprop(path~ "in-range") and nd.get_switch("toggle_lh_vor_adf") == 1) or (getprop("/instrumentation/adf/in-range") and nd.get_switch("toggle_lh_vor_adf") == -1)); }, is_true: func(nd) { if(nd.get_switch("toggle_lh_vor_adf") < 0){ @@ -1390,7 +1390,7 @@ canvas.NDStyles["Airbus"] = { init: func(nd,symbol), predicate: func(nd) { var path = nd.get_nav_path("vor", 1); - return !(nd.in_mode("toggle_display_mode", ["PLAN"])) and nd.get_switch("toggle_centered") and ((getprop(path~ "in-range") and nd.get_switch("toggle_rh_vor_adf") == 1) or (getprop("instrumentation/adf[1]/in-range") and nd.get_switch("toggle_rh_vor_adf") == -1)); + return !(nd.in_mode("toggle_display_mode", ["PLAN"])) and nd.get_switch("toggle_centered") and ((getprop(path~ "in-range") and nd.get_switch("toggle_rh_vor_adf") == 1) or (getprop("/instrumentation/adf[1]/in-range") and nd.get_switch("toggle_rh_vor_adf") == -1)); }, is_true: func(nd) { if(nd.get_switch("toggle_rh_vor_adf") < 0){ @@ -1415,7 +1415,7 @@ canvas.NDStyles["Airbus"] = { init: func(nd,symbol), predicate: func(nd) { var path = nd.get_nav_path("vor", 0); - return nd.in_mode("toggle_display_mode", ["MAP"]) and !nd.get_switch("toggle_centered") and ((getprop(path~ "in-range") and nd.get_switch("toggle_lh_vor_adf") == 1) or (getprop("instrumentation/adf/in-range") and nd.get_switch("toggle_lh_vor_adf") == -1)); + return nd.in_mode("toggle_display_mode", ["MAP"]) and !nd.get_switch("toggle_centered") and ((getprop(path~ "in-range") and nd.get_switch("toggle_lh_vor_adf") == 1) or (getprop("/instrumentation/adf/in-range") and nd.get_switch("toggle_lh_vor_adf") == -1)); }, is_true: func(nd) { if(nd.get_switch("toggle_lh_vor_adf") < 0){ @@ -1440,7 +1440,7 @@ canvas.NDStyles["Airbus"] = { init: func(nd,symbol), predicate: func(nd) { var path = nd.get_nav_path("vor", 1); - return nd.in_mode("toggle_display_mode", ["MAP"]) and !nd.get_switch("toggle_centered") and ((getprop(path~ "in-range") and nd.get_switch("toggle_rh_vor_adf") == 1) or (getprop("instrumentation/adf[1]/in-range") and nd.get_switch("toggle_rh_vor_adf") == -1)); + return nd.in_mode("toggle_display_mode", ["MAP"]) and !nd.get_switch("toggle_centered") and ((getprop(path~ "in-range") and nd.get_switch("toggle_rh_vor_adf") == 1) or (getprop("/instrumentation/adf[1]/in-range") and nd.get_switch("toggle_rh_vor_adf") == -1)); }, is_true: func(nd) { if(nd.get_switch("toggle_rh_vor_adf") < 0){ @@ -1691,7 +1691,7 @@ canvas.NDStyles["Airbus"] = { init: func(nd,symbol), predicate: func(nd) (nd.get_switch("toggle_display_mode") == "MAP" and !nd.get_switch("toggle_centered")), is_true: func(nd){ - var active = getprop("FMGC/flightplan[2]/active"); + var active = getprop("/FMGC/flightplan[2]/active"); var lat_ctrl = getprop(nd.options.defaults.lat_ctrl); var managed_v = nd.options.defaults.managed_val; var is_managed = (lat_ctrl == managed_v); @@ -1699,7 +1699,7 @@ canvas.NDStyles["Airbus"] = { if((!active or is_managed) and !toggle_xtrk_err){ nd.symbols.legDistL.hide(); } else { - var dist = getprop("instrumentation/gps/wp/wp[1]/course-error-nm"); + var dist = getprop("/instrumentation/gps/wp/wp[1]/course-error-nm"); if(dist == nil or dist == "" or dist > -0.1){ nd.symbols.legDistL.hide(); } else { @@ -1720,7 +1720,7 @@ canvas.NDStyles["Airbus"] = { init: func(nd,symbol), predicate: func(nd) (nd.get_switch("toggle_display_mode") == "MAP" and !nd.get_switch("toggle_centered")), is_true: func(nd){ - var active = getprop("FMGC/flightplan[2]/active"); + var active = getprop("/FMGC/flightplan[2]/active"); var lat_ctrl = getprop(nd.options.defaults.lat_ctrl); var managed_v = nd.options.defaults.managed_val; var is_managed = (lat_ctrl == managed_v); @@ -1728,7 +1728,7 @@ canvas.NDStyles["Airbus"] = { if((!active or is_managed) and !toggle_xtrk_err){ nd.symbols.legDistR.hide(); } else { - var dist = getprop("instrumentation/gps/wp/wp[1]/course-error-nm"); + var dist = getprop("/instrumentation/gps/wp/wp[1]/course-error-nm"); if(dist == nil or dist == "" or dist < 0.1){ nd.symbols.legDistR.hide(); } else { @@ -1749,7 +1749,7 @@ canvas.NDStyles["Airbus"] = { init: func(nd,symbol), predicate: func(nd) (nd.get_switch("toggle_display_mode") == "MAP" and nd.get_switch("toggle_centered")), is_true: func(nd){ - var active = getprop("FMGC/flightplan[2]/active"); + var active = getprop("/FMGC/flightplan[2]/active"); var lat_ctrl = getprop(nd.options.defaults.lat_ctrl); var managed_v = nd.options.defaults.managed_val; var is_managed = (lat_ctrl == managed_v); @@ -1757,7 +1757,7 @@ canvas.NDStyles["Airbus"] = { if((!active or is_managed) and !toggle_xtrk_err){ nd.symbols.legDistCtrL.hide(); } else { - var dist = getprop("instrumentation/gps/wp/wp[1]/course-error-nm"); + var dist = getprop("/instrumentation/gps/wp/wp[1]/course-error-nm"); if(dist == nil or dist == "" or dist > -0.1){ nd.symbols.legDistCtrL.hide(); } else { @@ -1778,7 +1778,7 @@ canvas.NDStyles["Airbus"] = { init: func(nd,symbol), predicate: func(nd) (nd.get_switch("toggle_display_mode") == "MAP" and nd.get_switch("toggle_centered")), is_true: func(nd){ - var active = getprop("FMGC/flightplan[2]/active"); + var active = getprop("/FMGC/flightplan[2]/active"); var lat_ctrl = getprop(nd.options.defaults.lat_ctrl); var managed_v = nd.options.defaults.managed_val; var is_managed = (lat_ctrl == managed_v); @@ -1786,7 +1786,7 @@ canvas.NDStyles["Airbus"] = { if((!active or is_managed) and !toggle_xtrk_err){ nd.symbols.legDistCtrR.hide(); } else { - var dist = getprop("instrumentation/gps/wp/wp[1]/course-error-nm"); + var dist = getprop("/instrumentation/gps/wp/wp[1]/course-error-nm"); if(dist == nil or dist == "" or dist < 0.1){ nd.symbols.legDistCtrR.hide(); } else { @@ -1807,7 +1807,7 @@ canvas.NDStyles["Airbus"] = { init: func(nd,symbol), predicate: func(nd) (nd.in_mode("toggle_display_mode", ["MAP", "PLAN"])), is_true: func(nd){ - var active = getprop("FMGC/flightplan[2]/active"); + var active = getprop("/FMGC/flightplan[2]/active"); var lat_ctrl = getprop(nd.options.defaults.lat_ctrl); var managed_v = nd.options.defaults.managed_val; var is_managed = (lat_ctrl == managed_v); diff --git a/Nasal/MCDU/F-PLN.nas b/Nasal/MCDU/F-PLN.nas index 749f121a..7cc342f6 100644 --- a/Nasal/MCDU/F-PLN.nas +++ b/Nasal/MCDU/F-PLN.nas @@ -342,23 +342,31 @@ var fplnPage = { # this one is only created once, and then updated - remember th #me.basePage(); }, scrollUp: func() { - if (size(me.planList) > 5) { + if (size(me.planList) > 1) { me.scroll += 1; - if (me.scroll > size(me.planList) - 5) { + if (me.scroll > size(me.planList) - 3) { me.scroll = 0; } + if (me.scroll < me.plan.getPlanSize()) { + setprop("/instrumentation/efis[" ~ me.computer ~ "]/inputs/plan-wpt-index", me.scroll); + } } else { me.scroll = 0; + setprop("/instrumentation/efis[" ~ me.computer ~ "]/inputs/plan-wpt-index", -1); } }, scrollDn: func() { - if (size(me.planList) > 5) { + if (size(me.planList) > 1) { me.scroll -= 1; if (me.scroll < 0) { - me.scroll = size(me.planList) - 5; + me.scroll = size(me.planList) - 3; + } + if (me.scroll < me.plan.getPlanSize()) { + setprop("/instrumentation/efis[" ~ me.computer ~ "]/inputs/plan-wpt-index", me.scroll); } } else { me.scroll = 0; + setprop("/instrumentation/efis[" ~ me.computer ~ "]/inputs/plan-wpt-index", -1); } }, pushButtonLeft: func(index) {