aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar John Van Ostrand <john@vanostrand.com>2014-11-07 12:51:01 -0500
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-11-07 13:15:44 -0800
commitd4121fb42afc2ed89d4109fee948e8f0fec12531 (patch)
tree157334d14a404dc51aba37f90d85608fbe3b0061
parent8136306911328b9899a526671daf03ad03abb107 (diff)
downloadsubsurface-d4121fb42afc2ed89d4109fee948e8f0fec12531.tar.gz
Liquivision import fixes
Fixed rounding of temperatures Fixed compile warnings Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--file.h1
-rw-r--r--liquivision.c8
2 files changed, 5 insertions, 4 deletions
diff --git a/file.h b/file.h
index 8c5b48bc9..d4c52fdb7 100644
--- a/file.h
+++ b/file.h
@@ -7,6 +7,7 @@ struct memblock {
};
extern int try_to_open_cochran(const char *filename, struct memblock *mem);
+extern int try_to_open_liquivision(const char *filename, struct memblock *mem);
#ifdef __cplusplus
extern "C" {
diff --git a/liquivision.c b/liquivision.c
index bb71bfdee..2ba9b2d9f 100644
--- a/liquivision.c
+++ b/liquivision.c
@@ -215,15 +215,15 @@ parse_dives (int log_version, const unsigned char *buf, unsigned int buf_size) {
// Get sample times
sample_time = d * sample_interval;
depth_mm = array_uint16_le(ds + d * 2) * 10; // cm->mm
- temp_mk = C_to_mkelvin(array_uint16_le(ts + d * 2) / 10); // dC->mK
+ temp_mk = C_to_mkelvin((float)array_uint16_le(ts + d * 2) / 10); // dC->mK
next_time = (d < sample_count - 1 ? (d + 1) * sample_interval : sample_time);
last_time = (d ? (d - 1) * sample_interval : 0);
if (d == sample_count) {
// We still have events to record
sample->time.seconds = event_time;
- sample->depth.mm == array_uint16_le(ds + (d - 1) * 2) * 10; // cm->mm
- sample->temperature.mkelvin = C_to_mkelvin(array_uint16_le(ts + (d - 1) * 2) / 10); // dC->mK
+ sample->depth.mm = array_uint16_le(ds + (d - 1) * 2) * 10; // cm->mm
+ sample->temperature.mkelvin = C_to_mkelvin((float) array_uint16_le(ts + (d - 1) * 2) / 10); // dC->mK
sample->sensor = sensor;
sample->cylinderpressure.mbar = mbar;
finish_sample(dc);
@@ -257,7 +257,7 @@ parse_dives (int log_version, const unsigned char *buf, unsigned int buf_size) {
} else {
// Extrapolate
last_depth = array_uint16_le(ds + (d - 1) * 2) * 10; // cm->mm
- last_temp = C_to_mkelvin(array_uint16_le(ts + (d - 1) * 2) / 10); // dC->mK
+ last_temp = C_to_mkelvin((float) array_uint16_le(ts + (d - 1) * 2) / 10); // dC->mK
sample->depth.mm = last_depth + (depth_mm - last_depth)
* (event_time - last_time) / sample_interval;
sample->temperature.mkelvin = last_temp + (temp_mk - last_temp)