nmea.c 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560
  1. #ifdef PC_BUILD
  2. #include "../gps-test-tool/main.h"
  3. #else
  4. #include "main.h"
  5. #endif
  6. /*----------------------------------------------------*/
  7. /* Get a line received from GPS module */
  8. /*----------------------------------------------------*/
  9. uint16_t get_line ( /* 0:line incomplete or timed out, >0: Number of bytes received. */
  10. char *buff,
  11. uint16_t sz_buf
  12. )
  13. {
  14. char c;
  15. static uint16_t i = 0;
  16. uint16_t ret_len;
  17. set_timer(recv_timeout, 1000);
  18. for (;;) {
  19. wdt_reset();
  20. if (FLAGS & (F_LVD | F_POWEROFF))
  21. return 0; /* A brownout is detected */
  22. if (timer_expired(recv_timeout))
  23. return 0; /* timeout; continue the main loop */
  24. if (System.keypress) /* process user keypress */
  25. return 0;
  26. if (!uart0_test()) {
  27. sleep();
  28. continue;
  29. }
  30. c = (char)uart0_get();
  31. if (i == 0 && c != '$' )
  32. continue; /* Find start of line */
  33. if (c == '\n' || c == '\r') {
  34. buff[i++] = '\r';
  35. buff[i++] = '\n';
  36. buff[i++] = '\0'; /* add null termination for string */
  37. break; /* EOL */
  38. }
  39. buff[i++] = c;
  40. if (System.conf.uart_log_mode != UART_LOG_MODE_SYSTEM)
  41. uart1_put(c);
  42. if (i >= sz_buf - 3) /* keep 3 bytes for terminating character */
  43. i = 0; /* Buffer overflow (abort this line) */
  44. }
  45. ret_len = i;
  46. i = 0;
  47. if (ret_len > 0 && System.conf.uart_log_mode != UART_LOG_MODE_SYSTEM) {
  48. uart1_put('\r');
  49. uart1_put('\n');
  50. }
  51. return ret_len;
  52. }
  53. /* Compare sentence header string */
  54. BYTE gp_comp (const char *str1, __flash const char *str2)
  55. {
  56. char c;
  57. do {
  58. c = pgm_read_byte(str2++);
  59. } while (c && c == *str1++);
  60. return c;
  61. }
  62. /* Per-epoch GGA/GSA/logged tracking for nmea_epoch_complete() - partial parse
  63. * state, not global "fully cooked" data, so kept local to this file rather
  64. * than on System. */
  65. static struct {
  66. unsigned char gga_ok : 1;
  67. unsigned char gsa_ok : 1;
  68. unsigned char logged : 1;
  69. unsigned char quality_rejected : 1; /* REJECT_REASON_QUALITY already
  70. counted this epoch - RMC status=V and GGA quality=0 both fire on the
  71. same no-fix epoch, and would otherwise double-count one rejection */
  72. } epoch;
  73. #define FIELD_BUF_LEN 32
  74. /* Get a column item */
  75. static
  76. const char* gp_col ( /* Returns pointer to the item (returns a NULL when not found) */
  77. const char* buf, /* Pointer to the sentence */
  78. BYTE col /* Column number (0 is the 1st item) */
  79. ) {
  80. BYTE c;
  81. static char field_buf[FIELD_BUF_LEN];
  82. unsigned char length = 0;
  83. while (col) {
  84. do {
  85. c = *buf++;
  86. if (c <= ' ') return NULL;
  87. } while (c != ',');
  88. col--;
  89. }
  90. while (*buf && *buf != ',' && length < FIELD_BUF_LEN-1) {
  91. field_buf[length++] = *buf++;
  92. }
  93. field_buf[length] = '\0';
  94. return field_buf;
  95. }
  96. unsigned int gp_val(const char *db, unsigned char count) {
  97. unsigned int out = 0;
  98. while (count--) {
  99. unsigned char n;
  100. n = *db - '0';
  101. if (n >= 10)
  102. return 0;
  103. out *= 10;
  104. out += n;
  105. db++;
  106. }
  107. return out;
  108. }
  109. #define SPEED_SAMPLE_CAP_MULT 3 /* cap any single sample at this multiple of the running average... */
  110. #define SPEED_SAMPLE_CAP_MIN_SAMPLES 60 /* ...but only once the average actually means something, ... */
  111. #define SPEED_SAMPLE_CAP_FLOOR_X100 2000 /* ...and never cap below this (20 km/h): the cap is a backstop against
  112. * a single wild outlier, not a speed limit - persistence (below) is what
  113. * lets a genuinely sustained fast segment (car/train) through. */
  114. #define SPEED_SAMPLE_HIGH_HISTORY_LEN 7 /* consider this many of the most recent samples... */
  115. #define SPEED_SAMPLE_HIGH_HISTORY_MASK ((1U << SPEED_SAMPLE_HIGH_HISTORY_LEN) - 1)
  116. #define SPEED_SAMPLE_HIGH_MIN_COUNT 5 /* ...and once this many of them were above the cap, stop clamping:
  117. * a single spike (e.g. the 200 km/h one-second glitch seen on a real
  118. * hike) never reaches this, but a sustained fast segment does within a
  119. * few seconds. */
  120. /* Bit history of "was this raw sample above the cap" for the last
  121. * SPEED_SAMPLE_HIGH_HISTORY_LEN samples (bit 0: most recent). Static file
  122. * scope, not part of System - it's working state for the cap logic only,
  123. * nothing else needs it. */
  124. static unsigned char speed_sample_high_history;
  125. static void speed_sample_process(double speed_kmh) {
  126. unsigned char paused = tracking_is_paused();
  127. unsigned char fix_trustworthy = gps_fix_trustworthy();
  128. System.speed = speed_kmh+0.5;
  129. /* Average speed: fixed-point accumulation of instantaneous samples,
  130. * excluding time spent paused, instead of dividing distance by time. */
  131. if (!paused && fix_trustworthy) {
  132. unsigned long int sample_x100 = (unsigned long int)(speed_kmh*100.0 + 0.5);
  133. if (System.speed_sample_count >= SPEED_SAMPLE_CAP_MIN_SAMPLES) {
  134. unsigned long int avg_x100 = System.speed_accum_x100 / System.speed_sample_count;
  135. unsigned long int cap_x100 = avg_x100 * SPEED_SAMPLE_CAP_MULT;
  136. unsigned char is_high;
  137. if (cap_x100 < SPEED_SAMPLE_CAP_FLOOR_X100)
  138. cap_x100 = SPEED_SAMPLE_CAP_FLOOR_X100;
  139. is_high = sample_x100 > cap_x100;
  140. speed_sample_high_history = (speed_sample_high_history << 1) | is_high;
  141. if (is_high && __builtin_popcount(speed_sample_high_history & SPEED_SAMPLE_HIGH_HISTORY_MASK) < SPEED_SAMPLE_HIGH_MIN_COUNT)
  142. sample_x100 = cap_x100; /* not (yet) persistent: clamp as a backstop against a lone spike */
  143. }
  144. System.speed_accum_x100 += sample_x100;
  145. System.speed_sample_count++;
  146. }
  147. }
  148. static time_t gp_rmc_parse(const char *str) {
  149. const char *p;
  150. struct tm tmc;
  151. double speed_knots;
  152. epoch.gga_ok = 0;
  153. epoch.gsa_ok = 0;
  154. epoch.logged = 0;
  155. epoch.quality_rejected = 0;
  156. p = gp_col(str, 1); /* Get h:m:s */
  157. if (!p)
  158. return 0;
  159. tmc.tm_hour = gp_val(p, 2);
  160. tmc.tm_min = gp_val(p+2, 2);
  161. tmc.tm_sec = gp_val(p+4, 2);
  162. p = gp_col(str, 9); /* Get y:m:d */
  163. if (!p)
  164. return 0;
  165. tmc.tm_mday = gp_val(p, 2);
  166. tmc.tm_mon = gp_val(p+2, 2) - 1;
  167. tmc.tm_year = gp_val(p+4, 2) + 100;
  168. utc = mktime(&tmc); /* Check time validity */
  169. if (utc == -1)
  170. return 0;
  171. p = gp_col(str, 2); /* Get status */
  172. if (!p || *p != 'A') {
  173. System.location_valid = LOC_INVALID;
  174. FLAGS &= ~F_GPSOK;
  175. if (!epoch.quality_rejected) {
  176. epoch.quality_rejected = 1;
  177. log_reject(REJECT_REASON_QUALITY);
  178. }
  179. return 0; /* Return 0 even is time is valid (comes from module's internal RTC) */
  180. }
  181. FLAGS |= F_GPSOK;
  182. /* Speed over ground, from this same sentence (and the same epoch whose
  183. * status field was just checked above), in knots - converted to km/h.
  184. * Not VTG: some receivers omit VTG or send a shorter form of it, and RMC
  185. * is the one sentence essentially every NMEA GNSS module emits. */
  186. p = gp_col(str, 7);
  187. if (p && *p) {
  188. xatof(&p, &speed_knots);
  189. speed_sample_process(speed_knots * 1.852);
  190. }
  191. return utc;
  192. }
  193. /* A fix is only trusted (for acceptance into gpx_process_point(), the speed
  194. * average, and the auto-pause speed-based unpause check) when it is valid,
  195. * of a known type, and reasonably accurate: a single sample from a poor fix
  196. * (e.g. HDOP 16 with only a few satellites) would otherwise distort the
  197. * whole-session average, corrupt the track with a wild position/altitude
  198. * outlier, or - worse - talk the auto-pause logic into resuming a stationary
  199. * logger. */
  200. #define FIX_QUALITY_HDOP_MAX_X100 500 /* a fix is untrustworthy once HDOP > 5.00 */
  201. static void gp_gga_parse(const char *str) {
  202. const char *p;
  203. double tmp, hdop;
  204. unsigned int hdop_x100;
  205. p = gp_col(str, 7); /* satellites used */
  206. if (!p)
  207. return;
  208. System.satellites_used = atoi(p);
  209. epoch.gga_ok = 1;
  210. if (System.satellites_used >= System.conf.min_sats) {
  211. System.sat_count_low = 0;
  212. } else {
  213. System.sat_count_low = 1;
  214. }
  215. /* HDOP, from this same sentence: GSA (which also reports HDOP, into
  216. * System.hdop_x100) is parsed after GGA within the epoch, so its value
  217. * is still last epoch's here - read GGA's own HDOP field instead. */
  218. p = gp_col(str, 8);
  219. if (!p)
  220. return;
  221. xatof(&p, &hdop);
  222. hdop_x100 = (unsigned int)(hdop*100.0 + 0.5);
  223. /* check validity */
  224. p = gp_col(str, 6);
  225. if (!p)
  226. return;
  227. if (*p == '0') {
  228. System.location_valid = LOC_INVALID;
  229. if (!epoch.quality_rejected) {
  230. epoch.quality_rejected = 1;
  231. log_reject(REJECT_REASON_QUALITY);
  232. }
  233. return;
  234. }
  235. /* Reject (rather than just not-promote) on a low satellite count, poor
  236. * HDOP, or anything short of a 3D fix, so a bad fix can't coast on
  237. * LOC_VALID left over from the last good epoch - otherwise a
  238. * low-quality point (wrong position and/or altitude) would still be
  239. * accepted downstream. A 2D fix in particular can't solve for altitude
  240. * at all (only 3 satellites: 2 horizontal DOF + time, no vertical) and
  241. * reports a held-over or drifting one instead - seen after a real
  242. * reacquisition, where a 2D fix reported an altitude a few hundred
  243. * meters off before enough satellites came in for a real 3D fix.
  244. * System.fix_type is set by GSA, parsed after GGA within the epoch, so
  245. * it's last epoch's value here - same staleness as HDOP above, but a
  246. * bad 2D fix reliably spans several consecutive epochs, so a one-epoch
  247. * lag isn't a practical gap here (unlike a true point fix).
  248. * log_reject() logs System.hdop_x100 (GSA's, same one-epoch-stale value
  249. * checked above), not this epoch's GGA hdop_x100 just computed here -
  250. * close enough for the coalesced diagnostic line, and keeps every
  251. * REJECT_REASON logging the same field, sourced the same way. */
  252. if (!System.sat_count_low && hdop_x100 <= FIX_QUALITY_HDOP_MAX_X100
  253. && System.fix_type == FIX_TYPE_3D) {
  254. System.location_valid = LOC_VALID_NEW;
  255. } else {
  256. System.location_valid = LOC_INVALID;
  257. if (!epoch.quality_rejected) {
  258. epoch.quality_rejected = 1;
  259. log_reject(REJECT_REASON_QUALITY);
  260. }
  261. }
  262. /* parse location */
  263. p = gp_col(str, 2); /* latitude */
  264. if (!p)
  265. return;
  266. location.lat = gp_val(p, 2); /* degrees */
  267. p += 2;
  268. xatof(&p, &tmp); /* minutes */
  269. tmp /= 60; /* convert minutes to degrees */
  270. location.lat += tmp;
  271. p = gp_col(str, 3); /* N/S */
  272. if (!p)
  273. return;
  274. if (*p != 'N')
  275. location.lat = -location.lat;
  276. p = gp_col(str, 4); /* longitude */
  277. if (!p)
  278. return;
  279. location.lon = gp_val(p, 3); /* degrees */
  280. p += 3;
  281. xatof(&p, &tmp); /* minutes */
  282. tmp /= 60; /* convert minutes to degrees */
  283. location.lon += tmp;
  284. p = gp_col(str, 5); /* E/W */
  285. if (!p)
  286. return;
  287. if (*p != 'E')
  288. location.lon = -location.lon;
  289. p = gp_col(str, 6); /* fix type */
  290. if (!p)
  291. return;
  292. if (*p == '2')
  293. System.dgps = 1;
  294. else
  295. System.dgps = 0;
  296. p = gp_col(str, 9); /* MSL altitude */
  297. if (!p)
  298. return;
  299. xatof(&p, &tmp);
  300. location.alt = tmp;
  301. location.time = utc; /* parsed from RMC */
  302. }
  303. unsigned char gps_fix_trustworthy(void) {
  304. return (FLAGS & F_GPSOK) && System.fix_type != FIX_TYPE_UNKNOWN
  305. && System.hdop_x100 <= FIX_QUALITY_HDOP_MAX_X100;
  306. }
  307. static void gp_gsa_parse(const char *str) {
  308. const char *p;
  309. double hdop;
  310. p = gp_col(str, 2); /* fix type: 1 no fix, 2 2D, 3 3D */
  311. if (p && *p == '2')
  312. System.fix_type = FIX_TYPE_2D;
  313. else if (p && *p == '3')
  314. System.fix_type = FIX_TYPE_3D;
  315. else
  316. System.fix_type = FIX_TYPE_UNKNOWN;
  317. p = gp_col(str, 16); /* HDOP */
  318. if (p && *p) {
  319. xatof(&p, &hdop);
  320. System.hdop_x100 = (unsigned int)(hdop*100.0 + 0.5);
  321. }
  322. epoch.gsa_ok = 1;
  323. }
  324. /* Returns 1 exactly once per epoch (the moment both GGA and GSA have been
  325. * parsed for it, whichever arrives second), so callers that need this
  326. * epoch's satellite count and HDOP together (e.g. logging a fix event) never
  327. * see a stale value left over from a previous epoch or an earlier line -
  328. * regardless of which order the receiver sends GGA/GSA in. */
  329. unsigned char nmea_epoch_complete(void) {
  330. if (epoch.gga_ok && epoch.gsa_ok && !epoch.logged) {
  331. epoch.logged = 1;
  332. return 1;
  333. }
  334. return 0;
  335. }
  336. /*$PMTK355*31<CR><LF>
  337. Return $PMTK001,355,3,1,0,0*2E “$PMTK001,355,3,GLON_Enable,BEIDOU_Enable,GALILEO_Enable”
  338. The GLONASS search mode is enabled. */
  339. static void pmtk001_parse(const char *str) {
  340. const char *p;
  341. /* check validity */
  342. p = gp_col(str, 1);
  343. if (strcmp_P(p, PSTR("355"))) /* not the PMTK355 reply */
  344. return;
  345. p = gp_col(str, 2);
  346. if (*p == '0' || *p == '1') { /* invalid / unsupported */
  347. System.gps_only = 1;
  348. xputs_P(PSTR("GPS only\r\n"));
  349. } else {
  350. System.gps_only = 0;
  351. xputs_P(PSTR("Multi GNSS\r\n"));
  352. }
  353. gps_initialize();
  354. }
  355. unsigned char nmea_checksum(const char *str) {
  356. unsigned char cs = 0;
  357. while (*str && *str != '*') {
  358. cs ^= *str++; /* NMEA checksum is quite primitive, but still should catch simple bitstream errors or truncated lines */
  359. }
  360. return cs;
  361. }
  362. time_t gps_parse(const char *str) { /* Get all required data from NMEA sentences */
  363. signed int len = strlen(str)-2; /* remove final \r\n */
  364. const char *checksum;
  365. unsigned char calc_checksum, inc_checksum;
  366. signed int i;
  367. char c;
  368. if (len < 4)
  369. return 0; /* each message must contain $.*xx where . is one or more actual data characters and xx is the checksum */
  370. for (i = len-1; i && i >= (len-2); i--) { /* find checksum */
  371. if (str[i] == '*')
  372. break;
  373. }
  374. checksum = str+i+1; /* skip * character */
  375. inc_checksum = 0; /* parse hex string */
  376. while (*checksum && isalnum(*checksum)) {
  377. inc_checksum *= 16;
  378. c = *checksum++;
  379. if (c >= '0' && c <= '9') {
  380. inc_checksum += c - '0';
  381. } else if (c >= 'a' && c <= 'f') {
  382. inc_checksum += c - 'a' + 10;
  383. } else if (c >= 'A' && c <= 'F') {
  384. inc_checksum += c - 'A' + 10;
  385. } else {
  386. xputs_P(PSTR("Invalid NMEA: malformed checksum\r\n"));
  387. return 0; /* invalid checksum character */
  388. }
  389. }
  390. str++; /* drop initial $ */
  391. calc_checksum = nmea_checksum(str);
  392. if (inc_checksum != calc_checksum) {
  393. xputs_P(PSTR("Invalid NMEA checksum received\r\n"));
  394. return 0;
  395. }
  396. if (!gp_comp(str, PSTR("GPRMC")) || !gp_comp(str, PSTR("GNRMC")) || !gp_comp(str, PSTR("BDRMC")) || !gp_comp(str, PSTR("GARMC"))) {
  397. return gp_rmc_parse(str);
  398. }
  399. if (!gp_comp(str, PSTR("GPGGA")) || !gp_comp(str, PSTR("GNGGA")) || !gp_comp(str, PSTR("BDGGA")) || !gp_comp(str, PSTR("GAGGA"))) {
  400. gp_gga_parse(str);
  401. return 0;
  402. }
  403. if (!gp_comp(str, PSTR("GPGSA")) || !gp_comp(str, PSTR("GNGSA")) || !gp_comp(str, PSTR("BDGSA")) || !gp_comp(str, PSTR("GAGSA"))) {
  404. gp_gsa_parse(str);
  405. return 0;
  406. }
  407. if (!System.gps_initialized && !gp_comp(str, PSTR("PMTK011"))) {
  408. gps_initialize();
  409. return 0;
  410. }
  411. if (!gp_comp(str, PSTR("PMTK001"))) {
  412. pmtk001_parse(str);
  413. return 0;
  414. }
  415. if (!gp_comp(str, PSTR("PMTK"))) {
  416. /* Any other PMTK reply (e.g. PMTK705, the firmware release query
  417. * response) - log it verbatim, no need for a dedicated parser. */
  418. log_prefix();
  419. xputs_P(PSTR("RX "));
  420. xputs(str);
  421. return 0;
  422. }
  423. return 0;
  424. }
  425. void uart0_put_wrap(int c) {
  426. uart0_put((char)c);
  427. }
  428. /* Sends the SBAS-enable/disable and GNSS-mode commands for the currently
  429. * configured settings. Used both as the second step of gps_initialize()'s
  430. * boot sequence, and directly as the settings menu's .changed callback for
  431. * the SBAS/GNSS-mode entries - the latter must apply the just-changed
  432. * setting immediately, regardless of System.gps_initialized, rather than
  433. * going through gps_initialize()'s boot state machine (which would instead
  434. * re-send the GNSS-mode query if called before the module's PMTK011 boot
  435. * line has been seen). */
  436. void gps_settings_changed(void) {
  437. /*
  438. * PMTK353: set gnss search mode (GPS/Galileo/Glonass/Beidou)
  439. * PMTK313: enable SBAS
  440. */
  441. if (get_flag(CONFFLAG_ENABLE_SBAS)) {
  442. xfprintf(uart0_put_wrap, PSTR("$PMTK313,1*2E\r\n"));
  443. xputs_P(PSTR("SBAS enable sent\r\n"));
  444. } else {
  445. xfprintf(uart0_put_wrap, PSTR("$PMTK313,0*2F\r\n"));
  446. xputs_P(PSTR("SBAS disable sent\r\n"));
  447. }
  448. if (!System.gps_only) {
  449. switch (System.conf.gnss_mode) {
  450. default:
  451. case GNSS_MODE_GPS_GLONASS_GALILEO:
  452. xfprintf(uart0_put_wrap, PSTR("$PMTK353,1,1,1,0,0*2A\r\n"));
  453. break;
  454. case GNSS_MODE_GPS:
  455. xfprintf(uart0_put_wrap, PSTR("$PMTK353,1,0,0,0,0*2A\r\n"));
  456. break;
  457. case GNSS_MODE_GPS_GALILEO:
  458. xfprintf(uart0_put_wrap, PSTR("$PMTK353,1,0,1,0,0*2B\r\n"));
  459. break;
  460. case GNSS_MODE_GALILEO:
  461. xfprintf(uart0_put_wrap, PSTR("$PMTK353,0,0,1,0,0*2A\r\n"));
  462. break;
  463. case GNSS_MODE_GPS_BEIDOU:
  464. xfprintf(uart0_put_wrap, PSTR("$PMTK353,1,0,0,0,1*2B\r\n"));
  465. break;
  466. case GNSS_MODE_BEIDOU:
  467. xfprintf(uart0_put_wrap, PSTR("$PMTK353,0,0,0,0,1*2A\r\n"));
  468. break;
  469. }
  470. xputs_P(PSTR("GNSS mode setting sent\r\n"));
  471. } else {
  472. System.conf.gnss_mode = GNSS_MODE_GPS;
  473. }
  474. }
  475. void gps_initialize(void) {
  476. /*
  477. * PMTK355: query gnss search mode (will fail if only GPS is supported)
  478. * PMTK605: query firmware release; the reply (PMTK705) is logged
  479. * verbatim by the generic PMTK passthrough in gps_parse()
  480. */
  481. switch (System.gps_initialized) {
  482. case GPS_INIT_NOT_INITIALIZED:
  483. xfprintf(uart0_put_wrap, PSTR("$PMTK355*31\r\n"));
  484. xputs_P(PSTR("GNSS mode query sent\r\n"));
  485. xfprintf(uart0_put_wrap, PSTR("$PMTK605*31\r\n"));
  486. System.gps_initialized = GPS_INIT_QUERY_SENT;
  487. break;
  488. case GPS_INIT_QUERY_SENT:
  489. gps_settings_changed();
  490. break;
  491. default:
  492. break;
  493. }
  494. }
  495. void check_min_sat_limit(void) {
  496. if (System.conf.min_sats > 6 && (System.conf.gnss_mode == GNSS_MODE_GPS || System.conf.gnss_mode == GNSS_MODE_GALILEO || System.conf.gnss_mode == GNSS_MODE_BEIDOU)) {
  497. /* by geometry, max visible number is 6..12 */
  498. System.conf.min_sats = 6;
  499. }
  500. }