I'm having a play around with the Phi radio example, and I'm trying to add on a heading bug input field.
I've think I've got the HTML part right as seen in pic1, but I'm struggling to find out where and how to pull the current heading bug property from, and then how to change it.
- Code: Select all
<!DOCTYPE html>
<html>
<head>
<title>FlightGear - Radio Settings</title>
<meta charset="UTF-8" />
<meta name="description" content="FlightGear - Radio Settings" />
<link href="radio.css" type="text/css" rel="stylesheet" />
</head>
<body>
<div id="wrapper">
<div id="body">
<table id="frequencies">
<tr>
<th colspan="3">Selected</th>
<th> </td>
<th colspan="2">Standby</th>
<th colspan="2">Radial</th>
</tr>
<tr>
<td>COM1</td>
<td><input type="text" id="com1u" class="frq" name="com1u" size="7" maxlength="7" value=""/></td>
<td>MHz</td>
<td><input type="button" id="com1swap" name="com1swap" value="<>"/></td>
<td><input type="text" id="com1s" class="frq" name="com1s" size="7" maxlength="7" value=""/></td>
<td>MHz</td>
<td colspan="2"> </td>
</tr>
<tr>
<td>COM2</td>
<td><input type="text" id="com2u" class="frq" name="com2u" size="7" maxlength="7" value=""/></td>
<td>MHz</td>
<td><input type="button" id="com2swap" name="com2swap" value="<>"/></td>
<td><input type="text" id="com2s" class="frq" name="com2s" size="7" maxlength="7" value=""/></td>
<td>MHz</td>
<td colspan="2"> </td>
</tr>
<tr>
<td>NAV1</td>
<td><input type="text" id="nav1u" class="frq" name="nav1u" size="7" maxlength="7" value=""/></td>
<td>MHz</td>
<td><input type="button" id="nav1swap" name="nav1swap" value="<>"/></td>
<td><input type="text" id="nav1s" class="frq" name="nav1s" size="7" maxlength="7" value=""/></td>
<td>MHz</td>
<td><input type="text" id="nav1rad" class="frq" name="nav1rad" size="3" maxlength="3" value=""/></td>
<td>deg</td>
</tr>
<tr>
<td>NAV2</td>
<td><input type="text" id="nav2u" class="frq" name="nav2u" size="7" maxlength="7" value=""/></td>
<td>MHz</td>
<td><input type="button" id="nav2swap" name="nav2swap" value="<>"/></td>
<td><input type="text" id="nav2s" class="frq" name="nav2s" size="7" maxlength="7" value=""/></td>
<td>MHz</td>
<td><input type="text" id="nav2rad" class="frq" name="nav2rad" size="3" maxlength="3" value=""/></td>
<td>deg</td>
</tr>
<tr>
<td>ADF</td>
<td><input type="text" id="adf1u" class="frq" name="adf1u" size="7" maxlength="7" value=""/></td>
<td>kHz</td>
<td><input type="button" id="adf1swap" name="adf1swap" value="<>"/></td>
<td><input type="text" id="adf1s" class="frq" name="adf1s" size="7" maxlength="7" value=""/></td>
<td>kHz</td>
<td><input type="text" id="adf1rad" class="frq" name="adf1rad" size="3" maxlength="3" value=""/></td>
<td>deg</td>
</tr>
<tr>
<td>DME</td>
<td><input type="text" id="dme1u" class="frq" name="dme1u" size="7" maxlength="7" value=""/></td>
<td>MHz</td>
<td colspan="5"> </td>
</tr>
<tr>
<td>BUG</td>
<td><input type="text" id="hbug" class="frq" name="hbug" size="7" maxlength="7" value=""/></td>
<td>deg</td>
<td colspan="5"> </td>
</tr>
</table>
</div>
<div id="footer">
</div>
</div>
<script src="../3rdparty/jquery/jquery-1.11.1.min.js" type="text/javascript"></script>
<script src="../lib/fgcommand.js" type="text/javascript"></script>
<script src="../lib/props.js" type="text/javascript"></script>
<script src="radio.js" type="text/javascript"></script>
</body>
</html>
I've edited the radio.js file as shown below to include what I thought was the heading bug stuff, but obviously it's not.
- Code: Select all
$(document).ready(
function() {
var rp = new Array();
rp["#com1u"] = "/instrumentation/comm/frequencies/selected-mhz";
rp["#com1s"] = "/instrumentation/comm/frequencies/standby-mhz";
rp["#nav1u"] = "/instrumentation/nav/frequencies/selected-mhz";
rp["#nav1s"] = "/instrumentation/nav/frequencies/standby-mhz";
rp["#com2u"] = "/instrumentation/comm[1]/frequencies/selected-mhz";
rp["#com2s"] = "/instrumentation/comm[1]/frequencies/standby-mhz";
rp["#nav2u"] = "/instrumentation/nav[1]/frequencies/selected-mhz";
rp["#nav2s"] = "/instrumentation/nav[1]/frequencies/standby-mhz";
rp["#adf1u"] = "/instrumentation/adf/frequencies/selected-khz";
rp["#adf1s"] = "/instrumentation/adf/frequencies/standby-khz";
rp["#dme1u"] = "/instrumentation/dme/frequencies/selected-mhz";
rp["#hbug"] = "/autopilot/settings/heading-bug-deg";
$("#com1u").change(function(o) {
fgCommand.propertyAssign(rp["#com1u"], $("#com1u").val());
});
$("#com1s").change(function(o) {
fgCommand.propertyAssign(rp["#com1s"], $("#com1s").val());
});
$("#nav1u").change(function(o) {
fgCommand.propertyAssign(rp["#nav1u"], $("#nav1u").val());
});
$("#nav1s").change(function(o) {
fgCommand.propertyAssign(rp["#nav1s"], $("#nav1s").val());
});
$("#com2u").change(function(o) {
fgCommand.propertyAssign(rp["#com2u"], $("#com2u").val());
});
$("#com2s").change(function(o) {
fgCommand.propertyAssign(rp["#com2s"], $("#com2s").val());
});
$("#nav2u").change(function(o) {
fgCommand.propertyAssign(rp["#nav2u"], $("#nav2u").val());
});
$("#nav2s").change(function(o) {
fgCommand.propertyAssign(rp["#nav2s"], $("#nav2s").val());
});
$("#adf1u").change(function(o) {
fgCommand.propertyAssign(rp["#adf1u"], $("#adf1u").val());
});
$("#adf1s").change(function(o) {
fgCommand.propertyAssign(rp["#adf1s"], $("#adf1s").val());
});
$("#dme1u").change(function(o) {
fgCommand.propertyAssign(rp["#dme1u"], $("#dme1u").val());
});
$("#hbug").change(function(o) {
fgCommand.propertyAssign(rp["#hbug"], $("#hbug").val());
});
$("#com1swap").click(function() {
fgCommand.propertySwap(rp["#com1u"], rp["#com1s"]);
});
$("#nav1swap").click(function() {
fgCommand.propertySwap(rp["#nav1u"], rp["#nav1s"]);
});
$("#com2swap").click(function() {
fgCommand.propertySwap(rp["#com2u"], rp["#com2s"]);
});
$("#nav2swap").click(function() {
fgCommand.propertySwap(rp["#nav2u"], rp["#nav2s"]);
});
$("#adf1swap").click(function() {
fgCommand.propertySwap(rp["#adf1u"], rp["#adf1s"]);
});
PropertyChangeListener(function() {
SetListener( rp["#com1u"], function(n) {
$("#com1u").val( n.value );
});
SetListener( rp["#com1s"], function(n) {
$("#com1s").val( n.value );
});
SetListener( rp["#nav1u"], function(n) {
$("#nav1u").val( n.value );
});
SetListener( rp["#nav1s"], function(n) {
$("#nav1s").val( n.value );
});
SetListener( rp["#com2u"], function(n) {
$("#com2u").val( n.value );
});
SetListener( rp["#com2s"], function(n) {
$("#com2s").val( n.value );
});
SetListener( rp["#nav2u"], function(n) {
$("#nav2u").val( n.value );
});
SetListener( rp["#nav2s"], function(n) {
$("#nav2s").val( n.value );
});
SetListener( rp["#adf1u"], function(n) {
$("#adf1u").val( n.value );
});
SetListener( rp["#adf1s"], function(n) {
$("#adf1s").val( n.value );
});
SetListener( rp["#dme1u"], function(n) {
$("#dme1u").val( n.value );
});
SetListener( rp["#hbug"], function(n) {
$("#hbug").val( n.value );
});
});
});
But, I can't for the life of me work out how to get it working. I've been through multiple xml files and tried different heading bug things, but to no avail. Any help would be appreciated .
Also, as you can see, the radials aren't getting pulled up, and they didn't before I edited anything.
Thanks, John.
Linux mint
FG 2018.2.2