diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-01-22 18:15:07 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-01-22 20:15:10 -0800 |
commit | 9e0a3168121be98a56fb35e632bea9a00bb9f768 (patch) | |
tree | f8d7ccd5d8a576e6d95430a6bfbcee79718504ce /libdivecomputer.c | |
parent | acd6dff4a8ed7d309e81acb86ee8e1d46bf2767e (diff) | |
download | subsurface-9e0a3168121be98a56fb35e632bea9a00bb9f768.tar.gz |
libdivecomputer: add air temperature fixups for Suunto
libdivecomputer doesn't actually seem to support air temperature
reporting at all, but at least for Suunto dive computers the air
temperature is recorded as the temperature for the first sample.
So since we already have vendor-specific libdivecomputer hacks, let's
just add that one as a rule. It may be that other divecomputers do this
too, so this adds it as a generic concept - it's just that right now the
flag for "air temperature in first sample" is only set for Suunto dive
computers.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'libdivecomputer.c')
-rw-r--r-- | libdivecomputer.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/libdivecomputer.c b/libdivecomputer.c index 2672fb72a..cb4789f49 100644 --- a/libdivecomputer.c +++ b/libdivecomputer.c @@ -24,7 +24,7 @@ static const char *progress_bar_text = ""; static double progress_bar_fraction = 0.0; static int stoptime, stopdepth, ndl, po2, cns; -static gboolean in_deco; +static gboolean in_deco, first_temp_is_air; static GError *error(const char *fmt, ...) { @@ -495,6 +495,12 @@ static int dive_cb(const unsigned char *data, unsigned int size, if (!devdata->force_download && find_dive(&dive->dc)) return 0; + /* Various libdivecomputer interface fixups */ + if (first_temp_is_air && dive->dc.samples) { + dive->airtemp = dive->dc.sample[0].temperature; + dive->dc.sample[0].temperature.mkelvin = 0; + } + dive->downloaded = TRUE; record_dive(dive); mark_divelist_changed(TRUE); @@ -572,6 +578,8 @@ static unsigned int fixup_suunto_versions(device_data_t *devdata, const dc_event struct device_info *info; unsigned int serial = devinfo->serial; + first_temp_is_air = 1; + serial = undo_libdivecomputer_suunto_nr_changes(serial); info = create_device_info(devdata->model, devdata->deviceid); @@ -681,6 +689,7 @@ static const char *do_libdivecomputer_import(device_data_t *data) const char *err; import_dive_number = 0; + first_temp_is_air = 0; data->device = NULL; data->context = NULL; |