Projet

Général

Profil

« Précédent | Suivant » 

Révision f9f3e44c

Ajouté par Renato Botelho il y a presque 10 ans

More non-functional changes to make code more readable

Voir les différences:

usr/local/www/services_ntpd_gps.php
146 146

  
147 147
	write_config("Updated NTP GPS Settings");
148 148

  
149
	$retval = 0;
150 149
	$retval = system_ntp_configure();
151 150
	$savemsg = get_std_save_message($retval);
152 151
} else {
......
176 175
		}
177 176
	}
178 177

  
179
<?php /*
178
/*
180 179
init commands are Base64 encoded
181 180
Default =	#Sponsored, probably a Ublox
182 181
		$PUBX,40,GSV,0,0,0,0*59
......
249 248
		$PMTK527,0.00*00
250 249
		$PMTK251,9600*17	#really needs to work at 9600 baud
251 250

  
252
*/ ?>
251
*/
253 252

  
254 253
	function set_gps_default(form) {
255 254
		//This handles a new config and also a reset to a defined default config
......
361 360
<table width="100%" border="0" cellpadding="0" cellspacing="0" summary="ntpd gps">
362 361
	<tr><td>
363 362
<?php
364
	$tab_array = array();
365
	$tab_array[] = array(gettext("NTP"), false, "services_ntpd.php");
366
	$tab_array[] = array(gettext("Serial GPS"), true, "services_ntpd_gps.php");
367
	$tab_array[] = array(gettext("PPS"), false, "services_ntpd_pps.php");
368
	display_top_tabs($tab_array);
363
		$tab_array = array();
364
		$tab_array[] = array(gettext("NTP"), false, "services_ntpd.php");
365
		$tab_array[] = array(gettext("Serial GPS"), true, "services_ntpd_gps.php");
366
		$tab_array[] = array(gettext("PPS"), false, "services_ntpd_pps.php");
367
		display_top_tabs($tab_array);
369 368
?>
370 369
	</td></tr>
371 370
	<tr><td>
......
385 384
		<tr>
386 385
			<td width="22%" valign="top" class="vncellreq"><?=gettext("GPS"); ?></td>
387 386
			<td width="78%" valign="top" class="vtable">
388
			<?php /* Start with the original "Default", list a "Generic" and then specific configs alphabetically */ ?>
387
				<!-- Start with the original "Default", list a "Generic" and then specific configs alphabetically -->
389 388
				<select id="gpstype" name="gpstype" class="formselect" onchange="set_gps_default(this.form)">
390 389
					<option value="Default"<?php if($pconfig['type'] == 'Default') echo " selected=\"selected\""; ?>>Default</option>
391 390
					<option value="Generic" title="Generic"<?php if($pconfig['type'] == 'Generic') echo " selected=\"selected\"";?>>Generic</option>
......
397 396
				</select> <?php echo gettext("This option allows you to select a predefined configuration.");?>
398 397
				<br />
399 398
				<br />
400
				<strong><?php echo gettext(" Note: ");?></strong><?php echo gettext("Default is the configuration of pfSense 2.1 and earlier"); ?>
401
				<?php echo gettext(" (not recommended). Select Generic if your GPS is not listed.)"); ?>
402
				<strong><?php echo gettext(" Note: ");?></strong><?php echo gettext("The perdefined configurations assume your GPS has already been set to NMEA mode."); ?>
399
				<strong><?php echo gettext("Note: ");?></strong><?php echo gettext("Default is the configuration of pfSense 2.1 and earlier"); ?>
400
				<?php echo gettext(" (not recommended). Select Generic if your GPS is not listed.)"); ?><br />
401
				<strong><?php echo gettext("Note: ");?></strong><?php echo gettext("The perdefined configurations assume your GPS has already been set to NMEA mode."); ?>
403 402
			</td>
404 403
		</tr>
405 404

  
406
<?php /* Probing would be nice, but much more complex. Would need to listen to each port for 1s+ and watch for strings. */ ?>
407
<?php $serialports = glob("/dev/cua?[0-9]{,.[0-9]}", GLOB_BRACE); ?>
408
<?php if (!empty($serialports)): ?>
405
<?php
406
	/* Probing would be nice, but much more complex. Would need to listen to each port for 1s+ and watch for strings. */
407
	$serialports = glob("/dev/cua?[0-9]{,.[0-9]}", GLOB_BRACE);
408
	if (!empty($serialports)):
409
?>
409 410
		<tr>
410 411
			<td width="22%" valign="top" class="vncellreq">Serial port</td>
411 412
			<td width="78%" class="vtable">
412 413
				<select name="gpsport" class="formselect">
413 414
					<option value="">none</option>
414
					<?php foreach ($serialports as $port):
415
						$shortport = substr($port,5);
416
						$selected = ($shortport == $pconfig['port']) ? " selected=\"selected\"" : "";?>
417
						<option value="<?php echo $shortport;?>"<?php echo $selected;?>><?php echo $shortport;?></option>
418
					<?php endforeach; ?>
415
<?php
416
				foreach ($serialports as $port):
417
					$shortport = substr($port,5);
418
					$selected = ($shortport == $pconfig['port']) ? " selected=\"selected\"" : "";
419
?>
420
					<option value="<?php echo $shortport;?>"<?php echo $selected;?>><?php echo $shortport;?></option>
421
<?php
422
				endforeach;
423
?>
419 424
				</select>&nbsp;
420 425
				<?php echo gettext("All serial ports are listed, be sure to pick the port with the GPS attached."); ?>
421 426
				<br /><br />
......
432 437
				<?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."); ?>
433 438
			</td>
434 439
		</tr>
435
<?php endif; ?>
440
<?php
441
	endif;
442
?>
436 443
		<tr>
437
<?php /* 1 = RMC, 2 = GGA, 4 = GLL, 8 = ZDA or ZDG */?>
444
			<!-- 1 = RMC, 2 = GGA, 4 = GLL, 8 = ZDA or ZDG -->
438 445
			<td width="22%" valign="top" class="vncellreq">NMEA sentences</td>
439 446
			<td width="78%" class="vtable">
440 447
				<select id="gpsnmea" name="gpsnmea[]" multiple="multiple" class="formselect" size="5">

Formats disponibles : Unified diff