mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Planner: Add backgas breaks
If the corresponding checkbox is checked the planner does interrupt pure O2 deco after 12min for 6min on cylinder 0. To make this work for air I removed the gasmix_is_null logic. I guess that makes the planner feature complete for the next release. [Dirk Hohndel: trivial merge into latest master] Signed-off-by: Robert C. Helling <helling@atdotde.de> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
611bae3441
commit
5db706d291
5 changed files with 39 additions and 1 deletions
28
planner.c
28
planner.c
|
@ -721,6 +721,9 @@ void plan(struct diveplan *diveplan, char **cached_datap, bool add_deco, bool sh
|
||||||
int last_ascend_rate;
|
int last_ascend_rate;
|
||||||
int best_first_ascend_cylinder;
|
int best_first_ascend_cylinder;
|
||||||
struct gasmix gas;
|
struct gasmix gas;
|
||||||
|
int o2time = 0;
|
||||||
|
int breaktime = -1;
|
||||||
|
int breakcylinder;
|
||||||
|
|
||||||
set_gf(diveplan->gflow, diveplan->gfhigh, prefs.gf_low_at_maxdepth);
|
set_gf(diveplan->gflow, diveplan->gfhigh, prefs.gf_low_at_maxdepth);
|
||||||
if (!diveplan->surface_pressure)
|
if (!diveplan->surface_pressure)
|
||||||
|
@ -862,6 +865,31 @@ void plan(struct diveplan *diveplan, char **cached_datap, bool add_deco, bool sh
|
||||||
DECOTIMESTEP, po2, &displayed_dive);
|
DECOTIMESTEP, po2, &displayed_dive);
|
||||||
cache_deco_state(tissue_tolerance, &trial_cache);
|
cache_deco_state(tissue_tolerance, &trial_cache);
|
||||||
clock += DECOTIMESTEP;
|
clock += DECOTIMESTEP;
|
||||||
|
if (prefs.doo2breaks) {
|
||||||
|
if (get_o2(&displayed_dive.cylinder[current_cylinder].gasmix) == 1000) {
|
||||||
|
o2time += DECOTIMESTEP;
|
||||||
|
if (o2time >= 12 * 60) {
|
||||||
|
breaktime = 0;
|
||||||
|
breakcylinder = current_cylinder;
|
||||||
|
plan_add_segment(diveplan, clock - previous_point_time, depth, gas, po2, false);
|
||||||
|
previous_point_time = clock;
|
||||||
|
current_cylinder = 0;
|
||||||
|
gas = displayed_dive.cylinder[current_cylinder].gasmix;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (breaktime >= 0) {
|
||||||
|
breaktime += DECOTIMESTEP;
|
||||||
|
if (breaktime >= 6 * 60) {
|
||||||
|
o2time = 0;
|
||||||
|
plan_add_segment(diveplan, clock - previous_point_time, depth, gas, po2, false);
|
||||||
|
previous_point_time = clock;
|
||||||
|
current_cylinder = breakcylinder;
|
||||||
|
gas = displayed_dive.cylinder[current_cylinder].gasmix;
|
||||||
|
breaktime = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
trial_depth = depth;
|
trial_depth = depth;
|
||||||
}
|
}
|
||||||
if (stopping) {
|
if (stopping) {
|
||||||
|
|
1
pref.h
1
pref.h
|
@ -61,6 +61,7 @@ struct preferences {
|
||||||
short proxy_auth;
|
short proxy_auth;
|
||||||
char *proxy_user;
|
char *proxy_user;
|
||||||
char *proxy_pass;
|
char *proxy_pass;
|
||||||
|
bool doo2breaks;
|
||||||
};
|
};
|
||||||
enum unit_system_values {
|
enum unit_system_values {
|
||||||
METRIC,
|
METRIC,
|
||||||
|
|
|
@ -378,6 +378,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
|
||||||
ui.descRate->setValue(prefs.descrate / UNIT_FACTOR);
|
ui.descRate->setValue(prefs.descrate / UNIT_FACTOR);
|
||||||
ui.bottompo2->setValue(prefs.bottompo2 / 1000.0);
|
ui.bottompo2->setValue(prefs.bottompo2 / 1000.0);
|
||||||
ui.decopo2->setValue(prefs.decopo2 / 1000.0);
|
ui.decopo2->setValue(prefs.decopo2 / 1000.0);
|
||||||
|
ui.backgasBreaks->setChecked(prefs.doo2breaks);
|
||||||
|
|
||||||
|
|
||||||
connect(ui.lastStop, SIGNAL(toggled(bool)), plannerModel, SLOT(setLastStop6m(bool)));
|
connect(ui.lastStop, SIGNAL(toggled(bool)), plannerModel, SLOT(setLastStop6m(bool)));
|
||||||
|
@ -402,6 +403,7 @@ PlannerSettingsWidget::PlannerSettingsWidget(QWidget *parent, Qt::WindowFlags f)
|
||||||
connect(ui.decoStopSAC, SIGNAL(valueChanged(int)), this, SLOT(decoSacChanged(int)));
|
connect(ui.decoStopSAC, SIGNAL(valueChanged(int)), this, SLOT(decoSacChanged(int)));
|
||||||
connect(ui.gfhigh, SIGNAL(valueChanged(int)), plannerModel, SLOT(setGFHigh(int)));
|
connect(ui.gfhigh, SIGNAL(valueChanged(int)), plannerModel, SLOT(setGFHigh(int)));
|
||||||
connect(ui.gflow, SIGNAL(valueChanged(int)), plannerModel, SLOT(setGFLow(int)));
|
connect(ui.gflow, SIGNAL(valueChanged(int)), plannerModel, SLOT(setGFLow(int)));
|
||||||
|
connect(ui.backgasBreaks, SIGNAL(toggled(bool)), this, SLOT(setBackgasBreaks(bool)));
|
||||||
|
|
||||||
ui.bottomSAC->setValue(20);
|
ui.bottomSAC->setValue(20);
|
||||||
ui.decoStopSAC->setValue(17);
|
ui.decoStopSAC->setValue(17);
|
||||||
|
@ -475,6 +477,11 @@ void PlannerSettingsWidget::setDecoPo2(double po2)
|
||||||
prefs.decopo2 = (int) (po2 * 1000.0);
|
prefs.decopo2 = (int) (po2 * 1000.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PlannerSettingsWidget::setBackgasBreaks(bool dobreaks)
|
||||||
|
{
|
||||||
|
prefs.doo2breaks = dobreaks;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void DivePlannerPointsModel::setPlanMode(Mode m)
|
void DivePlannerPointsModel::setPlanMode(Mode m)
|
||||||
{
|
{
|
||||||
|
|
|
@ -168,6 +168,7 @@ slots:
|
||||||
void setDescRate(int rate);
|
void setDescRate(int rate);
|
||||||
void setBottomPo2(double po2);
|
void setBottomPo2(double po2);
|
||||||
void setDecoPo2(double po2);
|
void setDecoPo2(double po2);
|
||||||
|
void setBackgasBreaks(bool dobreaks);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::plannerSettingsWidget ui;
|
Ui::plannerSettingsWidget ui;
|
||||||
|
|
|
@ -39,7 +39,8 @@ struct preferences default_prefs = {
|
||||||
.ascratelast6m = 1000 / 60,
|
.ascratelast6m = 1000 / 60,
|
||||||
.descrate = 18000 / 60,
|
.descrate = 18000 / 60,
|
||||||
.bottompo2 = 1400,
|
.bottompo2 = 1400,
|
||||||
.decopo2 = 1600
|
.decopo2 = 1600,
|
||||||
|
.doo2breaks = false
|
||||||
};
|
};
|
||||||
|
|
||||||
int run_survey;
|
int run_survey;
|
||||||
|
|
Loading…
Add table
Reference in a new issue