summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2018-03-28 22:50:28 +0200
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2018-05-14 23:47:00 +0300
commit69de9d8f988aecc59b53c5bf1a1ec55d6529c59e (patch)
tree2b6e11f2bc362f6dbfc2160a9f1241cc5aa99851
parent6b0ecb012dcfe1945bedf38fe25f67a1d2c3c400 (diff)
downloadsubsurface-69de9d8f988aecc59b53c5bf1a1ec55d6529c59e.tar.gz
Add planner infra structure for bailout
Add a divemode column to the planner model and a corresponding field to struct divepoint and fill it in the corresponding functions. Signed-off-by: Robert C. Helling <helling@atdotde.de>
-rw-r--r--core/dive.h3
-rw-r--r--core/planner.c37
-rw-r--r--qt-models/diveplannermodel.cpp22
-rw-r--r--qt-models/diveplannermodel.h1
-rw-r--r--tests/testplan.cpp82
5 files changed, 86 insertions, 59 deletions
diff --git a/core/dive.h b/core/dive.h
index 75f042790..54935226d 100644
--- a/core/dive.h
+++ b/core/dive.h
@@ -874,6 +874,7 @@ struct divedatapoint {
int setpoint;
bool entered;
struct divedatapoint *next;
+ enum dive_comp_type divemode;
};
struct diveplan {
@@ -890,7 +891,7 @@ struct diveplan {
int surface_interval;
};
-struct divedatapoint *plan_add_segment(struct diveplan *diveplan, int duration, int depth, int cylinderid, int po2, bool entered);
+struct divedatapoint *plan_add_segment(struct diveplan *diveplan, int duration, int depth, int cylinderid, int po2, bool entered, enum dive_comp_type divemode);
struct divedatapoint *create_dp(int time_incr, int depth, int cylinderid, int po2);
#if DEBUG_PLAN
void dump_plan(struct diveplan *diveplan);
diff --git a/core/planner.c b/core/planner.c
index 62776d690..51b9e5f9f 100644
--- a/core/planner.c
+++ b/core/planner.c
@@ -336,6 +336,11 @@ static void create_dive_from_plan(struct diveplan *diveplan, struct dive *dive,
finish_sample(dc);
lastcylid = dp->cylinderid;
}
+ if (dp->divemode != type) {
+ type = dp->divemode;
+ add_event(dc, lasttime, 50 + type, 0, 0, divemode_text[type]);
+ }
+
/* Create sample */
sample = prepare_sample(dc);
/* set po2 at beginning of this segment */
@@ -409,10 +414,11 @@ void add_to_end_of_diveplan(struct diveplan *diveplan, struct divedatapoint *dp)
dp->time += lasttime;
}
-struct divedatapoint *plan_add_segment(struct diveplan *diveplan, int duration, int depth, int cylinderid, int po2, bool entered)
+struct divedatapoint *plan_add_segment(struct diveplan *diveplan, int duration, int depth, int cylinderid, int po2, bool entered, enum dive_comp_type divemode)
{
struct divedatapoint *dp = create_dp(duration, depth, cylinderid, po2);
dp->entered = entered;
+ dp->divemode = divemode;
add_to_end_of_diveplan(diveplan, dp);
return dp;
}
@@ -690,6 +696,7 @@ bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, i
int laststoptime = timestep;
bool o2breaking = false;
int decostopcounter = 0;
+ enum dive_comp_type divemode = dive->dc.divemode;
set_gf(diveplan->gflow, diveplan->gfhigh);
set_vpmb_conservatism(diveplan->vpmb_conservatism);
@@ -724,6 +731,8 @@ bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, i
bottom_time = clock = previous_point_time = dive->dc.sample[dive->dc.samples - 1].time.seconds;
current_cylinder = get_cylinderid_at_time(dive, &dive->dc, sample->time);
+ // FIXME: This needs a function to find the divemode at the end of the dive like in
+ // divemode = get_divemode_at_time(dive, &dive->dc, sample->time);
gas = dive->cylinder[current_cylinder].gasmix;
po2 = sample->setpoint.mbar;
@@ -737,7 +746,7 @@ bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, i
* same ascent rate as in fake_dc(). If you change it here, also change it there.
*/
transitiontime = lrint(depth / (double)prefs.ascratelast6m);
- plan_add_segment(diveplan, transitiontime, 0, current_cylinder, po2, false);
+ plan_add_segment(diveplan, transitiontime, 0, current_cylinder, po2, false, divemode);
create_dive_from_plan(diveplan, dive, is_planner);
return false;
}
@@ -794,13 +803,13 @@ bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, i
// so we don't really have to compute the deco state.
update_cylinder_pressure(dive, depth, depth, -timestep, prefs.bottomsac, &dive->cylinder[current_cylinder], false);
clock -= timestep;
- plan_add_segment(diveplan, clock - previous_point_time, depth, current_cylinder, po2, true);
+ plan_add_segment(diveplan, clock - previous_point_time, depth, current_cylinder, po2, true, divemode);
previous_point_time = clock;
do {
/* Ascend to surface */
int deltad = ascent_velocity(depth, avg_depth, bottom_time) * TIMESTEP;
if (ascent_velocity(depth, avg_depth, bottom_time) != last_ascend_rate) {
- plan_add_segment(diveplan, clock - previous_point_time, depth, current_cylinder, po2, false);
+ plan_add_segment(diveplan, clock - previous_point_time, depth, current_cylinder, po2, false, divemode);
previous_point_time = clock;
last_ascend_rate = ascent_velocity(depth, avg_depth, bottom_time);
}
@@ -810,15 +819,15 @@ bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, i
clock += TIMESTEP;
depth -= deltad;
if (depth <= 5000 && depth >= (5000 - deltad) && safety_stop) {
- plan_add_segment(diveplan, clock - previous_point_time, 5000, current_cylinder, po2, false);
+ plan_add_segment(diveplan, clock - previous_point_time, 5000, current_cylinder, po2, false, divemode);
previous_point_time = clock;
clock += 180;
- plan_add_segment(diveplan, clock - previous_point_time, 5000, current_cylinder, po2, false);
+ plan_add_segment(diveplan, clock - previous_point_time, 5000, current_cylinder, po2, false, divemode);
previous_point_time = clock;
safety_stop = false;
}
} while (depth > 0);
- plan_add_segment(diveplan, clock - previous_point_time, 0, current_cylinder, po2, false);
+ plan_add_segment(diveplan, clock - previous_point_time, 0, current_cylinder, po2, false, divemode);
create_dive_from_plan(diveplan, dive, is_planner);
add_plan_to_notes(diveplan, dive, show_disclaimer, error);
fixup_dc_duration(&dive->dc);
@@ -891,7 +900,7 @@ bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, i
int deltad = ascent_velocity(depth, avg_depth, bottom_time) * TIMESTEP;
if (ascent_velocity(depth, avg_depth, bottom_time) != last_ascend_rate) {
if (is_final_plan)
- plan_add_segment(diveplan, clock - previous_point_time, depth, current_cylinder, po2, false);
+ plan_add_segment(diveplan, clock - previous_point_time, depth, current_cylinder, po2, false, divemode);
previous_point_time = clock;
stopping = false;
last_ascend_rate = ascent_velocity(depth, avg_depth, bottom_time);
@@ -917,7 +926,7 @@ bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, i
/* We have reached a gas change.
* Record this in the dive plan */
if (is_final_plan)
- plan_add_segment(diveplan, clock - previous_point_time, depth, current_cylinder, po2, false);
+ plan_add_segment(diveplan, clock - previous_point_time, depth, current_cylinder, po2, false, divemode);
previous_point_time = clock;
stopping = true;
@@ -975,7 +984,7 @@ bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, i
/* The last segment was an ascend segment.
* Add a waypoint for start of this deco stop */
if (is_final_plan)
- plan_add_segment(diveplan, clock - previous_point_time, depth, current_cylinder, po2, false);
+ plan_add_segment(diveplan, clock - previous_point_time, depth, current_cylinder, po2, false, divemode);
previous_point_time = clock;
stopping = true;
}
@@ -1029,7 +1038,7 @@ bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, i
o2break_next = true;
breakfrom_cylinder = current_cylinder;
if (is_final_plan)
- plan_add_segment(diveplan, laststoptime, depth, current_cylinder, po2, false);
+ plan_add_segment(diveplan, laststoptime, depth, current_cylinder, po2, false, divemode);
previous_point_time = clock + laststoptime;
current_cylinder = break_cylinder;
gas = dive->cylinder[current_cylinder].gasmix;
@@ -1041,7 +1050,7 @@ bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, i
o2breaking = true;
o2break_next = false;
if (is_final_plan)
- plan_add_segment(diveplan, laststoptime, depth, current_cylinder, po2, false);
+ plan_add_segment(diveplan, laststoptime, depth, current_cylinder, po2, false, divemode);
previous_point_time = clock + laststoptime;
current_cylinder = breakfrom_cylinder;
gas = dive->cylinder[current_cylinder].gasmix;
@@ -1062,7 +1071,7 @@ bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, i
if (stopping) {
/* Next we will ascend again. Add a waypoint if we have spend deco time */
if (is_final_plan)
- plan_add_segment(diveplan, clock - previous_point_time, depth, current_cylinder, po2, false);
+ plan_add_segment(diveplan, clock - previous_point_time, depth, current_cylinder, po2, false, divemode);
previous_point_time = clock;
stopping = false;
}
@@ -1075,7 +1084,7 @@ bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, i
} while (!is_final_plan);
decostoptable[decostopcounter].depth = 0;
- plan_add_segment(diveplan, clock - previous_point_time, 0, current_cylinder, po2, false);
+ plan_add_segment(diveplan, clock - previous_point_time, 0, current_cylinder, po2, false, divemode);
if (decoMode() == VPMB) {
diveplan->eff_gfhigh = lrint(100.0 * regressionb());
diveplan->eff_gflow = lrint(100.0 * (regressiona() * first_stop_depth + regressionb()));
diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp
index deb3afe82..8103d4d1b 100644
--- a/qt-models/diveplannermodel.cpp
+++ b/qt-models/diveplannermodel.cpp
@@ -252,6 +252,8 @@ QVariant DivePlannerPointsModel::data(const QModelIndex &index, int role) const
return (p.time - divepoints.at(index.row() - 1).time) / 60;
else
return p.time / 60;
+ case DIVEMODE:
+ return QString(divemode_text[p.divemode]);
case GAS:
/* Check if we have the same gasmix two or more times
* If yes return more verbose string */
@@ -330,6 +332,12 @@ bool DivePlannerPointsModel::setData(const QModelIndex &index, const QVariant &v
CylindersModel::instance()->moveAtFirst(value.toInt());
CylindersModel::instance()->updateTrashIcon();
break;
+ case DIVEMODE:
+ if (value.toInt() < FREEDIVE) // FIXME: I want to be a combo box and translate strings to enum values
+ p.divemode = (enum dive_comp_type) value.toInt();
+ if (index.row() == 0)
+ displayed_dive.dc.divemode = (enum dive_comp_type) value.toInt();
+ break;
}
editStop(index.row(), p);
}
@@ -367,6 +375,8 @@ QVariant DivePlannerPointsModel::headerData(int section, Qt::Orientation orienta
return tr("Used gas");
case CCSETPOINT:
return tr("CC setpoint");
+ case DIVEMODE:
+ return tr("Dive mode");
}
} else if (role == Qt::FontRole) {
return defaultModelFont();
@@ -457,8 +467,10 @@ void DivePlannerPointsModel::setRebreatherMode(int mode)
{
int i;
displayed_dive.dc.divemode = (dive_comp_type) mode;
- for (i=0; i < rowCount(); i++)
+ for (i=0; i < rowCount(); i++) {
divepoints[i].setpoint = mode == CCR ? prefs.defaultsetpoint : 0;
+ divepoints[i].divemode = (enum dive_comp_type) mode;
+ }
emitDataChanged();
}
@@ -661,6 +673,7 @@ int DivePlannerPointsModel::addStop(int milimeters, int seconds, int cylinderid_
{
int cylinderid = 0;
bool usePrevious = false;
+ enum dive_comp_type divemode = displayed_dive.dc.divemode;
if (cylinderid_in >= 0)
cylinderid = cylinderid_in;
else
@@ -703,8 +716,10 @@ int DivePlannerPointsModel::addStop(int milimeters, int seconds, int cylinderid_
if (usePrevious) {
if (row < divepoints.count()) {
cylinderid = divepoints.at(row).cylinderid;
+ divemode = divepoints.at(row).divemode;
} else if (row > 0) {
cylinderid = divepoints.at(row - 1).cylinderid;
+ divemode = divepoints.at(row - 1).divemode;
}
}
@@ -716,6 +731,7 @@ int DivePlannerPointsModel::addStop(int milimeters, int seconds, int cylinderid_
point.cylinderid = cylinderid;
point.setpoint = ccpoint;
point.entered = entered;
+ point.divemode = divemode;
point.next = NULL;
divepoints.append(point);
std::sort(divepoints.begin(), divepoints.end(), divePointsLessThan);
@@ -864,11 +880,11 @@ void DivePlannerPointsModel::createTemporaryPlan()
lastIndex = i;
if (i == 0 && mode == PLAN && prefs.drop_stone_mode) {
/* Okay, we add a first segment where we go down to depth */
- plan_add_segment(&diveplan, p.depth.mm / prefs.descrate, p.depth.mm, p.cylinderid, p.setpoint, true);
+ plan_add_segment(&diveplan, p.depth.mm / prefs.descrate, p.depth.mm, p.cylinderid, p.setpoint, true, p.divemode);
deltaT -= p.depth.mm / prefs.descrate;
}
if (p.entered)
- plan_add_segment(&diveplan, deltaT, p.depth.mm, p.cylinderid, p.setpoint, true);
+ plan_add_segment(&diveplan, deltaT, p.depth.mm, p.cylinderid, p.setpoint, true, p.divemode);
}
// what does the cache do???
diff --git a/qt-models/diveplannermodel.h b/qt-models/diveplannermodel.h
index dfafe2b27..371afb30c 100644
--- a/qt-models/diveplannermodel.h
+++ b/qt-models/diveplannermodel.h
@@ -18,6 +18,7 @@ public:
RUNTIME,
GAS,
CCSETPOINT,
+ DIVEMODE,
COLUMNS
};
enum Mode {
diff --git a/tests/testplan.cpp b/tests/testplan.cpp
index 5ef7b7187..1c4d0fab2 100644
--- a/tests/testplan.cpp
+++ b/tests/testplan.cpp
@@ -58,10 +58,10 @@ void setupPlan(struct diveplan *dp)
free_dps(dp);
int droptime = M_OR_FT(79, 260) * 60 / M_OR_FT(23, 75);
- plan_add_segment(dp, 0, gas_mod(&ean36, po2, &displayed_dive, M_OR_FT(3,10)).mm, 1, 0, 1);
- plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3,10)).mm, 2, 0, 1);
- plan_add_segment(dp, droptime, M_OR_FT(79, 260), 0, 0, 1);
- plan_add_segment(dp, 30*60 - droptime, M_OR_FT(79, 260), 0, 0, 1);
+ plan_add_segment(dp, 0, gas_mod(&ean36, po2, &displayed_dive, M_OR_FT(3,10)).mm, 1, 0, 1, OC);
+ plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3,10)).mm, 2, 0, 1, OC);
+ plan_add_segment(dp, droptime, M_OR_FT(79, 260), 0, 0, 1, OC);
+ plan_add_segment(dp, 30*60 - droptime, M_OR_FT(79, 260), 0, 0, 1, OC);
}
void setupPlanVpmb45m30mTx(struct diveplan *dp)
@@ -86,10 +86,10 @@ void setupPlanVpmb45m30mTx(struct diveplan *dp)
free_dps(dp);
int droptime = M_OR_FT(45, 150) * 60 / M_OR_FT(23, 75);
- plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3,10)).mm, 1, 0, 1);
- plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3,10)).mm, 2, 0, 1);
- plan_add_segment(dp, droptime, M_OR_FT(45, 150), 0, 0, 1);
- plan_add_segment(dp, 30*60 - droptime, M_OR_FT(45, 150), 0, 0, 1);
+ plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3,10)).mm, 1, 0, 1, OC);
+ plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3,10)).mm, 2, 0, 1, OC);
+ plan_add_segment(dp, droptime, M_OR_FT(45, 150), 0, 0, 1, OC);
+ plan_add_segment(dp, 30*60 - droptime, M_OR_FT(45, 150), 0, 0, 1, OC);
}
void setupPlanVpmb60m10mTx(struct diveplan *dp)
@@ -114,10 +114,10 @@ void setupPlanVpmb60m10mTx(struct diveplan *dp)
free_dps(dp);
int droptime = M_OR_FT(60, 200) * 60 / M_OR_FT(23, 75);
- plan_add_segment(dp, 0, gas_mod(&tx50_15, po2, &displayed_dive, M_OR_FT(3,10)).mm, 1, 0, 1);
- plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3,10)).mm, 2, 0, 1);
- plan_add_segment(dp, droptime, M_OR_FT(60, 200), 0, 0, 1);
- plan_add_segment(dp, 10*60 - droptime, M_OR_FT(60, 200), 0, 0, 1);
+ plan_add_segment(dp, 0, gas_mod(&tx50_15, po2, &displayed_dive, M_OR_FT(3,10)).mm, 1, 0, 1, OC);
+ plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3,10)).mm, 2, 0, 1, OC);
+ plan_add_segment(dp, droptime, M_OR_FT(60, 200), 0, 0, 1, OC);
+ plan_add_segment(dp, 10*60 - droptime, M_OR_FT(60, 200), 0, 0, 1, OC);
}
void setupPlanVpmb60m30minAir(struct diveplan *dp)
@@ -136,8 +136,8 @@ void setupPlanVpmb60m30minAir(struct diveplan *dp)
free_dps(dp);
int droptime = M_OR_FT(60, 200) * 60 / M_OR_FT(99, 330);
- plan_add_segment(dp, droptime, M_OR_FT(60, 200), 0, 0, 1);
- plan_add_segment(dp, 30*60 - droptime, M_OR_FT(60, 200), 0, 0, 1);
+ plan_add_segment(dp, droptime, M_OR_FT(60, 200), 0, 0, 1, OC);
+ plan_add_segment(dp, 30*60 - droptime, M_OR_FT(60, 200), 0, 0, 1, OC);
}
void setupPlanVpmb60m30minEan50(struct diveplan *dp)
@@ -159,9 +159,9 @@ void setupPlanVpmb60m30minEan50(struct diveplan *dp)
free_dps(dp);
int droptime = M_OR_FT(60, 200) * 60 / M_OR_FT(99, 330);
- plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3,10)).mm, 1, 0, 1);
- plan_add_segment(dp, droptime, M_OR_FT(60, 200), 0, 0, 1);
- plan_add_segment(dp, 30*60 - droptime, M_OR_FT(60, 200), 0, 0, 1);
+ plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3,10)).mm, 1, 0, 1, OC);
+ plan_add_segment(dp, droptime, M_OR_FT(60, 200), 0, 0, 1, OC);
+ plan_add_segment(dp, 30*60 - droptime, M_OR_FT(60, 200), 0, 0, 1, OC);
}
void setupPlanVpmb60m30minTx(struct diveplan *dp)
@@ -183,9 +183,9 @@ void setupPlanVpmb60m30minTx(struct diveplan *dp)
free_dps(dp);
int droptime = M_OR_FT(60, 200) * 60 / M_OR_FT(99, 330);
- plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3,10)).mm, 1, 0, 1);
- plan_add_segment(dp, droptime, M_OR_FT(60, 200), 0, 0, 1);
- plan_add_segment(dp, 30*60 - droptime, M_OR_FT(60, 200), 0, 0, 1);
+ plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3,10)).mm, 1, 0, 1, OC);
+ plan_add_segment(dp, droptime, M_OR_FT(60, 200), 0, 0, 1, OC);
+ plan_add_segment(dp, 30*60 - droptime, M_OR_FT(60, 200), 0, 0, 1, OC);
}
void setupPlanVpmbMultiLevelAir(struct diveplan *dp)
@@ -204,10 +204,10 @@ void setupPlanVpmbMultiLevelAir(struct diveplan *dp)
free_dps(dp);
int droptime = M_OR_FT(20, 66) * 60 / M_OR_FT(99, 330);
- plan_add_segment(dp, droptime, M_OR_FT(20, 66), 0, 0, 1);
- plan_add_segment(dp, 10*60 - droptime, M_OR_FT(20, 66), 0, 0, 1);
- plan_add_segment(dp, 1*60, M_OR_FT(60, 200), 0, 0, 1);
- plan_add_segment(dp, 29*60, M_OR_FT(60, 200), 0, 0, 1);
+ plan_add_segment(dp, droptime, M_OR_FT(20, 66), 0, 0, 1, OC);
+ plan_add_segment(dp, 10*60 - droptime, M_OR_FT(20, 66), 0, 0, 1, OC);
+ plan_add_segment(dp, 1*60, M_OR_FT(60, 200), 0, 0, 1, OC);
+ plan_add_segment(dp, 29*60, M_OR_FT(60, 200), 0, 0, 1, OC);
}
void setupPlanVpmb100m60min(struct diveplan *dp)
@@ -231,10 +231,10 @@ void setupPlanVpmb100m60min(struct diveplan *dp)
free_dps(dp);
int droptime = M_OR_FT(100, 330) * 60 / M_OR_FT(99, 330);
- plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3,10)).mm, 1, 0, 1);
- plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3,10)).mm, 2, 0, 1);
- plan_add_segment(dp, droptime, M_OR_FT(100, 330), 0, 0, 1);
- plan_add_segment(dp, 60*60 - droptime, M_OR_FT(100, 330), 0, 0, 1);
+ plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3,10)).mm, 1, 0, 1, OC);
+ plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3,10)).mm, 2, 0, 1, OC);
+ plan_add_segment(dp, droptime, M_OR_FT(100, 330), 0, 0, 1, OC);
+ plan_add_segment(dp, 60*60 - droptime, M_OR_FT(100, 330), 0, 0, 1, OC);
}
void setupPlanVpmb100m10min(struct diveplan *dp)
@@ -258,10 +258,10 @@ void setupPlanVpmb100m10min(struct diveplan *dp)
free_dps(dp);
int droptime = M_OR_FT(100, 330) * 60 / M_OR_FT(99, 330);
- plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3,10)).mm, 1, 0, 1);
- plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3,10)).mm, 2, 0, 1);
- plan_add_segment(dp, droptime, M_OR_FT(100, 330), 0, 0, 1);
- plan_add_segment(dp, 10*60 - droptime, M_OR_FT(100, 330), 0, 0, 1);
+ plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3,10)).mm, 1, 0, 1, OC);
+ plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3,10)).mm, 2, 0, 1, OC);
+ plan_add_segment(dp, droptime, M_OR_FT(100, 330), 0, 0, 1, OC);
+ plan_add_segment(dp, 10*60 - droptime, M_OR_FT(100, 330), 0, 0, 1, OC);
}
void setupPlanVpmb30m20min(struct diveplan *dp)
@@ -280,8 +280,8 @@ void setupPlanVpmb30m20min(struct diveplan *dp)
free_dps(dp);
int droptime = M_OR_FT(30, 100) * 60 / M_OR_FT(18, 60);
- plan_add_segment(dp, droptime, M_OR_FT(30, 100), 0, 0, 1);
- plan_add_segment(dp, 20*60 - droptime, M_OR_FT(30, 100), 0, 0, 1);
+ plan_add_segment(dp, droptime, M_OR_FT(30, 100), 0, 0, 1, OC);
+ plan_add_segment(dp, 20*60 - droptime, M_OR_FT(30, 100), 0, 0, 1, OC);
}
void setupPlanVpmb100mTo70m30min(struct diveplan *dp)
@@ -307,13 +307,13 @@ void setupPlanVpmb100mTo70m30min(struct diveplan *dp)
free_dps(dp);
int droptime = M_OR_FT(100, 330) * 60 / M_OR_FT(18, 60);
- plan_add_segment(dp, 0, gas_mod(&tx21_35, po2, &displayed_dive, M_OR_FT(3,10)).mm, 1, 0, 1);
- plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3,10)).mm, 2, 0, 1);
- plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3,10)).mm, 3, 0, 1);
- plan_add_segment(dp, droptime, M_OR_FT(100, 330), 0, 0, 1);
- plan_add_segment(dp, 20*60 - droptime, M_OR_FT(100, 330), 0, 0, 1);
- plan_add_segment(dp, 3*60, M_OR_FT(70, 230), 0, 0, 1);
- plan_add_segment(dp, (30 - 20 - 3) * 60, M_OR_FT(70, 230), 0, 0, 1);
+ plan_add_segment(dp, 0, gas_mod(&tx21_35, po2, &displayed_dive, M_OR_FT(3,10)).mm, 1, 0, 1, OC);
+ plan_add_segment(dp, 0, gas_mod(&ean50, po2, &displayed_dive, M_OR_FT(3,10)).mm, 2, 0, 1, OC);
+ plan_add_segment(dp, 0, gas_mod(&oxygen, po2, &displayed_dive, M_OR_FT(3,10)).mm, 3, 0, 1, OC);
+ plan_add_segment(dp, droptime, M_OR_FT(100, 330), 0, 0, 1, OC);
+ plan_add_segment(dp, 20*60 - droptime, M_OR_FT(100, 330), 0, 0, 1, OC);
+ plan_add_segment(dp, 3*60, M_OR_FT(70, 230), 0, 0, 1, OC);
+ plan_add_segment(dp, (30 - 20 - 3) * 60, M_OR_FT(70, 230), 0, 0, 1, OC);
}
/* We compare the calculated runtimes against two values: