mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Refactor Seabear import
Moving the GUI independent Seabear import functionality to Subsurface core. This will allow Robert to call it directly from download from DC. Tested with H3 against released and daily versions of Subsurface. The result differs somewhat, but it is actually fixing 2 bugs: - Temperature was mis-interpreted previously - Sample interval for a dive with 1 second interval was parsed incorrectly Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
This commit is contained in:
parent
ab1813a445
commit
0dfa448d8c
6 changed files with 116 additions and 50 deletions
21
core/file.c
21
core/file.c
|
@ -1055,6 +1055,27 @@ int parse_csv_file(const char *filename, char **params, int pnr, const char *csv
|
|||
}
|
||||
|
||||
#define SBPARAMS 40
|
||||
int parse_seabear_log(const char *filename)
|
||||
{
|
||||
char *params[SBPARAMS];
|
||||
int pnr = 0;
|
||||
|
||||
pnr = parse_seabear_header(filename, params, pnr);
|
||||
|
||||
if (parse_seabear_csv_file(filename, params, pnr, "csv") < 0) {
|
||||
return -1;
|
||||
}
|
||||
// Seabear CSV stores NDL and TTS in Minutes, not seconds
|
||||
struct dive *dive = dive_table.dives[dive_table.nr - 1];
|
||||
for(int s_nr = 0 ; s_nr < dive->dc.samples ; s_nr++) {
|
||||
struct sample *sample = dive->dc.sample + s_nr;
|
||||
sample->ndl.seconds *= 60;
|
||||
sample->tts.seconds *= 60;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int parse_seabear_csv_file(const char *filename, char **params, int pnr, const char *csvtemplate)
|
||||
{
|
||||
int ret, i;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue