mirror of https://github.com/wb2osz/direwolf.git
Add beacon position ambiguity option.
This commit is contained in:
parent
ed67bdfd84
commit
647d698656
6
beacon.c
6
beacon.c
|
@ -839,7 +839,7 @@ static void beacon_send (int j, dwgps_info_t *gpsinfo)
|
||||||
case BEACON_POSITION:
|
case BEACON_POSITION:
|
||||||
|
|
||||||
encode_position (bp->messaging, bp->compress,
|
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)),
|
(int)roundf(DW_METERS_TO_FEET(bp->alt_m)),
|
||||||
bp->symtab, bp->symbol,
|
bp->symtab, bp->symbol,
|
||||||
bp->power, bp->height, bp->gain, bp->dir,
|
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:
|
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->symtab, bp->symbol,
|
||||||
bp->power, bp->height, bp->gain, bp->dir,
|
bp->power, bp->height, bp->gain, bp->dir,
|
||||||
G_UNKNOWN, G_UNKNOWN, /* course, speed */
|
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,
|
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->symtab, bp->symbol,
|
||||||
bp->power, bp->height, bp->gain, bp->dir,
|
bp->power, bp->height, bp->gain, bp->dir,
|
||||||
coarse, (int)roundf(gpsinfo->speed_knots),
|
coarse, (int)roundf(gpsinfo->speed_knots),
|
||||||
|
|
19
config.c
19
config.c
|
@ -4778,6 +4778,7 @@ static int beacon_options(char *cmd, struct beacon_s *b, int line, struct audio_
|
||||||
//b->every = 3600;
|
//b->every = 3600;
|
||||||
b->lat = G_UNKNOWN;
|
b->lat = G_UNKNOWN;
|
||||||
b->lon = G_UNKNOWN;
|
b->lon = G_UNKNOWN;
|
||||||
|
b->ambiguity = 0;
|
||||||
b->alt_m = G_UNKNOWN;
|
b->alt_m = G_UNKNOWN;
|
||||||
b->symtab = '/';
|
b->symtab = '/';
|
||||||
b->symbol = '-'; /* house */
|
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) {
|
else if (strcasecmp(keyword, "LONG") == 0 || strcasecmp(keyword, "LON") == 0) {
|
||||||
b->lon = parse_ll (value, LON, line);
|
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) {
|
else if (strcasecmp(keyword, "ALT") == 0 || strcasecmp(keyword, "ALTITUDE") == 0) {
|
||||||
b->alt_m = atof(value);
|
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) {
|
if (b->custom_info != NULL && b->custom_infocmd != NULL) {
|
||||||
text_color_set(DW_COLOR_ERROR);
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
1
config.h
1
config.h
|
@ -164,6 +164,7 @@ struct misc_config_s {
|
||||||
|
|
||||||
double lat; /* Latitude and longitude. */
|
double lat; /* Latitude and longitude. */
|
||||||
double lon;
|
double lon;
|
||||||
|
int ambiguity; /* Number of lower digits to trim from location. 0 (default), 1, 2, 3, 4. */
|
||||||
float alt_m; /* Altitude in meters. */
|
float alt_m; /* Altitude in meters. */
|
||||||
|
|
||||||
char symtab; /* Symbol table: / or \ or overlay character. */
|
char symtab; /* Symbol table: / or \ or overlay character. */
|
||||||
|
|
Loading…
Reference in New Issue