📄 108
字号:
+ up->log_time = current_time + SLEEPTIME;+ /* * "001" Initialization/Mode Control, Part B * Put receiver in fully-constrained 2d nav mode****************** 549,557 ****--- 574,614 ---- alt, /* height */ 1); /* Altitude Reference 1=MSL */ + + /*+ * "007" Control Port Configuration+ * Stop outputting "022" DOPs+ */+ mx4200_send(peer, "%s,%03d,%03d,%d,%d,,,,,", pmvxg,+ PMVXG_S_PORTCONF,+ PMVXG_D_DOPS, /* control port output block Label */+ 0, /* clear current output control list (0=no) */+ 0); /* add/delete sentences from list (0=delete) */+ /* must be null */+ /* sentence output rate (sec) */+ /* precision for position output */+ /* nmea version for cga & gll output */+ /* pass-through control */+ + /*+ * "007" Control Port Configuration+ * Stop outputting "021" position, height, velocity reports+ */+ mx4200_send(peer, "%s,%03d,%03d,%d,%d,,%d,,,", pmvxg,+ PMVXG_S_PORTCONF,+ PMVXG_D_PHV, /* control port output block Label */+ 0, /* clear current output control list (0=no) */+ 0); /* add/delete sentences from list (0=delete) */+ /* must be null */+ /* sentence output rate (sec) */+ /* precision for position output */+ /* nmea version for cga & gll output */+ /* pass-through control */+ msyslog(LOG_DEBUG, "mx4200_ref: reconfig to fixed location: %s %c, %s %c, %.2f m MSL", lats, nsc, lons, ewc, alt );+ } /******************* 597,602 ****--- 654,673 ---- */ up->polled = 1; pp->polls++;+ + /*+ * Output receiver status information.+ */+ if ((up->log_time > 0) && (current_time > up->log_time)) {+ up->log_time = 0;+ /*+ * Output the following messages once, for debugging.+ * "004" Mode Data+ * "523" Time Recovery Parameters+ */+ mx4200_send(peer, "%s,%03d", "CDGPQ", PMVXG_D_MODEDATA);+ mx4200_send(peer, "%s,%03d", "CDGPQ", PMVXG_D_TRECOVUSEAGE);+ } } static char char2hex[] = "0123456789ABCDEF";****************** 623,628 ****--- 694,712 ---- up = (struct mx4200unit *)pp->unitptr; /*+ * If operating mode has been changed, then reinitialize the receiver+ * before doing anything else.+ */+ if ((pp->sloppyclockflag & CLK_FLAG2) !=+ (up->sloppyclockflag & CLK_FLAG2)) {+ up->sloppyclockflag = pp->sloppyclockflag;+ mx4200_debug(peer, "mx4200_receive: mode switch: reset receiver\n", cp);+ mx4200_config(peer);+ return;+ }+ up->sloppyclockflag = pp->sloppyclockflag;+ + /* * Read clock output. Automatically handles STREAMS, CLKLDISC. */ pp->lencode = refclock_gtlin(rbufp, pp->lastcode, BMAX, &pp->lastrec);****************** 705,710 ****--- 789,798 ---- * indicates the reciever needs to be initialized; thus, it is * not necessary to decode the status message. */+ if ((cp = mx4200_parse_s(peer)) != NULL) {+ mx4200_debug(peer,+ "mx4200_receive: status: %s\n", cp);+ } mx4200_debug(peer, "mx4200_receive: reset receiver\n", cp); mx4200_config(peer); return;****************** 755,765 **** } /* * "030" Software Configuration */! if (sentence_type == PMVXG_D_SOFTCONF && !up->known) { if ((cp = mx4200_parse_s(peer)) != NULL) {! mx4200_debug(peer, "mx4200_receive: sw conf: %s\n", cp); return; } return;--- 843,859 ---- } /*+ * Print to the syslog:+ * "004" Mode Data * "030" Software Configuration+ * "523" Time Recovery Parameters Currently in Use */! if (sentence_type == PMVXG_D_MODEDATA ||! sentence_type == PMVXG_D_SOFTCONF ||! sentence_type == PMVXG_D_TRECOVUSEAGE ) { if ((cp = mx4200_parse_s(peer)) != NULL) {! mx4200_debug(peer,! "mx4200_receive: multi-record: %s\n", cp); return; } return;****************** 972,982 **** } /*! * Now compute the offset estimate. If the sloppy clock! * flag 1 is set, average the remainder, otherwise pick the * median. */! if (pp->sloppyclockflag && CLK_FLAG1) { L_CLR(&lftmp); while (i < n) { L_ADD(&lftmp, &off[i]);--- 1066,1076 ---- } /*! * Now compute the offset estimate. If fudge flag 1! * is set, average the remainder, otherwise pick the * median. */! if (pp->sloppyclockflag & CLK_FLAG1) { L_CLR(&lftmp); while (i < n) { L_ADD(&lftmp, &off[i]);****************** 1182,1193 **** refclock_report(peer, CEVNT_BADTIME); return ("bad time"); } /* * Check for insane date */ if (monthday > 31 || month > 12 ||! monthday < 1 || month < 1 || year < 1996) { mx4200_debug(peer, "mx4200_parse_t: bad date (%4d-%02d-%02d)\n", year, month, monthday);--- 1276,1292 ---- refclock_report(peer, CEVNT_BADTIME); return ("bad time"); }+ if ( second == 60 ) {+ msyslog(LOG_DEBUG, "mx4200_parse_t: leap second! %02d:%02d:%02d",+ hour, minute, second);+ } /* * Check for insane date+ * (Certainly can't be a year before this code was last altered!) */ if (monthday > 31 || month > 12 ||! monthday < 1 || month < 1 || year < 1997) { mx4200_debug(peer, "mx4200_parse_t: bad date (%4d-%02d-%02d)\n", year, month, monthday);****************** 1243,1248 ****--- 1342,1357 ---- pp->leap = LEAP_NOTINSYNC; /* shouldn't happen */ /*+ * Any change to the leap second warning status?+ */+ if (leapsec != up->last_leap ) {+ msyslog(LOG_DEBUG,+ "mx4200_parse_t: leap second warning: %d to %d (%d)",+ up->last_leap, leapsec, pp->leap);+ }+ up->last_leap = leapsec;+ + /* * Copy time data for billboard monitoring. */ ****************** 1397,1402 ****--- 1506,1514 ---- pp = peer->procptr; up = (struct mx4200unit *)pp->unitptr; + /* Should never happen! */+ if (up->moving) return ("mobile platform - no pos!");+ cp = pp->lastcode; if ((cp = strchr(cp, ',')) == NULL)****************** 1513,1524 **** up->filt_alt += weight; up->avg_alt = up->avg_alt / up->filt_alt; - /*- * Are we moving?- */- if ((vele*vele + veln*veln) > MAX_VEL_SQUARED)- up->moving++;- return (NULL); } --- 1625,1630 ----****************** 1559,1564 ****--- 1665,1673 ---- pp = peer->procptr; up = (struct mx4200unit *)pp->unitptr; + /* Should never happen! */+ if (up->moving) return ("mobile platform - no dop!");+ cp = pp->lastcode; if ((cp = strchr(cp, ',')) == NULL)****************** 1607,1613 ****--- 1716,1789 ---- } /*+ * Parse a mx4200 Status sentence+ * Parse a mx4200 Mode Data sentence * Parse a mx4200 Software Configuration sentence+ * Parse a mx4200 Time Recovery Parameters Currently in Use sentence+ * (used only for logging raw strings)+ *+ * A typical message looks like this. Checksum has already been stripped.+ *+ * $PMVXG,000,XXX,XX,X,HHMM,X+ *+ * Field Field Contents+ * ----- --------------+ * Block Label: $PMVXG+ * Sentence Type: 000=Status.+ * Returns status of the receiver to the controller.+ * 1 Current Receiver Status:+ * ACQ = Satellite re-acquisition+ * ALT = Constellation selection+ * COR = Providing corrections (for reference stations only)+ * IAC = Initial acquisition+ * IDL = Idle, no satellites+ * NAV = Navigation+ * STS = Search the Sky (no almanac available)+ * TRK = Tracking+ * 2 Number of satellites that should be visible+ * 3 Number of satellites being tracked+ * 4 Time since last navigation status if not currently navigating+ * (hours, minutes)+ * 5 Initialization status:+ * 0 = Waiting for initialization parameters+ * 1 = Initialization completed+ *+ * A typical message looks like this. Checksum has already been stripped.+ *+ * $PMVXG,004,C,R,D,H.HH,V.VV,TT,HHHH,VVVV,T+ *+ * Field Field Contents+ * ----- --------------+ * Block Label: $PMVXG+ * Sentence Type: 004=Software Configuration.+ * Defines the navigation mode and criteria for+ * acceptable navigation for the receiver.+ * 1 Constrain Altitude Mode:+ * 0 = Auto. Constrain altitude (2-D solution) and use+ * manual altitude input when 3 sats avalable. Do+ * not constrain altitude (3-D solution) when 4 sats+ * available.+ * 1 = Always constrain altitude (2-D solution).+ * 2 = Never constrain altitude (3-D solution).+ * 3 = Coast. Constrain altitude (2-D solution) and use+ * last GPS altitude calculation when 3 sats avalable.+ * Do not constrain altitude (3-D solution) when 4 sats+ * available.+ * 2 Altitude Reference: (always 0 for MX4200)+ * 0 = Ellipsoid+ * 1 = Geoid (MSL)+ * 3 Differential Navigation Control:+ * 0 = Disabled+ * 1 = Enabled+ * 4 Horizontal Acceleration Constant (m/sec**2)+ * 5 Vertical Acceleration Constant (m/sec**2) (0 for MX4200)+ * 6 Tracking Elevation Limit (degrees)+ * 7 HDOP Limit+ * 8 VDOP Limit+ * 9 Time Output Mode:+ * U = UTC+ * L = Local time+ * 10 Local Time Offset (minutes) (absent on MX4200) * * A typical message looks like this. Checksum has already been stripped. ******************* 1621,1626 ****--- 1797,1837 ---- * and baseband firmware version numbers. * 1 Nav Processor Version Number * 2 Baseband Firmware Version Number+ *+ * A typical message looks like this. Checksum has already been stripped.+ *+ * $PMVXG,523,M,S,M,EEEE,BBBBBB,C,R+ *+ * Field Field Contents+ * ----- --------------+ * Block Label: $PMVXG+ * Sentence Type: 523=Time Recovery Parameters Currently in Use.+ * This sentence contains the configuration of the+ * time recovery feature of the receiver.+ * 1 Time Recovery Mode:+ * D = Dynamic; solve for position and time while moving+ * S = Static; solve for position and time while stationary+ * K = Known position input, solve for time only+ * N = No time recovery+ * 2 Time Synchronization:+ * U = UTC time+ * G = GPS time+ * 3 Time Mark Mode:+ * A = Always output a time pulse+ * V = Only output time pulse if time is valid (as determined+ * by Maximum Time Error)+ * 4 Maximum Time Error - the maximum error (in nanoseconds) for+ * which a time mark will be considered valid.+ * 5 User Time Bias - external bias in nanoseconds+ * 6 Time Message Control:+ * 0 = Do not output the time recovery message+ * 1 = Output the time recovery message (record 830) to+ * Control port+ * 2 = Output the time recovery message (record 830) to+ * Equipment port+ * 7 Reserved+ * 8 Position Known PRN (absent on MX 4200)+ * */ static char * mx4200_parse_s(peer)****************** 1642,1655 **** /* Sentence type */ sentence_type = strtol(cp, &cp, 10);! if (sentence_type != PMVXG_D_SOFTCONF) return ("wrong rec-type");- - /* Log the software version */ cp++;! msyslog(LOG_DEBUG, "mx4200_parse_s: firmware configuration: %s", cp); ! return 0; } /*--- 1853,1890 ---- /* Sentence type */ sentence_type = strtol(cp, &cp, 10);! if (sentence_type != PMVXG_D_STATUS &&! sentence_type != PMVXG_D_MODEDATA &&! sentence_type != PMVXG_D_SOFTCONF &&! sentence_type != PMVXG_D_TRECOVUSEAGE ) return ("wrong rec-type"); cp++;! ! /* Log the Status */! if (sentence_type == PMVXG_D_STATUS) {! msyslog(LOG_DEBUG,! "mx4200_parse_s: status: %s", cp);! }! ! /* Log the Mode Data */! if (sentence_type == PMVXG_D_MODEDATA) {! msyslog(LOG_DEBUG,! "mx4200_parse_s: mode data: %s", cp);! }! ! /* Log the Software Version */! if (sentence_type == PMVXG_D_SOFTCONF) {! msyslog(LOG_DEBUG,! "mx4200_parse_s: firmware configuration: %s", cp);! }! ! /* Log the Time Recovery Parameters */! if (sentence_type == PMVXG_D_TRECOVUSEAGE) {! msyslog(LOG_DEBUG,! "mx4200_parse_s: time recovery parms: %s", cp);! } ! return (NULL); } /******************* 1816,1835 **** #else /* not (REFCLOCK && MX4200 && PPS) */ int refclock_mx4200_bs; #endif /* not (REFCLOCK && MX4200 && PPS) */- - /*- * History:- *- * refclock_mx4200.c- *- * Author: Craig Leres?- * Revised: Marc Brett 1.10 1996-05-08- * - rewrote to "new-style" xntpd driver standard.- * - added position-averaging/fixed-location logic.- * Revised: Marc Brett 1.20 1997-02-11- * - updated to xntp3-5.89.5 standards.- *- * Craig Leres (leres@ee.lbl.gov)- * Marc Brett (Marc.Brett@waii.com)- *- */--- 2051,2053 ------PART-BOUNDARY=.19703181300.ZM17248.london.waii.com--
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -