summaryrefslogtreecommitdiffstats
path: root/core/dive.h
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/dive.h
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/dive.h')
-rw-r--r--core/dive.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/core/dive.h b/core/dive.h
index 73de24b61..2d1b761f0 100644
--- a/core/dive.h
+++ b/core/dive.h
@@ -198,7 +198,7 @@ struct sample // BASE TYPE BYTES UNITS RANGE DE
o2pressure_t setpoint; // uint16_t 2 mbar (0-65 bar) O2 partial pressure (will be setpoint)
o2pressure_t o2sensor[3]; // uint16_t 6 mbar (0-65 bar) Up to 3 PO2 sensor values (rebreather)
bearing_t bearing; // int16_t 2 degrees (-32k to 32k deg) compass bearing
- uint8_t sensor; // uint8_t 1 sensorID (0-255) ID of cylinder pressure sensor
+ uint8_t sensor[2]; // uint8_t 1 sensorID (0-255) ID of cylinder pressure sensor
uint8_t cns; // uint8_t 1 % (0-255 %) cns% accumulated
uint8_t heartbeat; // uint8_t 1 beats/m (0-255) heart rate measurement
volume_t sac; // 4 ml/min predefined SAC
@@ -352,7 +352,6 @@ struct dive {
struct divecomputer dc;
int id; // unique ID for this dive
struct picture *picture_list;
- int oxygen_cylinder_index, diluent_cylinder_index; // CCR dive cylinder indices
unsigned char git_id[20];
};