summaryrefslogtreecommitdiffstats
path: root/core/liquivision.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2017-07-20 19:49:45 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-07-21 16:33:19 -0700
commit1e38d9239a7bac621eedcb2bab98b90d78b988af (patch)
tree55d30d369aadeb58d19ce5d580fc414b10cfa94c /core/liquivision.c
parent11a0c0cc701806ccec975c67d27dec97fbb13b1f (diff)
downloadsubsurface-1e38d9239a7bac621eedcb2bab98b90d78b988af.tar.gz
Start cleaning up sensor indexing for multiple sensors
This is a very timid start at making us actually use multiple sensors without the magical special case for just CCR oxygen tracking. It mainly does: - turn the "sample->sensor" index into an array of two indexes, to match the pressures themselves. - get rid of dive->{oxygen_cylinder_index,diluent_cylinder_index}, since a CCR dive should now simply set the sample->sensor[] indices correctly instead. - in a couple of places, start actually looping over the sensors rather than special-case the O2 case (although often the small "loops" are just unrolled, since it's just two cases. but in many cases we still end up only covering the zero sensor case, because the CCR O2 sensor code coverage was fairly limited. It's entirely possible (even likely) that this migth break some existing case: it tries to be a fairly direct ("stupid") translation of the old code, but unlike the preparatory patch this does actually does change some semantics. For example, right now the git loader code assumes that if the git save data contains a o2pressure entry, it just hardcodes the O2 sensor index to 1. In fact, one issue is going to simply be that our file formats do not have that multiple sensor format, but instead had very clearly encoded things as being the CCR O2 pressure sensor. But this is hopefully close to usable, and I will need feedback (and maybe test cases) from people who have existing CCR dives with pressure data. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core/liquivision.c')
-rw-r--r--core/liquivision.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/liquivision.c b/core/liquivision.c
index 3406bd3ab..dae9ae81b 100644
--- a/core/liquivision.c
+++ b/core/liquivision.c
@@ -334,7 +334,7 @@ static void parse_dives (int log_version, const unsigned char *buf, unsigned int
sample->time.seconds = event.time;
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 = event.pressure.sensor;
+ sample->sensor[0] = event.pressure.sensor;
sample->pressure[0].mbar = event.pressure.mbar;
finish_sample(dc);
@@ -352,7 +352,7 @@ static void parse_dives (int log_version, const unsigned char *buf, unsigned int
sample->time.seconds = sample_time;
sample->depth.mm = depth_mm;
sample->temperature.mkelvin = temp_mk;
- sample->sensor = event.pressure.sensor;
+ sample->sensor[0] = event.pressure.sensor;
sample->pressure[0].mbar = event.pressure.mbar;
finish_sample(dc);
d++;
@@ -360,7 +360,7 @@ static void parse_dives (int log_version, const unsigned char *buf, unsigned int
break;
} else { // Event is prior to sample
sample->time.seconds = event.time;
- sample->sensor = event.pressure.sensor;
+ sample->sensor[0] = event.pressure.sensor;
sample->pressure[0].mbar = event.pressure.mbar;
if (last_time == sample_time) {
sample->depth.mm = depth_mm;