summaryrefslogtreecommitdiff
path: root/cgps.c
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2018-09-19 20:17:59 -0700
committerGary E. Miller <gem@rellim.com>2018-09-19 20:17:59 -0700
commit6dd156e2c7c9d60109b1e86e583ef9bb570e3701 (patch)
treec46776563cf382425c9c9168b96a7d5254086ea9 /cgps.c
parentd153889ef8d08d8715abc9a9ed7dbb28c924aefe (diff)
downloadgpsd-6dd156e2c7c9d60109b1e86e583ef9bb570e3701.tar.gz
cgps: Display gnssid as text if possible.
Diffstat (limited to 'cgps.c')
-rw-r--r--cgps.c44
1 files changed, 39 insertions, 5 deletions
diff --git a/cgps.c b/cgps.c
index 03aa1575..2b491c45 100644
--- a/cgps.c
+++ b/cgps.c
@@ -138,15 +138,15 @@ static bool compass_flag = false;
#define GPS_ERROR -2 /* low-level failure in GPS read */
#define GPS_TIMEOUT -3 /* low-level failure in GPS waiting */
-/* range test an int, return 5 chars + NUL */
+/* range test an int, return 4 chars + NUL */
static const char *int_to_str(int val, int min, int max)
{
static char buf[20];
if (val < min || val > max) {
- return " n/a";
+ return " n/a";
}
- (void)snprintf(buf, sizeof(buf), "%5d", val);
+ (void)snprintf(buf, sizeof(buf), "%4d", val);
return buf;
}
@@ -443,7 +443,7 @@ static void windowsetup(void)
*
* Geostar GPS receivers compute USI this way:
* GPS is USI 1 to 32, SBAS is 33 to 64, GLONASS is 65 to 96 */
- (void)mvwaddstr(satellites, 1, 1, " PRN Elev Azim SNR Used ");
+ (void)mvwaddstr(satellites, 1, 1, " PRN Elev Azim SNR Use ");
(void)wborder(satellites, 0, 0, 0, 0, 0, 0, 0, 0);
}
}
@@ -550,9 +550,43 @@ static void update_gps_panel(struct gps_data_t *gpsdata, char *message)
/* displayed all sats that fit, maybe all of them */
for (sat_no = 0; sat_no < loop_end; sat_no++) {
int column = 1; /* column to write to */
+ char *gnssid;
+
+ if ( 0 == gpsdata->skyview[sat_no].svid) {
+ gnssid = " ";
+ } else {
+ switch (gpsdata->skyview[sat_no].gnssid) {
+ default:
+ gnssid = " ";
+ break;
+ case 0:
+ gnssid = "GP"; /* GPS */
+ break;
+ case 1:
+ gnssid = "SB"; /* GPS */
+ break;
+ case 2:
+ gnssid = "GA"; /* GALILEO */
+ break;
+ case 3:
+ gnssid = "BD"; /* BeiDou */
+ break;
+ case 4:
+ gnssid = "IM"; /* IMES */
+ break;
+ case 5:
+ gnssid = "QZ"; /* QZSS */
+ break;
+ case 6:
+ gnssid = "GL"; /* GLONASS */
+ break;
+ }
+ }
+ (void)mvwaddstr(satellites, sat_no + 2, column, gnssid);
/* no GPS uses PRN 0, some use 255 for 'unknown'
* u-blox uses PRN 1-255, NMEA 4.0 uses 1-437 */
+ column += 3;
(void)mvwaddstr(satellites, sat_no + 2, column,
int_to_str(gpsdata->skyview[sat_no].PRN,
1, 438));
@@ -570,7 +604,7 @@ static void update_gps_panel(struct gps_data_t *gpsdata, char *message)
int_to_str((int)round(gpsdata->skyview[sat_no].ss),
0, 254));
column += 6;
- (void)mvwprintw(satellites, sat_no + 2, column, " %c",
+ (void)mvwprintw(satellites, sat_no + 2, column, " %c ",
gpsdata->skyview[sat_no].used ? 'Y' : 'N');
}