diff options
author | Renato Botelho <renato@netgate.com> | 2017-02-03 07:03:34 -0200 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2017-02-03 07:03:34 -0200 |
commit | c126fc7918d0fba6d7548f15e38c18fc55c65f90 (patch) | |
tree | fdcb75fd4822c285b9a5adcde787593755d4ba8e /src/usr/local/www | |
parent | 430f8fbc88c690c903676fb47ee7f6a81536839b (diff) | |
parent | 821110e8ff76564c23783c554fc89cd9458683ac (diff) | |
download | pfsense-c126fc7918d0fba6d7548f15e38c18fc55c65f90.zip pfsense-c126fc7918d0fba6d7548f15e38c18fc55c65f90.tar.gz |
Merge pull request #3463 from jskyboo/master
Diffstat (limited to 'src/usr/local/www')
-rw-r--r-- | src/usr/local/www/services_ntpd_gps.php | 16 | ||||
-rw-r--r-- | src/usr/local/www/status_ntpd.php | 13 | ||||
-rw-r--r-- | src/usr/local/www/widgets/widgets/ntp_status.widget.php | 13 |
3 files changed, 42 insertions, 0 deletions
diff --git a/src/usr/local/www/services_ntpd_gps.php b/src/usr/local/www/services_ntpd_gps.php index 4c5bc8c..1b4970d 100644 --- a/src/usr/local/www/services_ntpd_gps.php +++ b/src/usr/local/www/services_ntpd_gps.php @@ -173,6 +173,12 @@ if ($_POST) { } else { $config['ntpd']['gps']['nmea'] = strval(array_sum($_POST['gpsnmea'])); } + + if (!empty($_POST['processpgrmf'])) { + $config['ntpd']['gps']['processpgrmf'] = $_POST['processpgrmf']; + } elseif (isset($config['ntpd']['gps']['processpgrmf']) || $config['ntpd']['gps']['type'] !== 'Garmin') { + unset($config['ntpd']['gps']['processpgrmf']); + } if (!empty($_POST['gpsfudge1'])) { $config['ntpd']['gps']['fudge1'] = $_POST['gpsfudge1']; @@ -377,6 +383,13 @@ $section->addInput(new Form_Select( true ))->setHelp('By default NTP will listen for all supported NMEA sentences. One or more sentences to listen for may be specified.'); +$section->addInput(new Form_Checkbox( + 'processpgrmf', + null, + 'Process PGRMF. Ignores ALL other NMEA sentences. (default: unchecked).', + $pconfig['processpgrmf'] +)); + $section->addInput(new Form_Input( 'gpsfudge1', 'Fudge Time 1', @@ -588,6 +601,7 @@ events.push(function() { function set_gps_default(type) { $('#gpsnmea').val(0); + $('#processpgrmf').prop('checked', false); $('#gpsspeed').val(0); $('#gpsfudge1').val(0); $('#gpsinitcmd').val(get_gps_string(type)); @@ -686,7 +700,9 @@ events.push(function() { // When the 'GPS' selector is changed, we set the gps defaults $('#gpstype').on('change', function() { set_gps_default($(this).val()); + hideInput('processpgrmf', $(this).val() !== "Garmin"); }); + hideInput('processpgrmf', '<?=$pconfig['type']?>' !== "Garmin"); if ('<?=$pconfig['initcmd']?>' == '') { set_gps_default('<?=$pconfig['type']?>'); diff --git a/src/usr/local/www/status_ntpd.php b/src/usr/local/www/status_ntpd.php index 8436f6e..7ee0325 100644 --- a/src/usr/local/www/status_ntpd.php +++ b/src/usr/local/www/status_ntpd.php @@ -141,6 +141,19 @@ if (!isset($config['ntpd']['noquery'])) { $gps_lon = $gps_lon * (($gps_vars[4] == "E") ? 1 : -1); $gps_lat_dir = $gps_vars[2]; $gps_lon_dir = $gps_vars[4]; + } elseif (substr($tmp, 0, 6) == '$PGRMF') { + $gps_vars = preg_split('/[,\*]+/', $tmp); + $gps_ok = $gps_vars[11]; + $gps_lat_deg = substr($gps_vars[6], 0, 2); + $gps_lat_min = substr($gps_vars[6], 2); + $gps_lon_deg = substr($gps_vars[8], 0, 3); + $gps_lon_min = substr($gps_vars[8], 3); + $gps_lat = $gps_lat_deg + $gps_lat_min / 60.0; + $gps_lat = $gps_lat * (($gps_vars[7] == "N") ? 1 : -1); + $gps_lon = $gps_lon_deg + $gps_lon_min / 60.0; + $gps_lon = $gps_lon * (($gps_vars[9] == "E") ? 1 : -1); + $gps_lat_dir = $gps_vars[7]; + $gps_lon_dir = $gps_vars[9]; } } } diff --git a/src/usr/local/www/widgets/widgets/ntp_status.widget.php b/src/usr/local/www/widgets/widgets/ntp_status.widget.php index 04ef6c4..2bf2185 100644 --- a/src/usr/local/www/widgets/widgets/ntp_status.widget.php +++ b/src/usr/local/www/widgets/widgets/ntp_status.widget.php @@ -121,6 +121,19 @@ if ($_REQUEST['updateme']) { $gps_lon = $gps_lon * (($gps_vars[4] == "E") ? 1 : -1); $gps_lat_dir = $gps_vars[2]; $gps_lon_dir = $gps_vars[4]; + } elseif (substr($tmp, 0, 6) == '$PGRMF') { + $gps_vars = preg_split('/[,\*]+/', $tmp); + $gps_ok = $gps_vars[11]; + $gps_lat_deg = substr($gps_vars[6], 0, 2); + $gps_lat_min = substr($gps_vars[6], 2); + $gps_lon_deg = substr($gps_vars[8], 0, 3); + $gps_lon_min = substr($gps_vars[8], 3); + $gps_lat = $gps_lat_deg + $gps_lat_min / 60.0; + $gps_lat = $gps_lat * (($gps_vars[7] == "N") ? 1 : -1); + $gps_lon = $gps_lon_deg + $gps_lon_min / 60.0; + $gps_lon = $gps_lon * (($gps_vars[9] == "E") ? 1 : -1); + $gps_lat_dir = $gps_vars[7]; + $gps_lon_dir = $gps_vars[9]; } } } |