mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Store and parse salinity and surface pressure
In my excitement about extracting these from libdivecomputer I forgot to actually store them and then parse them again. Oops. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
fbbdb834f9
commit
56f62cc4ab
2 changed files with 44 additions and 0 deletions
18
parse-xml.c
18
parse-xml.c
|
@ -308,6 +308,20 @@ static void pressure(char *buffer, void *_press)
|
|||
free(buffer);
|
||||
}
|
||||
|
||||
static void salinity(char *buffer, void *_salinity)
|
||||
{
|
||||
int *salinity = _salinity;
|
||||
union int_or_float val;
|
||||
switch (integer_or_float(buffer, &val)) {
|
||||
case FLOAT:
|
||||
*salinity = val.fp * 10.0 + 0.5;
|
||||
break;
|
||||
default:
|
||||
printf("Strange salinity reading %s\n", buffer);
|
||||
}
|
||||
free(buffer);
|
||||
}
|
||||
|
||||
static void depth(char *buffer, void *_depth)
|
||||
{
|
||||
depth_t *depth = _depth;
|
||||
|
@ -1106,6 +1120,10 @@ static void try_to_fill_dive(struct dive **divep, const char *name, char *buf)
|
|||
return;
|
||||
if (MATCH(".temperature.water", temperature, &dive->watertemp))
|
||||
return;
|
||||
if (MATCH(".surface.pressure", pressure, &dive->surface_pressure))
|
||||
return;
|
||||
if (MATCH(".water.salinity", salinity, &dive->salinity))
|
||||
return;
|
||||
if (MATCH(".cylinderstartpressure", pressure, &dive->cylinder[0].start))
|
||||
return;
|
||||
if (MATCH(".cylinderendpressure", pressure, &dive->cylinder[0].end))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue