summaryrefslogtreecommitdiffstats
path: root/divelist.c
diff options
context:
space:
mode:
authorGravatar Willem Ferguson <willemferguson@zoology.up.ac.za>2014-06-03 19:21:41 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-03 17:05:25 -0700
commiteaf6d564874ac838dc4f3cca7a781034ae60ef7f (patch)
treed214c58bdc33f6dbd058afe715de357dd14d4114 /divelist.c
parent1fec6453a2b7b6dcd34901a4e92dd11aae38879c (diff)
downloadsubsurface-eaf6d564874ac838dc4f3cca7a781034ae60ef7f.tar.gz
CCR code: Change to sample structure
1) All the variables in the sample structures are strongly typed 2) Two additional types were declared in units.h: o2pressure_t bearing_t 3) The following variables were added: diluentpressure o2setpoint o2sensor[3] 4) Changes to a number of files were made to chanf sample->po2 to sample->po2.mbar bearing to bearring.degrees Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'divelist.c')
-rw-r--r--divelist.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/divelist.c b/divelist.c
index 489982465..c018bbdc7 100644
--- a/divelist.c
+++ b/divelist.c
@@ -178,8 +178,8 @@ static int calculate_otu(struct dive *dive)
struct sample *sample = dc->sample + i;
struct sample *psample = sample - 1;
t = sample->time.seconds - psample->time.seconds;
- if (sample->po2) {
- po2 = sample->po2;
+ if (sample->po2.mbar) {
+ po2 = sample->po2.mbar;
} else {
int o2 = active_o2(dive, dc, sample->time);
po2 = o2 * depth_to_atm(sample->depth.mm, dive);
@@ -242,8 +242,8 @@ static int calculate_cns(struct dive *dive)
struct sample *sample = dc->sample + i;
struct sample *psample = sample - 1;
t = sample->time.seconds - psample->time.seconds;
- if (sample->po2) {
- po2 = sample->po2;
+ if (sample->po2.mbar) {
+ po2 = sample->po2.mbar;
} else {
int o2 = active_o2(dive, dc, sample->time);
po2 = o2 / depth_to_atm(sample->depth.mm, dive);
@@ -326,7 +326,7 @@ static void add_dive_to_deco(struct dive *dive)
for (j = t0; j < t1; j++) {
int depth = interpolate(psample->depth.mm, sample->depth.mm, j - t0, t1 - t0);
(void)add_segment(depth_to_mbar(depth, dive) / 1000.0,
- &dive->cylinder[sample->sensor].gasmix, 1, sample->po2, dive);
+ &dive->cylinder[sample->sensor].gasmix, 1, sample->po2.mbar, dive);
}
}
}