mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Finish removing accesses to first divecomputer instead of dive
This adds watertemp and airtemp to the dive, populates them in fixup and uses them elsewhere in the code. WARNING: as a sideeffect we now edit the airtemp in the dive, but we never display this in the DIve Info notebook (as that always displays the data from the specific selected divecomputer). This is likely to cause confusion. It's consistent behavior, but... odd. This brings back the desire to have a view of "best data available" for a dive, in addition to the "per divecomputer" view. This would also allow us to consolidate the different pressure graphs we may be getting from different divecomputers (consider the case where you dive with multiple air integrated computers that are connected to different tanks - now we could have one profile with all the correct tank pressure plots overlayed - and the best available (or edited) data in the corresponding Dive Info notebook. This commit also fixes a few remaining accesses to the first divecomputer that fell through the cracks earlier and does a couple of other related cleanups. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
b9865d6bbc
commit
ebcbe5aedd
6 changed files with 52 additions and 19 deletions
8
file.c
8
file.c
|
@ -174,6 +174,7 @@ static int try_to_open_csv(const char *filename, struct memblock *mem, enum csv_
|
|||
int i, time;
|
||||
timestamp_t date;
|
||||
struct dive *dive;
|
||||
struct divecomputer *dc;
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
header[i] = p;
|
||||
|
@ -190,6 +191,7 @@ static int try_to_open_csv(const char *filename, struct memblock *mem, enum csv_
|
|||
dive = alloc_dive();
|
||||
dive->when = date;
|
||||
dive->number = atoi(header[1]);
|
||||
dc = &dive->dc;
|
||||
|
||||
time = 0;
|
||||
for (;;) {
|
||||
|
@ -204,13 +206,13 @@ static int try_to_open_csv(const char *filename, struct memblock *mem, enum csv_
|
|||
if (errno)
|
||||
break;
|
||||
|
||||
sample = prepare_sample(&dive->dc);
|
||||
sample = prepare_sample(dc);
|
||||
sample->time.seconds = time;
|
||||
add_sample_data(sample, type, val);
|
||||
finish_sample(&dive->dc);
|
||||
finish_sample(dc);
|
||||
|
||||
time++;
|
||||
dive->dc.duration.seconds = time;
|
||||
dc->duration.seconds = time;
|
||||
if (*end != ',')
|
||||
break;
|
||||
p = end+1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue