Add beacon position ambiguity option.

This commit is contained in:
WB2OSZ 2017-06-14 21:57:34 -04:00
parent ed67bdfd84
commit 647d698656
3 changed files with 22 additions and 4 deletions

View File

@ -839,7 +839,7 @@ static void beacon_send (int j, dwgps_info_t *gpsinfo)
case BEACON_POSITION:
encode_position (bp->messaging, bp->compress,
bp->lat, bp->lon, 0,
bp->lat, bp->lon, bp->ambiguity,
(int)roundf(DW_METERS_TO_FEET(bp->alt_m)),
bp->symtab, bp->symbol,
bp->power, bp->height, bp->gain, bp->dir,
@ -852,7 +852,7 @@ static void beacon_send (int j, dwgps_info_t *gpsinfo)
case BEACON_OBJECT:
encode_object (bp->objname, bp->compress, 0, bp->lat, bp->lon, 0,
encode_object (bp->objname, bp->compress, 0, bp->lat, bp->lon, bp->ambiguity,
bp->symtab, bp->symbol,
bp->power, bp->height, bp->gain, bp->dir,
G_UNKNOWN, G_UNKNOWN, /* course, speed */
@ -883,7 +883,7 @@ static void beacon_send (int j, dwgps_info_t *gpsinfo)
}
encode_position (bp->messaging, bp->compress,
gpsinfo->dlat, gpsinfo->dlon, 0, my_alt_ft,
gpsinfo->dlat, gpsinfo->dlon, bp->ambiguity, my_alt_ft,
bp->symtab, bp->symbol,
bp->power, bp->height, bp->gain, bp->dir,
coarse, (int)roundf(gpsinfo->speed_knots),

View File

@ -4778,6 +4778,7 @@ static int beacon_options(char *cmd, struct beacon_s *b, int line, struct audio_
//b->every = 3600;
b->lat = G_UNKNOWN;
b->lon = G_UNKNOWN;
b->ambiguity = 0;
b->alt_m = G_UNKNOWN;
b->symtab = '/';
b->symbol = '-'; /* house */
@ -4904,6 +4905,16 @@ static int beacon_options(char *cmd, struct beacon_s *b, int line, struct audio_
else if (strcasecmp(keyword, "LONG") == 0 || strcasecmp(keyword, "LON") == 0) {
b->lon = parse_ll (value, LON, line);
}
else if (strcasecmp(keyword, "AMBIGUITY") == 0 || strcasecmp(keyword, "AMBIG") == 0) {
int n = atoi(value);
if (n >= 0 && n <= 4) {
b->ambiguity = n;
}
else {
text_color_set(DW_COLOR_ERROR);
dw_printf ("Config file: Location ambiguity, on line %d, must be in range of 0 to 4.\n", line);
}
}
else if (strcasecmp(keyword, "ALT") == 0 || strcasecmp(keyword, "ALTITUDE") == 0) {
b->alt_m = atof(value);
}
@ -4971,7 +4982,13 @@ static int beacon_options(char *cmd, struct beacon_s *b, int line, struct audio_
if (b->custom_info != NULL && b->custom_infocmd != NULL) {
text_color_set(DW_COLOR_ERROR);
dw_printf ("Config file, line %d: Can't use both INFO and INFOCMD at the same time..\n", line);
dw_printf ("Config file, line %d: Can't use both INFO and INFOCMD at the same time.\n", line);
}
if (b->compress && b->ambiguity != 0) {
text_color_set(DW_COLOR_ERROR);
dw_printf ("Config file, line %d: Position ambiguity can't be used with compressed location format.\n", line);
b->ambiguity = 0;
}
/*

View File

@ -164,6 +164,7 @@ struct misc_config_s {
double lat; /* Latitude and longitude. */
double lon;
int ambiguity; /* Number of lower digits to trim from location. 0 (default), 1, 2, 3, 4. */
float alt_m; /* Altitude in meters. */
char symtab; /* Symbol table: / or \ or overlay character. */