1
0
Fork 0

FG1000: Make VFR transponder code configurable

Reads from /instrumentation/transponder/factory-vfr-code
on startup.
This commit is contained in:
Stuart Buchanan 2020-08-21 15:06:30 +01:00
parent 8a7bc16829
commit f374bfabcb
3 changed files with 16 additions and 3 deletions

View file

@ -118,6 +118,7 @@ var ConfigStore = {
"Vglide-visible" : 1, "Vglide-visible" : 1,
"Vne-visible": 1, "Vne-visible": 1,
"TransponderVFRCode" : 1200,
}, },
new : func() new : func()
@ -146,6 +147,8 @@ var ConfigStore = {
obj._layerRanges[i] = ConfigStore.layerRanges[i]; obj._layerRanges[i] = ConfigStore.layerRanges[i];
} }
obj.updateVFRTransponderCode();
return obj; return obj;
}, },
@ -203,4 +206,10 @@ var ConfigStore = {
me._layerRanges[layer].range = math.min(range, me._layerRanges[layer].max_range); me._layerRanges[layer].range = math.min(range, me._layerRanges[layer].max_range);
}, },
updateVFRTransponderCode : func() {
# Special case VFR transponder code
var vfr_default = props.globals.getNode("/instrumentation/transponder/factory-vfr-code", 1);
if (vfr_default.getValue()) me.set("TransponderVFRCode", vfr_default.getValue());
},
}; };

View file

@ -305,8 +305,7 @@ var PFDInstruments =
}, },
setVFR : func(device, pg, menuitem) { setVFR : func(device, pg, menuitem) {
# Set VFR Mode - 1200 pg.getController().setVFRTransponderCode();
pg.getController().setTransponderCode(1200);
}, },
setIdent : func(device, pg, menuitem) { setIdent : func(device, pg, menuitem) {

View file

@ -96,7 +96,6 @@ var PFDInstrumentsController =
_adf_heading_deg : 0.0, _adf_heading_deg : 0.0,
_transponder_mode : 0, _transponder_mode : 0,
_transponder_code : "1200", # Current code
_transponder_ident : 0, _transponder_ident : 0,
_transponder_edit : 0, # If we're currently editing the transponder code _transponder_edit : 0, # If we're currently editing the transponder code
_transponder_edit_code : 0, # Current value being edited as transponder code _transponder_edit_code : 0, # Current value being edited as transponder code
@ -106,6 +105,8 @@ var PFDInstrumentsController =
_marker_beacon_inner : 0, _marker_beacon_inner : 0,
}; };
obj._transponder_code = page.mfd.ConfigStore.get("TransponderVFRCode");
obj._current_flightplan = obj.getNavData("Flightplan"); obj._current_flightplan = obj.getNavData("Flightplan");
if (obj._current_flightplan != nil) { if (obj._current_flightplan != nil) {
obj._fp_current_wp = obj._current_flightplan.current; obj._fp_current_wp = obj._current_flightplan.current;
@ -568,6 +569,10 @@ var PFDInstrumentsController =
} }
}, },
setVFRTransponderCode : func() {
me.sendNavComDataNotification({"TransponderCode" : me.page.mfd.ConfigStore.get("TransponderVFRCode")});
},
setTransponderCode : func(code) { setTransponderCode : func(code) {
me.sendNavComDataNotification({"TransponderCode" : code}); me.sendNavComDataNotification({"TransponderCode" : code});
}, },