mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
Prefer "GPS1" for divecomputer download dive site resolution
I think we only have one dive computer that supports GPS data right now: the Garmin Descent Mk1. It reports the dive coordinates as "GPS1" and "GPS2" for the entry point and exit point respectively. Often GPS1 is missing, because the dive computer may not have gotten a GPS lock before the diver jumped into the water, so when that happens we'll use GPS2 for the dive site location. But when GPS1 exists, we should prefer that. And that's what we already did in logic in dc_get_gps_location(), but for the initial dive site created at download time, we just picked any divecomputer reported string that started with "GPS". And since GPS2 is reported after GPS1 by the Garmin Descent, it would end up overwriting the entry point that we _should_ have preferred. Add the same kind of "explicitly prefer GPS1" logic to the initial dive download case as we already had elsewhere. Reported-by: @brysconsulting Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
eb22c0205e
commit
a7ca27d071
1 changed files with 9 additions and 0 deletions
|
@ -607,6 +607,15 @@ static void parse_string_field(device_data_t *devdata, struct dive *dive, dc_fie
|
|||
char *line = (char *) str->value;
|
||||
location_t location;
|
||||
|
||||
/* Do we already have a divesite? */
|
||||
if (dive->dive_site) {
|
||||
/*
|
||||
* "GPS1" always takes precedence, anything else
|
||||
* we'll just pick the first "GPS*" that matches.
|
||||
*/
|
||||
if (strcmp(str->desc, "GPS1") != 0)
|
||||
return;
|
||||
}
|
||||
parse_location(line, &location);
|
||||
|
||||
if (location.lat.udeg && location.lon.udeg) {
|
||||
|
|
Loading…
Add table
Reference in a new issue