summaryrefslogtreecommitdiffstats
path: root/usr/local/www/services_ntpd_gps.php
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2015-05-24 15:02:16 +0545
committerPhil Davis <phil.davis@inf.org>2015-05-24 15:02:16 +0545
commit7a6f0ebcbed31ef668f422d9fc6cdcabf788df71 (patch)
tree1f8925a22c7b5815c63ace7f3a47ff8a68079552 /usr/local/www/services_ntpd_gps.php
parent88cbd0049b78bd731648be68c13e08161e5e943c (diff)
downloadpfsense-7a6f0ebcbed31ef668f422d9fc6cdcabf788df71.zip
pfsense-7a6f0ebcbed31ef668f422d9fc6cdcabf788df71.tar.gz
Code style services NTP
Diffstat (limited to 'usr/local/www/services_ntpd_gps.php')
-rw-r--r--usr/local/www/services_ntpd_gps.php500
1 files changed, 264 insertions, 236 deletions
diff --git a/usr/local/www/services_ntpd_gps.php b/usr/local/www/services_ntpd_gps.php
index 7afe24c..c8098c1 100644
--- a/usr/local/www/services_ntpd_gps.php
+++ b/usr/local/www/services_ntpd_gps.php
@@ -45,10 +45,12 @@ require_once("guiconfig.inc");
function set_default_gps() {
global $config;
- if (!is_array($config['ntpd']))
+ if (!is_array($config['ntpd'])) {
$config['ntpd'] = array();
- if (is_array($config['ntpd']['gps']))
+ }
+ if (is_array($config['ntpd']['gps'])) {
unset($config['ntpd']['gps']);
+ }
$config['ntpd']['gps'] = array();
$config['ntpd']['gps']['type'] = 'Default';
@@ -67,85 +69,102 @@ if ($_POST) {
unset($input_errors);
- if (!empty($_POST['gpsport']) && file_exists('/dev/'.$_POST['gpsport']))
+ if (!empty($_POST['gpsport']) && file_exists('/dev/'.$_POST['gpsport'])) {
$config['ntpd']['gps']['port'] = $_POST['gpsport'];
- /* if port is not set, remove all the gps config */
- else unset($config['ntpd']['gps']);
+ } else {
+ /* if port is not set, remove all the gps config */
+ unset($config['ntpd']['gps']);
+ }
- if (!empty($_POST['gpstype']))
+ if (!empty($_POST['gpstype'])) {
$config['ntpd']['gps']['type'] = $_POST['gpstype'];
- elseif (isset($config['ntpd']['gps']['type']))
+ } elseif (isset($config['ntpd']['gps']['type'])) {
unset($config['ntpd']['gps']['type']);
+ }
- if (!empty($_POST['gpsspeed']))
+ if (!empty($_POST['gpsspeed'])) {
$config['ntpd']['gps']['speed'] = $_POST['gpsspeed'];
- elseif (isset($config['ntpd']['gps']['speed']))
+ } elseif (isset($config['ntpd']['gps']['speed'])) {
unset($config['ntpd']['gps']['speed']);
+ }
- if (!empty($_POST['gpsnmea']) && ($_POST['gpsnmea'][0] === "0"))
+ if (!empty($_POST['gpsnmea']) && ($_POST['gpsnmea'][0] === "0")) {
$config['ntpd']['gps']['nmea'] = "0";
- else
+ } else {
$config['ntpd']['gps']['nmea'] = strval(array_sum($_POST['gpsnmea']));
+ }
- if (!empty($_POST['gpsfudge1']))
+ if (!empty($_POST['gpsfudge1'])) {
$config['ntpd']['gps']['fudge1'] = $_POST['gpsfudge1'];
- elseif (isset($config['ntpd']['gps']['fudge1']))
+ } elseif (isset($config['ntpd']['gps']['fudge1'])) {
unset($config['ntpd']['gps']['fudge1']);
+ }
- if (!empty($_POST['gpsfudge2']))
+ if (!empty($_POST['gpsfudge2'])) {
$config['ntpd']['gps']['fudge2'] = $_POST['gpsfudge2'];
- elseif (isset($config['ntpd']['gps']['fudge2']))
+ } elseif (isset($config['ntpd']['gps']['fudge2'])) {
unset($config['ntpd']['gps']['fudge2']);
+ }
- if (!empty($_POST['gpsstratum']) && ($_POST['gpsstratum']) < 17 )
+ if (!empty($_POST['gpsstratum']) && ($_POST['gpsstratum']) < 17) {
$config['ntpd']['gps']['stratum'] = $_POST['gpsstratum'];
- elseif (isset($config['ntpd']['gps']['stratum']))
+ } elseif (isset($config['ntpd']['gps']['stratum'])) {
unset($config['ntpd']['gps']['stratum']);
+ }
- if (empty($_POST['gpsprefer']))
+ if (empty($_POST['gpsprefer'])) {
$config['ntpd']['gps']['prefer'] = 'on';
- elseif (isset($config['ntpd']['gps']['prefer']))
+ } elseif (isset($config['ntpd']['gps']['prefer'])) {
unset($config['ntpd']['gps']['prefer']);
+ }
- if (!empty($_POST['gpsselect']))
+ if (!empty($_POST['gpsselect'])) {
$config['ntpd']['gps']['noselect'] = $_POST['gpsselect'];
- elseif (isset($config['ntpd']['gps']['noselect']))
+ } elseif (isset($config['ntpd']['gps']['noselect'])) {
unset($config['ntpd']['gps']['noselect']);
+ }
- if (!empty($_POST['gpsflag1']))
+ if (!empty($_POST['gpsflag1'])) {
$config['ntpd']['gps']['flag1'] = $_POST['gpsflag1'];
- elseif (isset($config['ntpd']['gps']['flag1']))
+ } elseif (isset($config['ntpd']['gps']['flag1'])) {
unset($config['ntpd']['gps']['flag1']);
+ }
- if (!empty($_POST['gpsflag2']))
+ if (!empty($_POST['gpsflag2'])) {
$config['ntpd']['gps']['flag2'] = $_POST['gpsflag2'];
- elseif (isset($config['ntpd']['gps']['flag2']))
+ } elseif (isset($config['ntpd']['gps']['flag2'])) {
unset($config['ntpd']['gps']['flag2']);
+ }
- if (!empty($_POST['gpsflag3']))
+ if (!empty($_POST['gpsflag3'])) {
$config['ntpd']['gps']['flag3'] = $_POST['gpsflag3'];
- elseif (isset($config['ntpd']['gps']['flag3']))
+ } elseif (isset($config['ntpd']['gps']['flag3'])) {
unset($config['ntpd']['gps']['flag3']);
+ }
- if (!empty($_POST['gpsflag4']))
+ if (!empty($_POST['gpsflag4'])) {
$config['ntpd']['gps']['flag4'] = $_POST['gpsflag4'];
- elseif (isset($config['ntpd']['gps']['flag4']))
+ } elseif (isset($config['ntpd']['gps']['flag4'])) {
unset($config['ntpd']['gps']['flag4']);
+ }
- if (!empty($_POST['gpssubsec']))
+ if (!empty($_POST['gpssubsec'])) {
$config['ntpd']['gps']['subsec'] = $_POST['gpssubsec'];
- elseif (isset($config['ntpd']['gps']['subsec']))
+ } elseif (isset($config['ntpd']['gps']['subsec'])) {
unset($config['ntpd']['gps']['subsec']);
+ }
- if (!empty($_POST['gpsrefid']))
+ if (!empty($_POST['gpsrefid'])) {
$config['ntpd']['gps']['refid'] = $_POST['gpsrefid'];
- elseif (isset($config['ntpd']['gps']['refid']))
+ } elseif (isset($config['ntpd']['gps']['refid'])) {
unset($config['ntpd']['gps']['refid']);
+ }
- if (!empty($_POST['gpsinitcmd']))
+ if (!empty($_POST['gpsinitcmd'])) {
$config['ntpd']['gps']['initcmd'] = base64_encode($_POST['gpsinitcmd']);
- elseif (isset($config['ntpd']['gps']['initcmd']))
+ } elseif (isset($config['ntpd']['gps']['initcmd'])) {
unset($config['ntpd']['gps']['initcmd']);
+ }
write_config("Updated NTP GPS Settings");
@@ -159,7 +178,7 @@ if ($_POST) {
}
$closehead = false;
$pconfig = &$config['ntpd']['gps'];
-$pgtitle = array(gettext("Services"),gettext("NTP GPS"));
+$pgtitle = array(gettext("Services"), gettext("NTP GPS"));
$shortcut_section = "ntp";
include("head.inc");
?>
@@ -261,7 +280,7 @@ SureGPS = #Sure Electronics SKG16B
var type = e.options[e.selectedIndex].text;
//stuff the JS object as needed for each type
- switch(type) {
+ switch (type) {
case "Default":
gpsdef['nmea'] = 0;
gpsdef['speed'] = 0;
@@ -341,7 +360,7 @@ SureGPS = #Sure Electronics SKG16B
function NMEAChecksum(cmd) {
// Compute the checksum by XORing all the character values in the string.
var checksum = 0;
- for(var i = 0; i < cmd.length; i++) {
+ for (var i = 0; i < cmd.length; i++) {
checksum = checksum ^ cmd.charCodeAt(i);
}
// Convert it to hexadecimal (base-16, upper case, most significant byte first).
@@ -362,7 +381,8 @@ SureGPS = #Sure Electronics SKG16B
<?php if ($savemsg) print_info_box($savemsg); ?>
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="ntpd gps">
- <tr><td>
+ <tr>
+ <td>
<?php
$tab_array = array();
$tab_array[] = array(gettext("NTP"), false, "services_ntpd.php");
@@ -370,215 +390,223 @@ SureGPS = #Sure Electronics SKG16B
$tab_array[] = array(gettext("PPS"), false, "services_ntpd_pps.php");
display_top_tabs($tab_array);
?>
- </td></tr>
- <tr><td>
- <div id="mainarea">
- <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
- <tr>
- <td colspan="2" valign="top" class="listtopic"><?=gettext("NTP Serial GPS Configuration"); ?></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">
- </td>
- <td width="78%" class="vtable">A GPS connected via a serial port may be used as a reference clock for NTP. If the GPS also supports PPS and is properly configured, and connected, that GPS may also be used as a Pulse Per Second clock reference. NOTE: a USB GPS may work, but is not recommended due to USB bus timing issues.
- <br />
- <br /><?php echo gettext("For the best results, NTP should have at least three sources of time. So it is best to configure at least 2 servers under"); ?> <a href="services_ntpd.php"><?php echo gettext("Services > NTP"); ?></a> <?php echo gettext("to minimize clock drift if the GPS data is not valid over time. Otherwise ntpd may only use values from the unsynchronized local clock when providing time to clients."); ?>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq"><?=gettext("GPS"); ?></td>
- <td width="78%" valign="top" class="vtable">
- <!-- Start with the original "Default", list a "Generic" and then specific configs alphabetically -->
- <select id="gpstype" name="gpstype" class="formselect" onchange="set_gps_default(this.form)">
- <option value="Custom"<?php if($pconfig['type'] == 'Custom') echo " selected=\"selected\""; ?>>Custom</option>
- <option value="Default"<?php if($pconfig['type'] == 'Default') echo " selected=\"selected\""; ?>>Default</option>
- <option value="Generic" title="Generic"<?php if($pconfig['type'] == 'Generic') echo " selected=\"selected\"";?>>Generic</option>
- <option value="Garmin" title="$PGRM... Most Garmin"<?php if($pconfig['type'] == 'Garmin') echo " selected=\"selected\"";?>>Garmin</option>
- <option value="MediaTek" title="$PMTK... Adafruit, Fastrax, some Garmin and others"<?php if($pconfig['type'] == 'MediaTek') echo " selected=\"selected\"";?>>MediaTek</option>
- <option value="SiRF" title="$PSRF... Used by many devices"<?php if($pconfig['type'] == 'sirf') echo " selected=\"selected\"";?>>SiRF</option>
- <option value="U-Blox" title="$PUBX... U-Blox 5, 6 and probably 7"<?php if($pconfig['type'] == 'U-Blox') echo " selected=\"selected\"";?>>U-Blox</option>
- <option value="SureGPS" title="$PMTK... Sure Electronics SKG16B"<?php if($pconfig['type'] == 'SureGPS') echo " selected=\"selected\"";?>>SureGPS</option>
- </select> <?php echo gettext("This option allows you to select a predefined configuration.");?>
- <br />
- <br />
- <strong><?php echo gettext("Note: ");?></strong><?php echo gettext("Default is the configuration of pfSense 2.1 and earlier"); ?>
- <?php echo gettext(" (not recommended). Select Generic if your GPS is not listed.)"); ?><br />
- <strong><?php echo gettext("Note: ");?></strong><?php echo gettext("The perdefined configurations assume your GPS has already been set to NMEA mode."); ?>
- </td>
- </tr>
-
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <div id="mainarea">
+ <table class="tabcont" width="100%" border="0" cellpadding="6" cellspacing="0" summary="main area">
+ <tr>
+ <td colspan="2" valign="top" class="listtopic"><?=gettext("NTP Serial GPS Configuration"); ?></td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">
+ </td>
+ <td width="78%" class="vtable">A GPS connected via a serial port may be used as a reference clock for NTP. If the GPS also supports PPS and is properly configured, and connected, that GPS may also be used as a Pulse Per Second clock reference. NOTE: a USB GPS may work, but is not recommended due to USB bus timing issues.
+ <br />
+ <br /><?php echo gettext("For the best results, NTP should have at least three sources of time. So it is best to configure at least 2 servers under"); ?> <a href="services_ntpd.php"><?php echo gettext("Services > NTP"); ?></a> <?php echo gettext("to minimize clock drift if the GPS data is not valid over time. Otherwise ntpd may only use values from the unsynchronized local clock when providing time to clients."); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq"><?=gettext("GPS"); ?></td>
+ <td width="78%" valign="top" class="vtable">
+ <!-- Start with the original "Default", list a "Generic" and then specific configs alphabetically -->
+ <select id="gpstype" name="gpstype" class="formselect" onchange="set_gps_default(this.form)">
+ <option value="Custom"<?php if ($pconfig['type'] == 'Custom') echo " selected=\"selected\""; ?>>Custom</option>
+ <option value="Default"<?php if ($pconfig['type'] == 'Default') echo " selected=\"selected\""; ?>>Default</option>
+ <option value="Generic" title="Generic"<?php if ($pconfig['type'] == 'Generic') echo " selected=\"selected\"";?>>Generic</option>
+ <option value="Garmin" title="$PGRM... Most Garmin"<?php if ($pconfig['type'] == 'Garmin') echo " selected=\"selected\"";?>>Garmin</option>
+ <option value="MediaTek" title="$PMTK... Adafruit, Fastrax, some Garmin and others"<?php if ($pconfig['type'] == 'MediaTek') echo " selected=\"selected\"";?>>MediaTek</option>
+ <option value="SiRF" title="$PSRF... Used by many devices"<?php if ($pconfig['type'] == 'sirf') echo " selected=\"selected\"";?>>SiRF</option>
+ <option value="U-Blox" title="$PUBX... U-Blox 5, 6 and probably 7"<?php if ($pconfig['type'] == 'U-Blox') echo " selected=\"selected\"";?>>U-Blox</option>
+ <option value="SureGPS" title="$PMTK... Sure Electronics SKG16B"<?php if ($pconfig['type'] == 'SureGPS') echo " selected=\"selected\"";?>>SureGPS</option>
+ </select>
+ <?php echo gettext("This option allows you to select a predefined configuration.");?>
+ <br />
+ <br />
+ <strong><?php echo gettext("Note: ");?></strong><?php echo gettext("Default is the configuration of pfSense 2.1 and earlier"); ?>
+ <?php echo gettext(" (not recommended). Select Generic if your GPS is not listed.)"); ?><br />
+ <strong><?php echo gettext("Note: ");?></strong><?php echo gettext("The perdefined configurations assume your GPS has already been set to NMEA mode."); ?>
+ </td>
+ </tr>
<?php
/* Probing would be nice, but much more complex. Would need to listen to each port for 1s+ and watch for strings. */
$serialports = glob("/dev/cua?[0-9]{,.[0-9]}", GLOB_BRACE);
if (!empty($serialports)):
?>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Serial port</td>
- <td width="78%" class="vtable">
- <select name="gpsport" class="formselect">
- <option value="">none</option>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Serial port</td>
+ <td width="78%" class="vtable">
+ <select name="gpsport" class="formselect">
+ <option value="">none</option>
<?php
- foreach ($serialports as $port):
- $shortport = substr($port,5);
- $selected = ($shortport == $pconfig['port']) ? " selected=\"selected\"" : "";
+ foreach ($serialports as $port):
+ $shortport = substr($port, 5);
+ $selected = ($shortport == $pconfig['port']) ? " selected=\"selected\"" : "";
?>
- <option value="<?php echo $shortport;?>"<?php echo $selected;?>><?php echo $shortport;?></option>
+ <option value="<?php echo $shortport;?>"<?php echo $selected;?>><?php echo $shortport;?></option>
<?php
- endforeach;
+ endforeach;
?>
- </select>&nbsp;
- <?php echo gettext("All serial ports are listed, be sure to pick the port with the GPS attached."); ?>
- <br /><br />
- <select id="gpsspeed" name="gpsspeed" class="formselect">
- <option value="0"<?php if(!$pconfig['speed']) echo " selected=\"selected\""; ?>>4800</option>
- <option value="16"<?php if($pconfig['speed'] === '16') echo " selected=\"selected\"";?>>9600</option>
- <option value="32"<?php if($pconfig['speed'] === '32') echo " selected=\"selected\"";?>>19200</option>
- <option value="48"<?php if($pconfig['speed'] === '48') echo " selected=\"selected\"";?>>38400</option>
- <option value="64"<?php if($pconfig['speed'] === '64') echo " selected=\"selected\"";?>>57600</option>
- <option value="80"<?php if($pconfig['speed'] === '80') echo " selected=\"selected\"";?>>115200</option>
- </select>&nbsp;<?php echo gettext("Serial port baud rate."); ?>
- <br />
- <br />
- <?php echo gettext("Note: A higher baud rate is generally only helpful if the GPS is sending too many sentences. It is recommended to configure the GPS to send only one sentence at a baud rate of 4800 or 9600."); ?>
- </td>
- </tr>
+ </select>&nbsp;
+ <?php echo gettext("All serial ports are listed, be sure to pick the port with the GPS attached."); ?>
+ <br /><br />
+ <select id="gpsspeed" name="gpsspeed" class="formselect">
+ <option value="0"<?php if (!$pconfig['speed']) echo " selected=\"selected\""; ?>>4800</option>
+ <option value="16"<?php if ($pconfig['speed'] === '16') echo " selected=\"selected\"";?>>9600</option>
+ <option value="32"<?php if ($pconfig['speed'] === '32') echo " selected=\"selected\"";?>>19200</option>
+ <option value="48"<?php if ($pconfig['speed'] === '48') echo " selected=\"selected\"";?>>38400</option>
+ <option value="64"<?php if ($pconfig['speed'] === '64') echo " selected=\"selected\"";?>>57600</option>
+ <option value="80"<?php if ($pconfig['speed'] === '80') echo " selected=\"selected\"";?>>115200</option>
+ </select>&nbsp;<?php echo gettext("Serial port baud rate."); ?>
+ <br />
+ <br />
+ <?php echo gettext("Note: A higher baud rate is generally only helpful if the GPS is sending too many sentences. It is recommended to configure the GPS to send only one sentence at a baud rate of 4800 or 9600."); ?>
+ </td>
+ </tr>
<?php
endif;
?>
- <tr>
- <!-- 1 = RMC, 2 = GGA, 4 = GLL, 8 = ZDA or ZDG -->
- <td width="22%" valign="top" class="vncellreq">NMEA sentences</td>
- <td width="78%" class="vtable">
- <select id="gpsnmea" name="gpsnmea[]" multiple="multiple" class="formselect" size="5">
- <option value="0"<?php if(!$pconfig['nmea']) echo " selected=\"selected\""; ?>>All</option>
- <option value="1"<?php if($pconfig['nmea'] & 1) echo " selected=\"selected\"";?>>RMC</option>
- <option value="2"<?php if($pconfig['nmea'] & 2) echo " selected=\"selected\"";?>>GGA</option>
- <option value="4"<?php if($pconfig['nmea'] & 4) echo " selected=\"selected\"";?>>GLL</option>
- <option value="8"<?php if($pconfig['nmea'] & 8) echo " selected=\"selected\"";?>>ZDA or ZDG</option>
- </select><br />
- <?php echo gettext("By default NTP will listen for all supported NMEA sentences. Here one or more sentences to listen for may be specified."); ?>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Fudge time 1</td>
- <td width="78%" class="vtable">
- <input name="gpsfudge1" type="text" class="formfld unknown" id="gpsfudge1" min="-1" max="1" size="20" value="<?=htmlspecialchars($pconfig['fudge1']);?>" />(<?php echo gettext("seconds");?>)<br />
- <?php echo gettext("Fudge time 1 is used to specify the GPS PPS signal offset");?> (<?php echo gettext("default");?>: 0.0).</td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Fudge time 2</td>
- <td width="78%" class="vtable">
- <input name="gpsfudge2" type="text" class="formfld unknown" id="gpsfudge2" min="-1" max="1" size="20" value="<?=htmlspecialchars($pconfig['fudge2']);?>" />(<?php echo gettext("seconds");?>)<br />
- <?php echo gettext("Fudge time 2 is used to specify the GPS time offset");?> (<?php echo gettext("default");?>: 0.0).</td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Stratum</td>
- <td width="78%" class="vtable">
- <input name="gpsstratum" type="text" class="formfld unknown" id="gpsstratum" max="16" size="20" value="<?=htmlspecialchars($pconfig['stratum']);?>" /><?php echo gettext("(0-16)");?><br />
- <?php echo gettext("This may be used to change the GPS Clock stratum");?> (<?php echo gettext("default");?>: 0). <?php echo gettext("This may be useful if, for some reason, you want ntpd to prefer a different clock"); ?></td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Flags</td>
- <td width="78%" class="vtable">
- <table>
- <tr>
- <td>
- <?php echo gettext("Normally there should be no need to change these options from the defaults."); ?><br />
- </td>
- </tr>
- </table>
- <table>
- <tr>
- <td>
- <input name="gpsprefer" type="checkbox" class="formcheckbox" id="gpsprefer" onclick="ToggleOther('gpsprefer', 'gpsselect')"<?php if(!$pconfig['prefer']) echo " checked=\"checked\""; ?> />
- </td>
- <td>
- <span class="vexpl"><?php echo gettext("NTP should prefer this clock (default: enabled)."); ?></span>
- </td>
- </tr>
- <tr>
- <td>
- <input name="gpsselect" type="checkbox" class="formcheckbox" id="gpsselect" onclick="ToggleOther('gpsselect', 'gpsprefer')"<?php if($pconfig['noselect']) echo " checked=\"checked\""; ?> />
- </td>
- <td>
- <span class="vexpl"><?php echo gettext("NTP should not use this clock, it will be displayed for reference only(default: disabled)."); ?></span>
- </td>
- </tr>
- <tr>
- <td>
- <input name="gpsflag1" type="checkbox" class="formcheckbox" id="gpsflag1"<?php if($pconfig['flag1']) echo " checked=\"checked\""; ?> />
- </td>
- <td>
- <span class="vexpl"><?php echo gettext("Enable PPS signal processing (default: enabled)."); ?></span>
- </td>
- </tr>
- <tr>
- <td>
- <input name="gpsflag2" type="checkbox" class="formcheckbox" id="gpsflag2"<?php if($pconfig['flag2']) echo " checked=\"checked\""; ?> />
- </td>
- <td>
- <span class="vexpl"><?php echo gettext("Enable falling edge PPS signal processing (default: rising edge)."); ?></span>
- </td>
- </tr>
- <tr>
- <td>
- <input name="gpsflag3" type="checkbox" class="formcheckbox" id="gpsflag3"<?php if($pconfig['flag3']) echo " checked=\"checked\""; ?> />
- </td>
- <td>
- <span class="vexpl"><?php echo gettext("Enable kernel PPS clock discipline (default: enabled)."); ?></span>
- </td>
- </tr>
- <tr>
- <td>
- <input name="gpsflag4" type="checkbox" class="formcheckbox" id="gpsflag4"<?php if($pconfig['flag4']) echo " checked=\"checked\""; ?> />
- </td>
- <td>
- <span class="vexpl"><?php echo gettext("Obscure location in timestamp (default: unobscured)."); ?></span>
- </td>
- </tr>
- <tr>
- <td>
- <input name="gpssubsec" type="checkbox" class="formcheckbox" id="gpssubsec"<?php if($pconfig['subsec']) echo " checked=\"checked\""; ?> />
- </td>
- <td>
- <span class="vexpl"><?php echo gettext("Log the sub-second fraction of the received time stamp (default: Not logged).<br />Note: enabling this will rapidly fill the log, but is useful for tuning Fudge time 2."); ?></span>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">Clock ID</td>
- <td width="78%" class="vtable">
- <input name="gpsrefid" type="text" class="formfld unknown" id="gpsrefid" maxlength= "4" size="20" value="<?=htmlspecialchars($pconfig['refid']);?>" /><?php echo gettext("(1 to 4 charactors)");?><br />
- <?php echo gettext("This may be used to change the GPS Clock ID");?> (<?php echo gettext("default");?>: GPS).</td>
- </tr>
- <tr>
- <td width="22%" valign="top" class="vncellreq">GPS Initialization</td>
- <td width="78%" class="vtable">
- <div id="showgpsinitbox">
- <input type="button" onclick="show_advanced('showgpsinitbox', 'showgpsinit')" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show GPS Initialization commands");?>
- </div>
- <div id="showgpsinit" style="display:none">
- <p>
- <textarea name="gpsinitcmd" class="formpre" id="gpsinitcmd" cols="65" rows="7"><?=htmlspecialchars(base64_decode($pconfig['initcmd'])); /*resultmatch*/?></textarea><br />
- <?php echo gettext("Note: Commands entered here will be sent to the GPS during initialization. Please read and understand your GPS documentation before making any changes here.");?><br /><br />
- <strong><?php echo gettext("NMEA checksum calculator");?>:</strong>
- <br />
- <?php echo gettext("Enter the text between &quot;$&quot; and &quot;*&quot; of a NMEA command string:");?><br /> $<input name="nmeastring" type="text" class="formfld unknown" id="nmeastring" size="30" value="" />*<span id="nmeachecksum"><?php echo gettext("checksum");?></span>&nbsp;&nbsp;
- <input type="button" onclick="NMEAChecksum(nmeastring.value)" value="<?=gettext("Calculate NMEA checksum");?>" /><br /></p>
- </div>
- </td>
- </tr>
- <tr>
- <td width="22%" valign="top">&nbsp;</td>
- <td width="78%">
- <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
- </td>
- </tr>
- </table>
- </div>
- </td></tr>
+ <tr>
+ <!-- 1 = RMC, 2 = GGA, 4 = GLL, 8 = ZDA or ZDG -->
+ <td width="22%" valign="top" class="vncellreq">NMEA sentences</td>
+ <td width="78%" class="vtable">
+ <select id="gpsnmea" name="gpsnmea[]" multiple="multiple" class="formselect" size="5">
+ <option value="0"<?php if (!$pconfig['nmea']) echo " selected=\"selected\""; ?>>All</option>
+ <option value="1"<?php if ($pconfig['nmea'] & 1) echo " selected=\"selected\"";?>>RMC</option>
+ <option value="2"<?php if ($pconfig['nmea'] & 2) echo " selected=\"selected\"";?>>GGA</option>
+ <option value="4"<?php if ($pconfig['nmea'] & 4) echo " selected=\"selected\"";?>>GLL</option>
+ <option value="8"<?php if ($pconfig['nmea'] & 8) echo " selected=\"selected\"";?>>ZDA or ZDG</option>
+ </select><br />
+ <?php echo gettext("By default NTP will listen for all supported NMEA sentences. Here one or more sentences to listen for may be specified."); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Fudge time 1</td>
+ <td width="78%" class="vtable">
+ <input name="gpsfudge1" type="text" class="formfld unknown" id="gpsfudge1" min="-1" max="1" size="20" value="<?=htmlspecialchars($pconfig['fudge1']);?>" />(<?php echo gettext("seconds");?>)<br />
+ <?php echo gettext("Fudge time 1 is used to specify the GPS PPS signal offset");?> (<?php echo gettext("default");?>: 0.0).
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Fudge time 2</td>
+ <td width="78%" class="vtable">
+ <input name="gpsfudge2" type="text" class="formfld unknown" id="gpsfudge2" min="-1" max="1" size="20" value="<?=htmlspecialchars($pconfig['fudge2']);?>" />(<?php echo gettext("seconds");?>)<br />
+ <?php echo gettext("Fudge time 2 is used to specify the GPS time offset");?> (<?php echo gettext("default");?>: 0.0).
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Stratum</td>
+ <td width="78%" class="vtable">
+ <input name="gpsstratum" type="text" class="formfld unknown" id="gpsstratum" max="16" size="20" value="<?=htmlspecialchars($pconfig['stratum']);?>" /><?php echo gettext("(0-16)");?><br />
+ <?php echo gettext("This may be used to change the GPS Clock stratum");?> (<?php echo gettext("default");?>: 0). <?php echo gettext("This may be useful if, for some reason, you want ntpd to prefer a different clock"); ?>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Flags</td>
+ <td width="78%" class="vtable">
+ <table>
+ <tr>
+ <td>
+ <?php echo gettext("Normally there should be no need to change these options from the defaults."); ?><br />
+ </td>
+ </tr>
+ </table>
+ <table>
+ <tr>
+ <td>
+ <input name="gpsprefer" type="checkbox" class="formcheckbox" id="gpsprefer" onclick="ToggleOther('gpsprefer', 'gpsselect')"<?php if (!$pconfig['prefer']) echo " checked=\"checked\""; ?> />
+ </td>
+ <td>
+ <span class="vexpl"><?php echo gettext("NTP should prefer this clock (default: enabled)."); ?></span>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input name="gpsselect" type="checkbox" class="formcheckbox" id="gpsselect" onclick="ToggleOther('gpsselect', 'gpsprefer')"<?php if ($pconfig['noselect']) echo " checked=\"checked\""; ?> />
+ </td>
+ <td>
+ <span class="vexpl"><?php echo gettext("NTP should not use this clock, it will be displayed for reference only(default: disabled)."); ?></span>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input name="gpsflag1" type="checkbox" class="formcheckbox" id="gpsflag1"<?php if ($pconfig['flag1']) echo " checked=\"checked\""; ?> />
+ </td>
+ <td>
+ <span class="vexpl"><?php echo gettext("Enable PPS signal processing (default: enabled)."); ?></span>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input name="gpsflag2" type="checkbox" class="formcheckbox" id="gpsflag2"<?php if ($pconfig['flag2']) echo " checked=\"checked\""; ?> />
+ </td>
+ <td>
+ <span class="vexpl"><?php echo gettext("Enable falling edge PPS signal processing (default: rising edge)."); ?></span>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input name="gpsflag3" type="checkbox" class="formcheckbox" id="gpsflag3"<?php if ($pconfig['flag3']) echo " checked=\"checked\""; ?> />
+ </td>
+ <td>
+ <span class="vexpl"><?php echo gettext("Enable kernel PPS clock discipline (default: enabled)."); ?></span>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input name="gpsflag4" type="checkbox" class="formcheckbox" id="gpsflag4"<?php if ($pconfig['flag4']) echo " checked=\"checked\""; ?> />
+ </td>
+ <td>
+ <span class="vexpl"><?php echo gettext("Obscure location in timestamp (default: unobscured)."); ?></span>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <input name="gpssubsec" type="checkbox" class="formcheckbox" id="gpssubsec"<?php if ($pconfig['subsec']) echo " checked=\"checked\""; ?> />
+ </td>
+ <td>
+ <span class="vexpl"><?php echo gettext("Log the sub-second fraction of the received time stamp (default: Not logged).<br />Note: enabling this will rapidly fill the log, but is useful for tuning Fudge time 2."); ?></span>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">Clock ID</td>
+ <td width="78%" class="vtable">
+ <input name="gpsrefid" type="text" class="formfld unknown" id="gpsrefid" maxlength= "4" size="20" value="<?=htmlspecialchars($pconfig['refid']);?>" /><?php echo gettext("(1 to 4 charactors)");?><br />
+ <?php echo gettext("This may be used to change the GPS Clock ID");?> (<?php echo gettext("default");?>: GPS).
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top" class="vncellreq">GPS Initialization</td>
+ <td width="78%" class="vtable">
+ <div id="showgpsinitbox">
+ <input type="button" onclick="show_advanced('showgpsinitbox', 'showgpsinit')" value="<?=gettext("Advanced");?>" /> - <?=gettext("Show GPS Initialization commands");?>
+ </div>
+ <div id="showgpsinit" style="display:none">
+ <p>
+ <textarea name="gpsinitcmd" class="formpre" id="gpsinitcmd" cols="65" rows="7"><?=htmlspecialchars(base64_decode($pconfig['initcmd'])); /*resultmatch*/?></textarea><br />
+ <?php echo gettext("Note: Commands entered here will be sent to the GPS during initialization. Please read and understand your GPS documentation before making any changes here.");?><br /><br />
+ <strong><?php echo gettext("NMEA checksum calculator");?>:</strong>
+ <br />
+ <?php echo gettext("Enter the text between &quot;$&quot; and &quot;*&quot; of a NMEA command string:");?><br /> $<input name="nmeastring" type="text" class="formfld unknown" id="nmeastring" size="30" value="" />*<span id="nmeachecksum"><?php echo gettext("checksum");?></span>&nbsp;&nbsp;
+ <input type="button" onclick="NMEAChecksum(nmeastring.value)" value="<?=gettext("Calculate NMEA checksum");?>" /><br />
+ </p>
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <td width="22%" valign="top">&nbsp;</td>
+ <td width="78%">
+ <input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" />
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
</table>
<script type="text/javascript">
//<![CDATA[
OpenPOWER on IntegriCloud