From c977d6b10f9b639a27ab604fb48bb327c1472468 Mon Sep 17 00:00:00 2001 From: jskyboo Date: Mon, 23 Jan 2017 20:04:13 -0800 Subject: Feature #7159 Add GPS initialization command auto correct tool Corrects malformed NMEA sentences by calculating and appending the checksum and adding missing special characters "$" and "*" (cherry picked from commit 8c23d92a159c1282e7d185665977f0c45d45f845) --- src/usr/local/www/services_ntpd_gps.php | 47 +++++++++++++++++++++++++++++++-- 1 file changed, 45 insertions(+), 2 deletions(-) (limited to 'src/usr') diff --git a/src/usr/local/www/services_ntpd_gps.php b/src/usr/local/www/services_ntpd_gps.php index 66bfcf3..b72372a 100644 --- a/src/usr/local/www/services_ntpd_gps.php +++ b/src/usr/local/www/services_ntpd_gps.php @@ -154,6 +154,30 @@ function parse_initcmd(&$nmeaset, $initcmd) { } } +function NMEAChecksum($cmd) { + $checksum = 0; + for ($i=0; $iaddInput(new Form_Textarea( base64_decode($pconfig['initcmd']) ))->setHelp('Commands entered here will be sent to the GPS during initialization. Please read and understand the GPS documentation before making any changes here.'); +$section->addInput(new Form_Checkbox( + 'autocorrect_initcmd', + null, + 'Auto correct malformed initialization commands. (default: checked).', + $pconfig['autocorrect_initcmd'] +))->setHelp('Calculates and appends checksum and missing special characters "$" and "*". Disable if causing errors.'); + $group = new Form_Group('NMEA Checksum Calculator'); $group->add(new Form_Input( @@ -621,6 +662,7 @@ events.push(function() { $('#gpsflag4').prop('checked', false); $('#gpssubsec').prop('checked', false); $('#extstatus').prop('checked', true); + $('#autocorrect_initcmd').prop('checked', true); } // Show advanced GPS options ============================================== @@ -644,6 +686,7 @@ events.push(function() { } hideInput('gpsinitcmd', !showadvgps); + hideInput('autocorrect_initcmd', !showadvgps); hideClass('calculator', !showadvgps); if (showadvgps) { -- cgit v1.1