mirror of https://github.com/wb2osz/direwolf.git
Allow speed for GPSNMEA configuration.
This commit is contained in:
parent
65869bc643
commit
5dbe2ce136
11
src/config.c
11
src/config.c
|
@ -4774,7 +4774,7 @@ void config_init (char *fname, struct audio_s *p_audio_config,
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GPSNMEA - Device name for reading from GPS receiver.
|
* GPSNMEA serial-device [ speed ] - Direct connection to GPS receiver.
|
||||||
*/
|
*/
|
||||||
else if (strcasecmp(t, "gpsnmea") == 0) {
|
else if (strcasecmp(t, "gpsnmea") == 0) {
|
||||||
t = split(NULL,0);
|
t = split(NULL,0);
|
||||||
|
@ -4783,8 +4783,15 @@ void config_init (char *fname, struct audio_s *p_audio_config,
|
||||||
dw_printf ("Config file, line %d: Missing serial port name for GPS receiver.\n", line);
|
dw_printf ("Config file, line %d: Missing serial port name for GPS receiver.\n", line);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
strlcpy (p_misc_config->gpsnmea_port, t, sizeof(p_misc_config->gpsnmea_port));
|
||||||
|
|
||||||
|
t = split(NULL,0);
|
||||||
|
if (t != NULL) {
|
||||||
|
int n = atoi(t);
|
||||||
|
p_misc_config->gpsnmea_speed = n;
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
strlcpy (p_misc_config->gpsnmea_port, t, sizeof(p_misc_config->gpsnmea_port));
|
p_misc_config->gpsnmea_speed = 4800; // The standard at one time.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,8 @@ struct misc_config_s {
|
||||||
|
|
||||||
char gpsnmea_port[20]; /* Serial port name for reading NMEA sentences from GPS. */
|
char gpsnmea_port[20]; /* Serial port name for reading NMEA sentences from GPS. */
|
||||||
/* e.g. COM22, /dev/ttyACM0 */
|
/* e.g. COM22, /dev/ttyACM0 */
|
||||||
/* Currently no option for setting non-standard speed. */
|
|
||||||
|
int gpsnmea_speed; /* Speed for above, baud, default 4800. */
|
||||||
|
|
||||||
char gpsd_host[20]; /* Host for gpsd server. */
|
char gpsd_host[20]; /* Host for gpsd server. */
|
||||||
/* e.g. localhost, 192.168.1.2 */
|
/* e.g. localhost, 192.168.1.2 */
|
||||||
|
|
|
@ -148,7 +148,7 @@ int dwgpsnmea_init (struct misc_config_s *pconfig, int debug)
|
||||||
* Should add an option to allow changing someday.
|
* Should add an option to allow changing someday.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
s_gpsnmea_port_fd = serial_port_open (pconfig->gpsnmea_port, 4800);
|
s_gpsnmea_port_fd = serial_port_open (pconfig->gpsnmea_port, pconfig->gpsnmea_speed);
|
||||||
|
|
||||||
if (s_gpsnmea_port_fd != MYFDERROR) {
|
if (s_gpsnmea_port_fd != MYFDERROR) {
|
||||||
#if __WIN32__
|
#if __WIN32__
|
||||||
|
@ -182,12 +182,10 @@ int dwgpsnmea_init (struct misc_config_s *pconfig, int debug)
|
||||||
|
|
||||||
|
|
||||||
/* Return fd to share if waypoint wants same device. */
|
/* Return fd to share if waypoint wants same device. */
|
||||||
/* Currently both are fixed speed at 4800. */
|
|
||||||
/* If that ever becomes configurable, that needs to be compared too. */
|
|
||||||
|
|
||||||
MYFDTYPE dwgpsnmea_get_fd(char *wp_port_name, int speed)
|
MYFDTYPE dwgpsnmea_get_fd(char *wp_port_name, int speed)
|
||||||
{
|
{
|
||||||
if (strcmp(s_save_configp->gpsnmea_port, wp_port_name) == 0 && speed == 4800) {
|
if (strcmp(s_save_configp->gpsnmea_port, wp_port_name) == 0 && speed == s_save_configp->gpsnmea_speed) {
|
||||||
return (s_gpsnmea_port_fd);
|
return (s_gpsnmea_port_fd);
|
||||||
}
|
}
|
||||||
return (MYFDERROR);
|
return (MYFDERROR);
|
||||||
|
|
Loading…
Reference in New Issue