mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
planner: get rid of global displayed_dive variable
Allocate the dive in the planner. This is all a bit convoluted and needs more cleanup. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
b5682369f8
commit
4c02d1c279
9 changed files with 251 additions and 233 deletions
10
core/dive.c
10
core/dive.c
|
@ -26,11 +26,6 @@
|
||||||
#include "structured_list.h"
|
#include "structured_list.h"
|
||||||
#include "fulltext.h"
|
#include "fulltext.h"
|
||||||
|
|
||||||
/* one could argue about the best place to have this variable -
|
|
||||||
* it's used in the UI, but it seems to make the most sense to have it
|
|
||||||
* here */
|
|
||||||
struct dive displayed_dive;
|
|
||||||
|
|
||||||
// For user visible text but still not translated
|
// For user visible text but still not translated
|
||||||
const char *divemode_text_ui[] = {
|
const char *divemode_text_ui[] = {
|
||||||
QT_TRANSLATE_NOOP("gettextFromC", "Open circuit"),
|
QT_TRANSLATE_NOOP("gettextFromC", "Open circuit"),
|
||||||
|
@ -299,9 +294,8 @@ static void copy_dive_onedc(const struct dive *s, const struct divecomputer *sdc
|
||||||
}
|
}
|
||||||
|
|
||||||
/* make a clone of the source dive and clean out the source dive;
|
/* make a clone of the source dive and clean out the source dive;
|
||||||
* this is specifically so we can create a dive in the displayed_dive and then
|
* this allows us to create a dive on the stack and then
|
||||||
* add it to the divelist.
|
* add it to the divelist. */
|
||||||
* Note the difference to copy_dive() / clean_dive() */
|
|
||||||
struct dive *move_dive(struct dive *s)
|
struct dive *move_dive(struct dive *s)
|
||||||
{
|
{
|
||||||
struct dive *dive = alloc_dive();
|
struct dive *dive = alloc_dive();
|
||||||
|
|
|
@ -110,8 +110,6 @@ extern int mbar_to_depth(int mbar, const struct dive *dive);
|
||||||
extern depth_t gas_mod(struct gasmix mix, pressure_t po2_limit, const struct dive *dive, int roundto);
|
extern depth_t gas_mod(struct gasmix mix, pressure_t po2_limit, const struct dive *dive, int roundto);
|
||||||
extern depth_t gas_mnd(struct gasmix mix, depth_t end, const struct dive *dive, int roundto);
|
extern depth_t gas_mnd(struct gasmix mix, depth_t end, const struct dive *dive, int roundto);
|
||||||
|
|
||||||
extern struct dive displayed_dive;
|
|
||||||
|
|
||||||
extern struct dive *get_dive(int nr);
|
extern struct dive *get_dive(int nr);
|
||||||
extern struct dive *get_dive_from_table(int nr, const struct dive_table *dt);
|
extern struct dive *get_dive_from_table(int nr, const struct dive_table *dt);
|
||||||
extern struct dive_site *get_dive_site_for_dive(const struct dive *dive);
|
extern struct dive_site *get_dive_site_for_dive(const struct dive *dive);
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
#include <QBuffer>
|
#include <QBuffer>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
DivePlannerWidget::DivePlannerWidget(PlannerWidgets *parent)
|
DivePlannerWidget::DivePlannerWidget(dive &planned_dive, PlannerWidgets *parent)
|
||||||
{
|
{
|
||||||
DivePlannerPointsModel *plannerModel = DivePlannerPointsModel::instance();
|
DivePlannerPointsModel *plannerModel = DivePlannerPointsModel::instance();
|
||||||
CylindersModel *cylinders = DivePlannerPointsModel::instance()->cylindersModel();
|
CylindersModel *cylinders = DivePlannerPointsModel::instance()->cylindersModel();
|
||||||
|
@ -52,13 +52,13 @@ DivePlannerWidget::DivePlannerWidget(PlannerWidgets *parent)
|
||||||
view->setColumnHidden(CylindersModel::SENSORS, true);
|
view->setColumnHidden(CylindersModel::SENSORS, true);
|
||||||
view->setItemDelegateForColumn(CylindersModel::TYPE, new TankInfoDelegate(this));
|
view->setItemDelegateForColumn(CylindersModel::TYPE, new TankInfoDelegate(this));
|
||||||
auto tankUseDelegate = new TankUseDelegate(this);
|
auto tankUseDelegate = new TankUseDelegate(this);
|
||||||
tankUseDelegate->setCurrentDC(get_dive_dc(&displayed_dive, 0));
|
tankUseDelegate->setCurrentDC(get_dive_dc(&planned_dive, 0));
|
||||||
view->setItemDelegateForColumn(CylindersModel::USE, tankUseDelegate);
|
view->setItemDelegateForColumn(CylindersModel::USE, tankUseDelegate);
|
||||||
connect(ui.cylinderTableWidget, &TableView::addButtonClicked, plannerModel, &DivePlannerPointsModel::addCylinder_clicked);
|
connect(ui.cylinderTableWidget, &TableView::addButtonClicked, plannerModel, &DivePlannerPointsModel::addCylinder_clicked);
|
||||||
connect(ui.tableWidget, &TableView::addButtonClicked, plannerModel, &DivePlannerPointsModel::addDefaultStop);
|
connect(ui.tableWidget, &TableView::addButtonClicked, plannerModel, &DivePlannerPointsModel::addDefaultStop);
|
||||||
connect(cylinders, &CylindersModel::dataChanged, parent->gasModel.get(), &GasSelectionModel::repopulate);
|
connect(cylinders, &CylindersModel::dataChanged, parent, &PlannerWidgets::repopulateGasModel);
|
||||||
connect(cylinders, &CylindersModel::rowsInserted, parent->gasModel.get(), &GasSelectionModel::repopulate);
|
connect(cylinders, &CylindersModel::rowsInserted, parent, &PlannerWidgets::repopulateGasModel);
|
||||||
connect(cylinders, &CylindersModel::rowsRemoved, parent->gasModel.get(), &GasSelectionModel::repopulate);
|
connect(cylinders, &CylindersModel::rowsRemoved, parent, &PlannerWidgets::repopulateGasModel);
|
||||||
connect(cylinders, &CylindersModel::dataChanged, plannerModel, &DivePlannerPointsModel::emitDataChanged);
|
connect(cylinders, &CylindersModel::dataChanged, plannerModel, &DivePlannerPointsModel::emitDataChanged);
|
||||||
connect(cylinders, &CylindersModel::dataChanged, plannerModel, &DivePlannerPointsModel::cylinderModelEdited);
|
connect(cylinders, &CylindersModel::dataChanged, plannerModel, &DivePlannerPointsModel::cylinderModelEdited);
|
||||||
connect(cylinders, &CylindersModel::rowsInserted, plannerModel, &DivePlannerPointsModel::cylinderModelEdited);
|
connect(cylinders, &CylindersModel::rowsInserted, plannerModel, &DivePlannerPointsModel::cylinderModelEdited);
|
||||||
|
@ -541,7 +541,9 @@ void PlannerDetails::setPlanNotes(QString plan)
|
||||||
ui.divePlanOutput->setHtml(plan);
|
ui.divePlanOutput->setHtml(plan);
|
||||||
}
|
}
|
||||||
|
|
||||||
PlannerWidgets::PlannerWidgets() : plannerWidget(this)
|
PlannerWidgets::PlannerWidgets() :
|
||||||
|
planned_dive(alloc_dive()),
|
||||||
|
plannerWidget(*planned_dive, this)
|
||||||
{
|
{
|
||||||
gasModel = std::make_unique<GasSelectionModel>();
|
gasModel = std::make_unique<GasSelectionModel>();
|
||||||
diveTypeModel = std::make_unique<DiveTypeSelectionModel>();
|
diveTypeModel = std::make_unique<DiveTypeSelectionModel>();
|
||||||
|
@ -554,12 +556,15 @@ PlannerWidgets::~PlannerWidgets()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlannerWidgets::planDive(dive *currentDive)
|
struct dive *PlannerWidgets::getDive() const
|
||||||
{
|
{
|
||||||
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN);
|
return planned_dive.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlannerWidgets::preparePlanDive(const dive *currentDive)
|
||||||
|
{
|
||||||
// create a simple starting dive, using the first gas from the just copied cylinders
|
// create a simple starting dive, using the first gas from the just copied cylinders
|
||||||
DivePlannerPointsModel::instance()->createSimpleDive(&displayed_dive);
|
DivePlannerPointsModel::instance()->createSimpleDive(planned_dive.get());
|
||||||
|
|
||||||
// plan the dive in the same mode as the currently selected one
|
// plan the dive in the same mode as the currently selected one
|
||||||
if (currentDive) {
|
if (currentDive) {
|
||||||
|
@ -570,27 +575,42 @@ void PlannerWidgets::planDive(dive *currentDive)
|
||||||
else // No salinity means salt water
|
else // No salinity means salt water
|
||||||
plannerWidget.setSalinity(SEAWATER_SALINITY);
|
plannerWidget.setSalinity(SEAWATER_SALINITY);
|
||||||
}
|
}
|
||||||
gasModel->repopulate();
|
}
|
||||||
|
|
||||||
|
void PlannerWidgets::planDive()
|
||||||
|
{
|
||||||
|
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN);
|
||||||
|
|
||||||
|
repopulateGasModel();
|
||||||
diveTypeModel->repopulate(); // TODO: this doesn't change anything!?
|
diveTypeModel->repopulate(); // TODO: this doesn't change anything!?
|
||||||
plannerWidget.setReplanButton(false);
|
plannerWidget.setReplanButton(false);
|
||||||
|
plannerWidget.setupStartTime(timestampToDateTime(planned_dive->when)); // This will reload the profile!
|
||||||
|
}
|
||||||
|
|
||||||
plannerWidget.setupStartTime(timestampToDateTime(displayed_dive.when)); // This will reload the profile!
|
void PlannerWidgets::prepareReplanDive(const dive *d)
|
||||||
|
{
|
||||||
|
copy_dive(d, planned_dive.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlannerWidgets::replanDive(int currentDC)
|
void PlannerWidgets::replanDive(int currentDC)
|
||||||
{
|
{
|
||||||
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN);
|
DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN);
|
||||||
DivePlannerPointsModel::instance()->loadFromDive(&displayed_dive, currentDC);
|
DivePlannerPointsModel::instance()->loadFromDive(planned_dive.get(), currentDC);
|
||||||
|
|
||||||
diveTypeModel->repopulate(); // TODO: this doesn't change anything!?
|
diveTypeModel->repopulate(); // TODO: this doesn't change anything!?
|
||||||
plannerWidget.setReplanButton(true);
|
plannerWidget.setReplanButton(true);
|
||||||
plannerWidget.setupStartTime(timestampToDateTime(displayed_dive.when));
|
plannerWidget.setupStartTime(timestampToDateTime(planned_dive->when));
|
||||||
if (displayed_dive.surface_pressure.mbar)
|
if (planned_dive->surface_pressure.mbar)
|
||||||
plannerWidget.setSurfacePressure(displayed_dive.surface_pressure.mbar);
|
plannerWidget.setSurfacePressure(planned_dive->surface_pressure.mbar);
|
||||||
if (displayed_dive.salinity)
|
if (planned_dive->salinity)
|
||||||
plannerWidget.setSalinity(displayed_dive.salinity);
|
plannerWidget.setSalinity(planned_dive->salinity);
|
||||||
reset_cylinders(&displayed_dive, true);
|
reset_cylinders(planned_dive.get(), true);
|
||||||
DivePlannerPointsModel::instance()->cylindersModel()->updateDive(&displayed_dive, currentDC);
|
DivePlannerPointsModel::instance()->cylindersModel()->updateDive(planned_dive.get(), currentDC);
|
||||||
|
}
|
||||||
|
|
||||||
|
void PlannerWidgets::repopulateGasModel()
|
||||||
|
{
|
||||||
|
gasModel->repopulate(planned_dive.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlannerWidgets::printDecoPlan()
|
void PlannerWidgets::printDecoPlan()
|
||||||
|
@ -625,7 +645,7 @@ void PlannerWidgets::printDecoPlan()
|
||||||
painter.setRenderHint(QPainter::SmoothPixmapTransform);
|
painter.setRenderHint(QPainter::SmoothPixmapTransform);
|
||||||
|
|
||||||
auto profile = std::make_unique<ProfileScene>(1.0, true, false);
|
auto profile = std::make_unique<ProfileScene>(1.0, true, false);
|
||||||
profile->draw(&painter, QRect(0, 0, pixmap.width(), pixmap.height()), &displayed_dive, 0, DivePlannerPointsModel::instance(), true);
|
profile->draw(&painter, QRect(0, 0, pixmap.width(), pixmap.height()), planned_dive.get(), 0, DivePlannerPointsModel::instance(), true);
|
||||||
|
|
||||||
QByteArray byteArray;
|
QByteArray byteArray;
|
||||||
QBuffer buffer(&byteArray);
|
QBuffer buffer(&byteArray);
|
||||||
|
|
|
@ -2,13 +2,12 @@
|
||||||
#ifndef DIVEPLANNER_H
|
#ifndef DIVEPLANNER_H
|
||||||
#define DIVEPLANNER_H
|
#define DIVEPLANNER_H
|
||||||
|
|
||||||
#include <memory>
|
#include "core/owning_ptrs.h"
|
||||||
|
|
||||||
#include <QAbstractTableModel>
|
#include <QAbstractTableModel>
|
||||||
#include <QAbstractButton>
|
#include <QAbstractButton>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
|
||||||
class QListView;
|
|
||||||
class QModelIndex;
|
|
||||||
class DivePlannerPointsModel;
|
class DivePlannerPointsModel;
|
||||||
class GasSelectionModel;
|
class GasSelectionModel;
|
||||||
class DiveTypeSelectionModel;
|
class DiveTypeSelectionModel;
|
||||||
|
@ -20,7 +19,7 @@ struct dive;
|
||||||
class DivePlannerWidget : public QWidget {
|
class DivePlannerWidget : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit DivePlannerWidget(PlannerWidgets *parent);
|
explicit DivePlannerWidget(dive &planned_dive, PlannerWidgets *parent);
|
||||||
~DivePlannerWidget();
|
~DivePlannerWidget();
|
||||||
void setReplanButton(bool replan);
|
void setReplanButton(bool replan);
|
||||||
public
|
public
|
||||||
|
@ -82,12 +81,17 @@ class PlannerWidgets : public QObject {
|
||||||
public:
|
public:
|
||||||
PlannerWidgets();
|
PlannerWidgets();
|
||||||
~PlannerWidgets();
|
~PlannerWidgets();
|
||||||
void planDive(dive *currentDive);
|
void preparePlanDive(const dive *currentDive); // Create a new planned dive
|
||||||
|
void planDive();
|
||||||
|
void prepareReplanDive(const dive *d); // Make a copy of the dive to be replanned
|
||||||
void replanDive(int currentDC);
|
void replanDive(int currentDC);
|
||||||
|
struct dive *getDive() const;
|
||||||
public
|
public
|
||||||
slots:
|
slots:
|
||||||
void printDecoPlan();
|
void printDecoPlan();
|
||||||
public:
|
public:
|
||||||
|
void repopulateGasModel();
|
||||||
|
OwningDivePtr planned_dive;
|
||||||
DivePlannerWidget plannerWidget;
|
DivePlannerWidget plannerWidget;
|
||||||
PlannerSettingsWidget plannerSettingsWidget;
|
PlannerSettingsWidget plannerSettingsWidget;
|
||||||
PlannerDetails plannerDetails;
|
PlannerDetails plannerDetails;
|
||||||
|
|
|
@ -549,7 +549,7 @@ void MainWindow::on_actionPrint_triggered()
|
||||||
{
|
{
|
||||||
#ifndef NO_PRINTING
|
#ifndef NO_PRINTING
|
||||||
// When in planner, only print the planned dive.
|
// When in planner, only print the planned dive.
|
||||||
dive *singleDive = appState == ApplicationState::PlanDive ? &displayed_dive
|
dive *singleDive = appState == ApplicationState::PlanDive ? plannerWidgets->getDive()
|
||||||
: nullptr;
|
: nullptr;
|
||||||
PrintDialog dlg(singleDive, this);
|
PrintDialog dlg(singleDive, this);
|
||||||
|
|
||||||
|
@ -636,8 +636,6 @@ bool MainWindow::plannerStateClean()
|
||||||
|
|
||||||
void MainWindow::planCanceled()
|
void MainWindow::planCanceled()
|
||||||
{
|
{
|
||||||
// while planning we might have modified the displayed_dive
|
|
||||||
// let's refresh what's shown on the profile
|
|
||||||
showProfile();
|
showProfile();
|
||||||
refreshDisplay();
|
refreshDisplay();
|
||||||
}
|
}
|
||||||
|
@ -665,8 +663,8 @@ void MainWindow::on_actionReplanDive_triggered()
|
||||||
setApplicationState(ApplicationState::PlanDive);
|
setApplicationState(ApplicationState::PlanDive);
|
||||||
|
|
||||||
disableShortcuts(true);
|
disableShortcuts(true);
|
||||||
copy_dive(current_dive, &displayed_dive); // Planning works on a copy of the dive (for now).
|
plannerWidgets->prepareReplanDive(current_dive);
|
||||||
profile->setPlanState(&displayed_dive, profile->dc);
|
profile->setPlanState(plannerWidgets->getDive(), profile->dc);
|
||||||
plannerWidgets->replanDive(profile->dc);
|
plannerWidgets->replanDive(profile->dc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -679,8 +677,9 @@ void MainWindow::on_actionDivePlanner_triggered()
|
||||||
setApplicationState(ApplicationState::PlanDive);
|
setApplicationState(ApplicationState::PlanDive);
|
||||||
|
|
||||||
disableShortcuts(true);
|
disableShortcuts(true);
|
||||||
profile->setPlanState(&displayed_dive, 0);
|
plannerWidgets->preparePlanDive(current_dive);
|
||||||
plannerWidgets->planDive(current_dive);
|
profile->setPlanState(plannerWidgets->getDive(), 0);
|
||||||
|
plannerWidgets->planDive();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionAddDive_triggered()
|
void MainWindow::on_actionAddDive_triggered()
|
||||||
|
|
|
@ -544,7 +544,7 @@ void DivePlannerPointsModel::setRebreatherMode(int mode)
|
||||||
|
|
||||||
divemode_t DivePlannerPointsModel::getRebreatherMode() const
|
divemode_t DivePlannerPointsModel::getRebreatherMode() const
|
||||||
{
|
{
|
||||||
return d->dc.divemode;
|
return d ? d->dc.divemode : OC;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivePlannerPointsModel::setVpmbConservatism(int level)
|
void DivePlannerPointsModel::setVpmbConservatism(int level)
|
||||||
|
|
|
@ -18,9 +18,9 @@ Qt::ItemFlags GasSelectionModel::flags(const QModelIndex&) const
|
||||||
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GasSelectionModel::repopulate()
|
void GasSelectionModel::repopulate(const dive *d)
|
||||||
{
|
{
|
||||||
setStringList(get_dive_gas_list(&displayed_dive));
|
setStringList(get_dive_gas_list(d));
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant GasSelectionModel::data(const QModelIndex &index, int role) const
|
QVariant GasSelectionModel::data(const QModelIndex &index, int role) const
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
#include "cleanertablemodel.h"
|
#include "cleanertablemodel.h"
|
||||||
#include "treemodel.h"
|
#include "treemodel.h"
|
||||||
|
|
||||||
|
struct dive;
|
||||||
|
|
||||||
class GasSelectionModel : public QStringListModel {
|
class GasSelectionModel : public QStringListModel {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
@ -26,7 +28,7 @@ public:
|
||||||
QVariant data(const QModelIndex &index, int role) const override;
|
QVariant data(const QModelIndex &index, int role) const override;
|
||||||
public
|
public
|
||||||
slots:
|
slots:
|
||||||
void repopulate();
|
void repopulate(const dive *d);
|
||||||
};
|
};
|
||||||
|
|
||||||
class DiveTypeSelectionModel : public QStringListModel {
|
class DiveTypeSelectionModel : public QStringListModel {
|
||||||
|
|
|
@ -12,8 +12,9 @@
|
||||||
#define DEBUG 1
|
#define DEBUG 1
|
||||||
|
|
||||||
// testing the dive plan algorithm
|
// testing the dive plan algorithm
|
||||||
struct decostop stoptable[60];
|
static struct dive dive = { 0 };
|
||||||
struct deco_state test_deco_state;
|
static struct decostop stoptable[60];
|
||||||
|
static struct deco_state test_deco_state;
|
||||||
extern bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, int timestep, struct decostop *decostoptable, struct deco_state **cached_datap, bool is_planner, bool show_disclaimer);
|
extern bool plan(struct deco_state *ds, struct diveplan *diveplan, struct dive *dive, int timestep, struct decostop *decostoptable, struct deco_state **cached_datap, bool is_planner, bool show_disclaimer);
|
||||||
void setupPrefs()
|
void setupPrefs()
|
||||||
{
|
{
|
||||||
|
@ -51,20 +52,20 @@ void setupPlan(struct diveplan *dp)
|
||||||
struct gasmix ean36 = {{360}, {0}};
|
struct gasmix ean36 = {{360}, {0}};
|
||||||
struct gasmix oxygen = {{1000}, {0}};
|
struct gasmix oxygen = {{1000}, {0}};
|
||||||
pressure_t po2 = {1600};
|
pressure_t po2 = {1600};
|
||||||
cylinder_t *cyl0 = get_or_create_cylinder(&displayed_dive, 0);
|
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||||
cylinder_t *cyl1 = get_or_create_cylinder(&displayed_dive, 1);
|
cylinder_t *cyl1 = get_or_create_cylinder(&dive, 1);
|
||||||
cylinder_t *cyl2 = get_or_create_cylinder(&displayed_dive, 2);
|
cylinder_t *cyl2 = get_or_create_cylinder(&dive, 2);
|
||||||
cyl0->gasmix = bottomgas;
|
cyl0->gasmix = bottomgas;
|
||||||
cyl0->type.size.mliter = 36000;
|
cyl0->type.size.mliter = 36000;
|
||||||
cyl0->type.workingpressure.mbar = 232000;
|
cyl0->type.workingpressure.mbar = 232000;
|
||||||
cyl1->gasmix = ean36;
|
cyl1->gasmix = ean36;
|
||||||
cyl2->gasmix = oxygen;
|
cyl2->gasmix = oxygen;
|
||||||
reset_cylinders(&displayed_dive, true);
|
reset_cylinders(&dive, true);
|
||||||
free_dps(dp);
|
free_dps(dp);
|
||||||
|
|
||||||
int droptime = M_OR_FT(79, 260) * 60 / M_OR_FT(23, 75);
|
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, OC);
|
plan_add_segment(dp, 0, gas_mod(ean36, po2, &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, 0, gas_mod(oxygen, po2, &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, 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);
|
plan_add_segment(dp, 30 * 60 - droptime, M_OR_FT(79, 260), 0, 0, 1, OC);
|
||||||
}
|
}
|
||||||
|
@ -82,20 +83,20 @@ void setupPlanVpmb45m30mTx(struct diveplan *dp)
|
||||||
struct gasmix ean50 = {{500}, {0}};
|
struct gasmix ean50 = {{500}, {0}};
|
||||||
struct gasmix oxygen = {{1000}, {0}};
|
struct gasmix oxygen = {{1000}, {0}};
|
||||||
pressure_t po2 = {1600};
|
pressure_t po2 = {1600};
|
||||||
cylinder_t *cyl0 = get_or_create_cylinder(&displayed_dive, 0);
|
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||||
cylinder_t *cyl1 = get_or_create_cylinder(&displayed_dive, 1);
|
cylinder_t *cyl1 = get_or_create_cylinder(&dive, 1);
|
||||||
cylinder_t *cyl2 = get_or_create_cylinder(&displayed_dive, 2);
|
cylinder_t *cyl2 = get_or_create_cylinder(&dive, 2);
|
||||||
cyl0->gasmix = bottomgas;
|
cyl0->gasmix = bottomgas;
|
||||||
cyl0->type.size.mliter = 24000;
|
cyl0->type.size.mliter = 24000;
|
||||||
cyl0->type.workingpressure.mbar = 232000;
|
cyl0->type.workingpressure.mbar = 232000;
|
||||||
cyl1->gasmix = ean50;
|
cyl1->gasmix = ean50;
|
||||||
cyl2->gasmix = oxygen;
|
cyl2->gasmix = oxygen;
|
||||||
reset_cylinders(&displayed_dive, true);
|
reset_cylinders(&dive, true);
|
||||||
free_dps(dp);
|
free_dps(dp);
|
||||||
|
|
||||||
int droptime = M_OR_FT(45, 150) * 60 / M_OR_FT(23, 75);
|
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, OC);
|
plan_add_segment(dp, 0, gas_mod(ean50, po2, &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, 0, gas_mod(oxygen, po2, &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, 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);
|
plan_add_segment(dp, 30 * 60 - droptime, M_OR_FT(45, 150), 0, 0, 1, OC);
|
||||||
}
|
}
|
||||||
|
@ -113,20 +114,20 @@ void setupPlanVpmb60m10mTx(struct diveplan *dp)
|
||||||
struct gasmix tx50_15 = {{500}, {150}};
|
struct gasmix tx50_15 = {{500}, {150}};
|
||||||
struct gasmix oxygen = {{1000}, {0}};
|
struct gasmix oxygen = {{1000}, {0}};
|
||||||
pressure_t po2 = {1600};
|
pressure_t po2 = {1600};
|
||||||
cylinder_t *cyl0 = get_or_create_cylinder(&displayed_dive, 0);
|
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||||
cylinder_t *cyl1 = get_or_create_cylinder(&displayed_dive, 1);
|
cylinder_t *cyl1 = get_or_create_cylinder(&dive, 1);
|
||||||
cylinder_t *cyl2 = get_or_create_cylinder(&displayed_dive, 2);
|
cylinder_t *cyl2 = get_or_create_cylinder(&dive, 2);
|
||||||
cyl0->gasmix = bottomgas;
|
cyl0->gasmix = bottomgas;
|
||||||
cyl0->type.size.mliter = 24000;
|
cyl0->type.size.mliter = 24000;
|
||||||
cyl0->type.workingpressure.mbar = 232000;
|
cyl0->type.workingpressure.mbar = 232000;
|
||||||
cyl1->gasmix = tx50_15;
|
cyl1->gasmix = tx50_15;
|
||||||
cyl2->gasmix = oxygen;
|
cyl2->gasmix = oxygen;
|
||||||
reset_cylinders(&displayed_dive, true);
|
reset_cylinders(&dive, true);
|
||||||
free_dps(dp);
|
free_dps(dp);
|
||||||
|
|
||||||
int droptime = M_OR_FT(60, 200) * 60 / M_OR_FT(23, 75);
|
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, OC);
|
plan_add_segment(dp, 0, gas_mod(tx50_15, po2, &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, 0, gas_mod(oxygen, po2, &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, 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);
|
plan_add_segment(dp, 10 * 60 - droptime, M_OR_FT(60, 200), 0, 0, 1, OC);
|
||||||
}
|
}
|
||||||
|
@ -139,12 +140,12 @@ void setupPlanVpmb60m30minAir(struct diveplan *dp)
|
||||||
dp->decosac = prefs.decosac;
|
dp->decosac = prefs.decosac;
|
||||||
|
|
||||||
struct gasmix bottomgas = {{210}, {0}};
|
struct gasmix bottomgas = {{210}, {0}};
|
||||||
cylinder_t *cyl0 = get_or_create_cylinder(&displayed_dive, 0);
|
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||||
cyl0->gasmix = bottomgas;
|
cyl0->gasmix = bottomgas;
|
||||||
cyl0->type.size.mliter = 100000;
|
cyl0->type.size.mliter = 100000;
|
||||||
cyl0->type.workingpressure.mbar = 232000;
|
cyl0->type.workingpressure.mbar = 232000;
|
||||||
displayed_dive.surface_pressure.mbar = 1013;
|
dive.surface_pressure.mbar = 1013;
|
||||||
reset_cylinders(&displayed_dive, true);
|
reset_cylinders(&dive, true);
|
||||||
free_dps(dp);
|
free_dps(dp);
|
||||||
|
|
||||||
int droptime = M_OR_FT(60, 200) * 60 / M_OR_FT(99, 330);
|
int droptime = M_OR_FT(60, 200) * 60 / M_OR_FT(99, 330);
|
||||||
|
@ -162,18 +163,18 @@ void setupPlanVpmb60m30minEan50(struct diveplan *dp)
|
||||||
struct gasmix bottomgas = {{210}, {0}};
|
struct gasmix bottomgas = {{210}, {0}};
|
||||||
struct gasmix ean50 = {{500}, {0}};
|
struct gasmix ean50 = {{500}, {0}};
|
||||||
pressure_t po2 = {1600};
|
pressure_t po2 = {1600};
|
||||||
cylinder_t *cyl0 = get_or_create_cylinder(&displayed_dive, 0);
|
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||||
cylinder_t *cyl1 = get_or_create_cylinder(&displayed_dive, 1);
|
cylinder_t *cyl1 = get_or_create_cylinder(&dive, 1);
|
||||||
cyl0->gasmix = bottomgas;
|
cyl0->gasmix = bottomgas;
|
||||||
cyl0->type.size.mliter = 36000;
|
cyl0->type.size.mliter = 36000;
|
||||||
cyl0->type.workingpressure.mbar = 232000;
|
cyl0->type.workingpressure.mbar = 232000;
|
||||||
cyl1->gasmix = ean50;
|
cyl1->gasmix = ean50;
|
||||||
displayed_dive.surface_pressure.mbar = 1013;
|
dive.surface_pressure.mbar = 1013;
|
||||||
reset_cylinders(&displayed_dive, true);
|
reset_cylinders(&dive, true);
|
||||||
free_dps(dp);
|
free_dps(dp);
|
||||||
|
|
||||||
int droptime = M_OR_FT(60, 200) * 60 / M_OR_FT(99, 330);
|
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, OC);
|
plan_add_segment(dp, 0, gas_mod(ean50, po2, &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, 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);
|
plan_add_segment(dp, 30 * 60 - droptime, M_OR_FT(60, 200), 0, 0, 1, OC);
|
||||||
}
|
}
|
||||||
|
@ -188,18 +189,18 @@ void setupPlanVpmb60m30minTx(struct diveplan *dp)
|
||||||
struct gasmix bottomgas = {{180}, {450}};
|
struct gasmix bottomgas = {{180}, {450}};
|
||||||
struct gasmix ean50 = {{500}, {0}};
|
struct gasmix ean50 = {{500}, {0}};
|
||||||
pressure_t po2 = {1600};
|
pressure_t po2 = {1600};
|
||||||
cylinder_t *cyl0 = get_or_create_cylinder(&displayed_dive, 0);
|
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||||
cylinder_t *cyl1 = get_or_create_cylinder(&displayed_dive, 1);
|
cylinder_t *cyl1 = get_or_create_cylinder(&dive, 1);
|
||||||
cyl0->gasmix = bottomgas;
|
cyl0->gasmix = bottomgas;
|
||||||
cyl0->type.size.mliter = 36000;
|
cyl0->type.size.mliter = 36000;
|
||||||
cyl0->type.workingpressure.mbar = 232000;
|
cyl0->type.workingpressure.mbar = 232000;
|
||||||
cyl1->gasmix = ean50;
|
cyl1->gasmix = ean50;
|
||||||
displayed_dive.surface_pressure.mbar = 1013;
|
dive.surface_pressure.mbar = 1013;
|
||||||
reset_cylinders(&displayed_dive, true);
|
reset_cylinders(&dive, true);
|
||||||
free_dps(dp);
|
free_dps(dp);
|
||||||
|
|
||||||
int droptime = M_OR_FT(60, 200) * 60 / M_OR_FT(99, 330);
|
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, OC);
|
plan_add_segment(dp, 0, gas_mod(ean50, po2, &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, 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);
|
plan_add_segment(dp, 30 * 60 - droptime, M_OR_FT(60, 200), 0, 0, 1, OC);
|
||||||
}
|
}
|
||||||
|
@ -212,12 +213,12 @@ void setupPlanVpmbMultiLevelAir(struct diveplan *dp)
|
||||||
dp->decosac = prefs.decosac;
|
dp->decosac = prefs.decosac;
|
||||||
|
|
||||||
struct gasmix bottomgas = {{210}, {0}};
|
struct gasmix bottomgas = {{210}, {0}};
|
||||||
cylinder_t *cyl0 = get_or_create_cylinder(&displayed_dive, 0);
|
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||||
cyl0->gasmix = bottomgas;
|
cyl0->gasmix = bottomgas;
|
||||||
cyl0->type.size.mliter = 200000;
|
cyl0->type.size.mliter = 200000;
|
||||||
cyl0->type.workingpressure.mbar = 232000;
|
cyl0->type.workingpressure.mbar = 232000;
|
||||||
displayed_dive.surface_pressure.mbar = 1013;
|
dive.surface_pressure.mbar = 1013;
|
||||||
reset_cylinders(&displayed_dive, true);
|
reset_cylinders(&dive, true);
|
||||||
free_dps(dp);
|
free_dps(dp);
|
||||||
|
|
||||||
int droptime = M_OR_FT(20, 66) * 60 / M_OR_FT(99, 330);
|
int droptime = M_OR_FT(20, 66) * 60 / M_OR_FT(99, 330);
|
||||||
|
@ -238,21 +239,21 @@ void setupPlanVpmb100m60min(struct diveplan *dp)
|
||||||
struct gasmix ean50 = {{500}, {0}};
|
struct gasmix ean50 = {{500}, {0}};
|
||||||
struct gasmix oxygen = {{1000}, {0}};
|
struct gasmix oxygen = {{1000}, {0}};
|
||||||
pressure_t po2 = {1600};
|
pressure_t po2 = {1600};
|
||||||
cylinder_t *cyl0 = get_or_create_cylinder(&displayed_dive, 0);
|
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||||
cylinder_t *cyl1 = get_or_create_cylinder(&displayed_dive, 1);
|
cylinder_t *cyl1 = get_or_create_cylinder(&dive, 1);
|
||||||
cylinder_t *cyl2 = get_or_create_cylinder(&displayed_dive, 2);
|
cylinder_t *cyl2 = get_or_create_cylinder(&dive, 2);
|
||||||
cyl0->gasmix = bottomgas;
|
cyl0->gasmix = bottomgas;
|
||||||
cyl0->type.size.mliter = 200000;
|
cyl0->type.size.mliter = 200000;
|
||||||
cyl0->type.workingpressure.mbar = 232000;
|
cyl0->type.workingpressure.mbar = 232000;
|
||||||
cyl1->gasmix = ean50;
|
cyl1->gasmix = ean50;
|
||||||
cyl2->gasmix = oxygen;
|
cyl2->gasmix = oxygen;
|
||||||
displayed_dive.surface_pressure.mbar = 1013;
|
dive.surface_pressure.mbar = 1013;
|
||||||
reset_cylinders(&displayed_dive, true);
|
reset_cylinders(&dive, true);
|
||||||
free_dps(dp);
|
free_dps(dp);
|
||||||
|
|
||||||
int droptime = M_OR_FT(100, 330) * 60 / M_OR_FT(99, 330);
|
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, OC);
|
plan_add_segment(dp, 0, gas_mod(ean50, po2, &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, 0, gas_mod(oxygen, po2, &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, 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);
|
plan_add_segment(dp, 60 * 60 - droptime, M_OR_FT(100, 330), 0, 0, 1, OC);
|
||||||
}
|
}
|
||||||
|
@ -268,21 +269,21 @@ void setupPlanVpmb100m10min(struct diveplan *dp)
|
||||||
struct gasmix ean50 = {{500}, {0}};
|
struct gasmix ean50 = {{500}, {0}};
|
||||||
struct gasmix oxygen = {{1000}, {0}};
|
struct gasmix oxygen = {{1000}, {0}};
|
||||||
pressure_t po2 = {1600};
|
pressure_t po2 = {1600};
|
||||||
cylinder_t *cyl0 = get_or_create_cylinder(&displayed_dive, 0);
|
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||||
cylinder_t *cyl1 = get_or_create_cylinder(&displayed_dive, 1);
|
cylinder_t *cyl1 = get_or_create_cylinder(&dive, 1);
|
||||||
cylinder_t *cyl2 = get_or_create_cylinder(&displayed_dive, 2);
|
cylinder_t *cyl2 = get_or_create_cylinder(&dive, 2);
|
||||||
cyl0->gasmix = bottomgas;
|
cyl0->gasmix = bottomgas;
|
||||||
cyl0->type.size.mliter = 60000;
|
cyl0->type.size.mliter = 60000;
|
||||||
cyl0->type.workingpressure.mbar = 232000;
|
cyl0->type.workingpressure.mbar = 232000;
|
||||||
cyl1->gasmix = ean50;
|
cyl1->gasmix = ean50;
|
||||||
cyl2->gasmix = oxygen;
|
cyl2->gasmix = oxygen;
|
||||||
displayed_dive.surface_pressure.mbar = 1013;
|
dive.surface_pressure.mbar = 1013;
|
||||||
reset_cylinders(&displayed_dive, true);
|
reset_cylinders(&dive, true);
|
||||||
free_dps(dp);
|
free_dps(dp);
|
||||||
|
|
||||||
int droptime = M_OR_FT(100, 330) * 60 / M_OR_FT(99, 330);
|
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, OC);
|
plan_add_segment(dp, 0, gas_mod(ean50, po2, &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, 0, gas_mod(oxygen, po2, &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, 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);
|
plan_add_segment(dp, 10 * 60 - droptime, M_OR_FT(100, 330), 0, 0, 1, OC);
|
||||||
}
|
}
|
||||||
|
@ -295,12 +296,12 @@ void setupPlanVpmb30m20min(struct diveplan *dp)
|
||||||
dp->decosac = prefs.decosac;
|
dp->decosac = prefs.decosac;
|
||||||
|
|
||||||
struct gasmix bottomgas = {{210}, {0}};
|
struct gasmix bottomgas = {{210}, {0}};
|
||||||
cylinder_t *cyl0 = get_or_create_cylinder(&displayed_dive, 0);
|
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||||
cyl0->gasmix = bottomgas;
|
cyl0->gasmix = bottomgas;
|
||||||
cyl0->type.size.mliter = 36000;
|
cyl0->type.size.mliter = 36000;
|
||||||
cyl0->type.workingpressure.mbar = 232000;
|
cyl0->type.workingpressure.mbar = 232000;
|
||||||
displayed_dive.surface_pressure.mbar = 1013;
|
dive.surface_pressure.mbar = 1013;
|
||||||
reset_cylinders(&displayed_dive, true);
|
reset_cylinders(&dive, true);
|
||||||
free_dps(dp);
|
free_dps(dp);
|
||||||
|
|
||||||
int droptime = M_OR_FT(30, 100) * 60 / M_OR_FT(18, 60);
|
int droptime = M_OR_FT(30, 100) * 60 / M_OR_FT(18, 60);
|
||||||
|
@ -320,24 +321,24 @@ void setupPlanVpmb100mTo70m30min(struct diveplan *dp)
|
||||||
struct gasmix ean50 = {{500}, {0}};
|
struct gasmix ean50 = {{500}, {0}};
|
||||||
struct gasmix oxygen = {{1000}, {0}};
|
struct gasmix oxygen = {{1000}, {0}};
|
||||||
pressure_t po2 = {1600};
|
pressure_t po2 = {1600};
|
||||||
cylinder_t *cyl0 = get_or_create_cylinder(&displayed_dive, 0);
|
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||||
cylinder_t *cyl1 = get_or_create_cylinder(&displayed_dive, 1);
|
cylinder_t *cyl1 = get_or_create_cylinder(&dive, 1);
|
||||||
cylinder_t *cyl2 = get_or_create_cylinder(&displayed_dive, 2);
|
cylinder_t *cyl2 = get_or_create_cylinder(&dive, 2);
|
||||||
cylinder_t *cyl3 = get_or_create_cylinder(&displayed_dive, 3);
|
cylinder_t *cyl3 = get_or_create_cylinder(&dive, 3);
|
||||||
cyl0->gasmix = bottomgas;
|
cyl0->gasmix = bottomgas;
|
||||||
cyl0->type.size.mliter = 36000;
|
cyl0->type.size.mliter = 36000;
|
||||||
cyl0->type.workingpressure.mbar = 232000;
|
cyl0->type.workingpressure.mbar = 232000;
|
||||||
cyl1->gasmix = tx21_35;
|
cyl1->gasmix = tx21_35;
|
||||||
cyl2->gasmix = ean50;
|
cyl2->gasmix = ean50;
|
||||||
cyl3->gasmix = oxygen;
|
cyl3->gasmix = oxygen;
|
||||||
displayed_dive.surface_pressure.mbar = 1013;
|
dive.surface_pressure.mbar = 1013;
|
||||||
reset_cylinders(&displayed_dive, true);
|
reset_cylinders(&dive, true);
|
||||||
free_dps(dp);
|
free_dps(dp);
|
||||||
|
|
||||||
int droptime = M_OR_FT(100, 330) * 60 / M_OR_FT(18, 60);
|
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, OC);
|
plan_add_segment(dp, 0, gas_mod(tx21_35, po2, &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(ean50, po2, &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, 0, gas_mod(oxygen, po2, &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, 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, 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, 3 * 60, M_OR_FT(70, 230), 0, 0, 1, OC);
|
||||||
|
@ -356,14 +357,14 @@ void setupPlanSeveralGases(struct diveplan *dp)
|
||||||
struct gasmix ean36 = {{360}, {0}};
|
struct gasmix ean36 = {{360}, {0}};
|
||||||
struct gasmix tx11_50 = {{110}, {500}};
|
struct gasmix tx11_50 = {{110}, {500}};
|
||||||
|
|
||||||
cylinder_t *cyl0 = get_or_create_cylinder(&displayed_dive, 0);
|
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||||
cylinder_t *cyl1 = get_or_create_cylinder(&displayed_dive, 1);
|
cylinder_t *cyl1 = get_or_create_cylinder(&dive, 1);
|
||||||
cyl0->gasmix = ean36;
|
cyl0->gasmix = ean36;
|
||||||
cyl0->type.size.mliter = 36000;
|
cyl0->type.size.mliter = 36000;
|
||||||
cyl0->type.workingpressure.mbar = 232000;
|
cyl0->type.workingpressure.mbar = 232000;
|
||||||
cyl1->gasmix = tx11_50;
|
cyl1->gasmix = tx11_50;
|
||||||
displayed_dive.surface_pressure.mbar = 1013;
|
dive.surface_pressure.mbar = 1013;
|
||||||
reset_cylinders(&displayed_dive, true);
|
reset_cylinders(&dive, true);
|
||||||
free_dps(dp);
|
free_dps(dp);
|
||||||
|
|
||||||
plan_add_segment(dp, 120, 40000, 0, 0, true, OC);
|
plan_add_segment(dp, 120, 40000, 0, 0, true, OC);
|
||||||
|
@ -385,19 +386,19 @@ void setupPlanCcr(struct diveplan *dp)
|
||||||
struct gasmix diluent = {{200}, {210}};
|
struct gasmix diluent = {{200}, {210}};
|
||||||
struct gasmix ean53 = {{530}, {0}};
|
struct gasmix ean53 = {{530}, {0}};
|
||||||
struct gasmix tx19_33 = {{190}, {330}};
|
struct gasmix tx19_33 = {{190}, {330}};
|
||||||
cylinder_t *cyl0 = get_or_create_cylinder(&displayed_dive, 0);
|
cylinder_t *cyl0 = get_or_create_cylinder(&dive, 0);
|
||||||
cylinder_t *cyl1 = get_or_create_cylinder(&displayed_dive, 1);
|
cylinder_t *cyl1 = get_or_create_cylinder(&dive, 1);
|
||||||
cylinder_t *cyl2 = get_or_create_cylinder(&displayed_dive, 2);
|
cylinder_t *cyl2 = get_or_create_cylinder(&dive, 2);
|
||||||
cyl0->gasmix = diluent;
|
cyl0->gasmix = diluent;
|
||||||
cyl0->depth = gas_mod(diluent, po2, &displayed_dive, M_OR_FT(3, 10));
|
cyl0->depth = gas_mod(diluent, po2, &dive, M_OR_FT(3, 10));
|
||||||
cyl0->type.size.mliter = 3000;
|
cyl0->type.size.mliter = 3000;
|
||||||
cyl0->type.workingpressure.mbar = 200000;
|
cyl0->type.workingpressure.mbar = 200000;
|
||||||
cyl0->cylinder_use = DILUENT;
|
cyl0->cylinder_use = DILUENT;
|
||||||
cyl1->gasmix = ean53;
|
cyl1->gasmix = ean53;
|
||||||
cyl1->depth = gas_mod(ean53, po2, &displayed_dive, M_OR_FT(3, 10));
|
cyl1->depth = gas_mod(ean53, po2, &dive, M_OR_FT(3, 10));
|
||||||
cyl2->gasmix = tx19_33;
|
cyl2->gasmix = tx19_33;
|
||||||
cyl2->depth = gas_mod(tx19_33, po2, &displayed_dive, M_OR_FT(3, 10));
|
cyl2->depth = gas_mod(tx19_33, po2, &dive, M_OR_FT(3, 10));
|
||||||
reset_cylinders(&displayed_dive, true);
|
reset_cylinders(&dive, true);
|
||||||
free_dps(dp);
|
free_dps(dp);
|
||||||
|
|
||||||
plan_add_segment(dp, 0, cyl1->depth.mm, 1, 0, false, OC);
|
plan_add_segment(dp, 0, cyl1->depth.mm, 1, 0, false, OC);
|
||||||
|
@ -452,12 +453,12 @@ void TestPlan::testMetric()
|
||||||
struct diveplan testPlan = {};
|
struct diveplan testPlan = {};
|
||||||
setupPlan(&testPlan);
|
setupPlan(&testPlan);
|
||||||
|
|
||||||
plan(&test_deco_state, &testPlan, &displayed_dive, 60, stoptable, &cache, 1, 0);
|
plan(&test_deco_state, &testPlan, &dive, 60, stoptable, &cache, 1, 0);
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
free(displayed_dive.notes);
|
free(dive.notes);
|
||||||
displayed_dive.notes = NULL;
|
dive.notes = NULL;
|
||||||
save_dive(stdout, &displayed_dive, false);
|
save_dive(stdout, &dive, false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// check minimum gas result
|
// check minimum gas result
|
||||||
|
@ -466,19 +467,19 @@ void TestPlan::testMetric()
|
||||||
dp = dp->next;
|
dp = dp->next;
|
||||||
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 148l);
|
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 148l);
|
||||||
// check first gas change to EAN36 at 33m
|
// check first gas change to EAN36 at 33m
|
||||||
struct event *ev = displayed_dive.dc.events;
|
struct event *ev = dive.dc.events;
|
||||||
QVERIFY(ev != NULL);
|
QVERIFY(ev != NULL);
|
||||||
QCOMPARE(ev->gas.index, 1);
|
QCOMPARE(ev->gas.index, 1);
|
||||||
QCOMPARE(ev->value, 36);
|
QCOMPARE(ev->value, 36);
|
||||||
QCOMPARE(get_depth_at_time(&displayed_dive.dc, ev->time.seconds), 33000);
|
QCOMPARE(get_depth_at_time(&dive.dc, ev->time.seconds), 33000);
|
||||||
// check second gas change to Oxygen at 6m
|
// check second gas change to Oxygen at 6m
|
||||||
ev = ev->next;
|
ev = ev->next;
|
||||||
QVERIFY(ev != NULL);
|
QVERIFY(ev != NULL);
|
||||||
QCOMPARE(ev->gas.index, 2);
|
QCOMPARE(ev->gas.index, 2);
|
||||||
QCOMPARE(ev->value, 100);
|
QCOMPARE(ev->value, 100);
|
||||||
QCOMPARE(get_depth_at_time(&displayed_dive.dc, ev->time.seconds), 6000);
|
QCOMPARE(get_depth_at_time(&dive.dc, ev->time.seconds), 6000);
|
||||||
// check expected run time of 109 minutes
|
// check expected run time of 109 minutes
|
||||||
QVERIFY(compareDecoTime(displayed_dive.dc.duration.seconds, 109u * 60u, 109u * 60u));
|
QVERIFY(compareDecoTime(dive.dc.duration.seconds, 109u * 60u, 109u * 60u));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestPlan::testImperial()
|
void TestPlan::testImperial()
|
||||||
|
@ -493,12 +494,12 @@ void TestPlan::testImperial()
|
||||||
struct diveplan testPlan = {};
|
struct diveplan testPlan = {};
|
||||||
setupPlan(&testPlan);
|
setupPlan(&testPlan);
|
||||||
|
|
||||||
plan(&test_deco_state, &testPlan, &displayed_dive, 60, stoptable, &cache, 1, 0);
|
plan(&test_deco_state, &testPlan, &dive, 60, stoptable, &cache, 1, 0);
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
free(displayed_dive.notes);
|
free(dive.notes);
|
||||||
displayed_dive.notes = NULL;
|
dive.notes = NULL;
|
||||||
save_dive(stdout, &displayed_dive, false);
|
save_dive(stdout, &dive, false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// check minimum gas result
|
// check minimum gas result
|
||||||
|
@ -507,19 +508,19 @@ void TestPlan::testImperial()
|
||||||
dp = dp->next;
|
dp = dp->next;
|
||||||
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 155l);
|
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 155l);
|
||||||
// check first gas change to EAN36 at 33m
|
// check first gas change to EAN36 at 33m
|
||||||
struct event *ev = displayed_dive.dc.events;
|
struct event *ev = dive.dc.events;
|
||||||
QVERIFY(ev != NULL);
|
QVERIFY(ev != NULL);
|
||||||
QCOMPARE(ev->gas.index, 1);
|
QCOMPARE(ev->gas.index, 1);
|
||||||
QCOMPARE(ev->value, 36);
|
QCOMPARE(ev->value, 36);
|
||||||
QCOMPARE(get_depth_at_time(&displayed_dive.dc, ev->time.seconds), 33528);
|
QCOMPARE(get_depth_at_time(&dive.dc, ev->time.seconds), 33528);
|
||||||
// check second gas change to Oxygen at 6m
|
// check second gas change to Oxygen at 6m
|
||||||
ev = ev->next;
|
ev = ev->next;
|
||||||
QVERIFY(ev != NULL);
|
QVERIFY(ev != NULL);
|
||||||
QCOMPARE(ev->gas.index, 2);
|
QCOMPARE(ev->gas.index, 2);
|
||||||
QCOMPARE(ev->value, 100);
|
QCOMPARE(ev->value, 100);
|
||||||
QCOMPARE(get_depth_at_time(&displayed_dive.dc, ev->time.seconds), 6096);
|
QCOMPARE(get_depth_at_time(&dive.dc, ev->time.seconds), 6096);
|
||||||
// check expected run time of 111 minutes
|
// check expected run time of 111 minutes
|
||||||
QVERIFY(compareDecoTime(displayed_dive.dc.duration.seconds, 111u * 60u - 2u, 111u * 60u - 2u));
|
QVERIFY(compareDecoTime(dive.dc.duration.seconds, 111u * 60u - 2u, 111u * 60u - 2u));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestPlan::testVpmbMetric45m30minTx()
|
void TestPlan::testVpmbMetric45m30minTx()
|
||||||
|
@ -533,12 +534,12 @@ void TestPlan::testVpmbMetric45m30minTx()
|
||||||
struct diveplan testPlan = {};
|
struct diveplan testPlan = {};
|
||||||
setupPlanVpmb45m30mTx(&testPlan);
|
setupPlanVpmb45m30mTx(&testPlan);
|
||||||
|
|
||||||
plan(&test_deco_state, &testPlan, &displayed_dive, 60, stoptable, &cache, 1, 0);
|
plan(&test_deco_state, &testPlan, &dive, 60, stoptable, &cache, 1, 0);
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
free(displayed_dive.notes);
|
free(dive.notes);
|
||||||
displayed_dive.notes = NULL;
|
dive.notes = NULL;
|
||||||
save_dive(stdout, &displayed_dive, false);
|
save_dive(stdout, &dive, false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// check minimum gas result
|
// check minimum gas result
|
||||||
|
@ -547,9 +548,9 @@ void TestPlan::testVpmbMetric45m30minTx()
|
||||||
dp = dp->next;
|
dp = dp->next;
|
||||||
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 108l);
|
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 108l);
|
||||||
// print first ceiling
|
// print first ceiling
|
||||||
printf("First ceiling %.1f m\n", (mbar_to_depth(test_deco_state.first_ceiling_pressure.mbar, &displayed_dive) * 0.001));
|
printf("First ceiling %.1f m\n", (mbar_to_depth(test_deco_state.first_ceiling_pressure.mbar, &dive) * 0.001));
|
||||||
// check benchmark run time of 141 minutes, and known Subsurface runtime of 139 minutes
|
// check benchmark run time of 141 minutes, and known Subsurface runtime of 139 minutes
|
||||||
//QVERIFY(compareDecoTime(displayed_dive.dc.duration.seconds, 141u * 60u + 20u, 139u * 60u + 20u));
|
//QVERIFY(compareDecoTime(dive.dc.duration.seconds, 141u * 60u + 20u, 139u * 60u + 20u));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestPlan::testVpmbMetric60m10minTx()
|
void TestPlan::testVpmbMetric60m10minTx()
|
||||||
|
@ -563,12 +564,12 @@ void TestPlan::testVpmbMetric60m10minTx()
|
||||||
struct diveplan testPlan = {};
|
struct diveplan testPlan = {};
|
||||||
setupPlanVpmb60m10mTx(&testPlan);
|
setupPlanVpmb60m10mTx(&testPlan);
|
||||||
|
|
||||||
plan(&test_deco_state, &testPlan, &displayed_dive, 60, stoptable, &cache, 1, 0);
|
plan(&test_deco_state, &testPlan, &dive, 60, stoptable, &cache, 1, 0);
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
free(displayed_dive.notes);
|
free(dive.notes);
|
||||||
displayed_dive.notes = NULL;
|
dive.notes = NULL;
|
||||||
save_dive(stdout, &displayed_dive, false);
|
save_dive(stdout, &dive, false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// check minimum gas result
|
// check minimum gas result
|
||||||
|
@ -577,9 +578,9 @@ void TestPlan::testVpmbMetric60m10minTx()
|
||||||
dp = dp->next;
|
dp = dp->next;
|
||||||
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 162l);
|
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 162l);
|
||||||
// print first ceiling
|
// print first ceiling
|
||||||
printf("First ceiling %.1f m\n", (mbar_to_depth(test_deco_state.first_ceiling_pressure.mbar, &displayed_dive) * 0.001));
|
printf("First ceiling %.1f m\n", (mbar_to_depth(test_deco_state.first_ceiling_pressure.mbar, &dive) * 0.001));
|
||||||
// check benchmark run time of 141 minutes, and known Subsurface runtime of 139 minutes
|
// check benchmark run time of 141 minutes, and known Subsurface runtime of 139 minutes
|
||||||
//QVERIFY(compareDecoTime(displayed_dive.dc.duration.seconds, 141u * 60u + 20u, 139u * 60u + 20u));
|
//QVERIFY(compareDecoTime(dive.dc.duration.seconds, 141u * 60u + 20u, 139u * 60u + 20u));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestPlan::testVpmbMetric60m30minAir()
|
void TestPlan::testVpmbMetric60m30minAir()
|
||||||
|
@ -593,12 +594,12 @@ void TestPlan::testVpmbMetric60m30minAir()
|
||||||
struct diveplan testPlan = {};
|
struct diveplan testPlan = {};
|
||||||
setupPlanVpmb60m30minAir(&testPlan);
|
setupPlanVpmb60m30minAir(&testPlan);
|
||||||
|
|
||||||
plan(&test_deco_state, &testPlan, &displayed_dive, 60, stoptable, &cache, 1, 0);
|
plan(&test_deco_state, &testPlan, &dive, 60, stoptable, &cache, 1, 0);
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
free(displayed_dive.notes);
|
free(dive.notes);
|
||||||
displayed_dive.notes = NULL;
|
dive.notes = NULL;
|
||||||
save_dive(stdout, &displayed_dive, false);
|
save_dive(stdout, &dive, false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// check minimum gas result
|
// check minimum gas result
|
||||||
|
@ -607,9 +608,9 @@ void TestPlan::testVpmbMetric60m30minAir()
|
||||||
dp = dp->next;
|
dp = dp->next;
|
||||||
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 180l);
|
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 180l);
|
||||||
// print first ceiling
|
// print first ceiling
|
||||||
printf("First ceiling %.1f m\n", (mbar_to_depth(test_deco_state.first_ceiling_pressure.mbar, &displayed_dive) * 0.001));
|
printf("First ceiling %.1f m\n", (mbar_to_depth(test_deco_state.first_ceiling_pressure.mbar, &dive) * 0.001));
|
||||||
// check benchmark run time of 141 minutes, and known Subsurface runtime of 139 minutes
|
// check benchmark run time of 141 minutes, and known Subsurface runtime of 139 minutes
|
||||||
QVERIFY(compareDecoTime(displayed_dive.dc.duration.seconds, 141u * 60u + 20u, 139u * 60u + 20u));
|
QVERIFY(compareDecoTime(dive.dc.duration.seconds, 141u * 60u + 20u, 139u * 60u + 20u));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestPlan::testVpmbMetric60m30minEan50()
|
void TestPlan::testVpmbMetric60m30minEan50()
|
||||||
|
@ -623,12 +624,12 @@ void TestPlan::testVpmbMetric60m30minEan50()
|
||||||
struct diveplan testPlan = {};
|
struct diveplan testPlan = {};
|
||||||
setupPlanVpmb60m30minEan50(&testPlan);
|
setupPlanVpmb60m30minEan50(&testPlan);
|
||||||
|
|
||||||
plan(&test_deco_state, &testPlan, &displayed_dive, 60, stoptable, &cache, 1, 0);
|
plan(&test_deco_state, &testPlan, &dive, 60, stoptable, &cache, 1, 0);
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
free(displayed_dive.notes);
|
free(dive.notes);
|
||||||
displayed_dive.notes = NULL;
|
dive.notes = NULL;
|
||||||
save_dive(stdout, &displayed_dive, false);
|
save_dive(stdout, &dive, false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// check minimum gas result
|
// check minimum gas result
|
||||||
|
@ -637,15 +638,15 @@ void TestPlan::testVpmbMetric60m30minEan50()
|
||||||
dp = dp->next;
|
dp = dp->next;
|
||||||
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 155l);
|
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 155l);
|
||||||
// print first ceiling
|
// print first ceiling
|
||||||
printf("First ceiling %.1f m\n", (mbar_to_depth(test_deco_state.first_ceiling_pressure.mbar, &displayed_dive) * 0.001));
|
printf("First ceiling %.1f m\n", (mbar_to_depth(test_deco_state.first_ceiling_pressure.mbar, &dive) * 0.001));
|
||||||
// check first gas change to EAN50 at 21m
|
// check first gas change to EAN50 at 21m
|
||||||
struct event *ev = displayed_dive.dc.events;
|
struct event *ev = dive.dc.events;
|
||||||
QVERIFY(ev != NULL);
|
QVERIFY(ev != NULL);
|
||||||
QCOMPARE(ev->gas.index, 1);
|
QCOMPARE(ev->gas.index, 1);
|
||||||
QCOMPARE(ev->value, 50);
|
QCOMPARE(ev->value, 50);
|
||||||
QCOMPARE(get_depth_at_time(&displayed_dive.dc, ev->time.seconds), 21000);
|
QCOMPARE(get_depth_at_time(&dive.dc, ev->time.seconds), 21000);
|
||||||
// check benchmark run time of 95 minutes, and known Subsurface runtime of 96 minutes
|
// check benchmark run time of 95 minutes, and known Subsurface runtime of 96 minutes
|
||||||
QVERIFY(compareDecoTime(displayed_dive.dc.duration.seconds, 95u * 60u + 20u, 96u * 60u + 20u));
|
QVERIFY(compareDecoTime(dive.dc.duration.seconds, 95u * 60u + 20u, 96u * 60u + 20u));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestPlan::testVpmbMetric60m30minTx()
|
void TestPlan::testVpmbMetric60m30minTx()
|
||||||
|
@ -659,12 +660,12 @@ void TestPlan::testVpmbMetric60m30minTx()
|
||||||
struct diveplan testPlan = {};
|
struct diveplan testPlan = {};
|
||||||
setupPlanVpmb60m30minTx(&testPlan);
|
setupPlanVpmb60m30minTx(&testPlan);
|
||||||
|
|
||||||
plan(&test_deco_state, &testPlan, &displayed_dive, 60, stoptable, &cache, 1, 0);
|
plan(&test_deco_state, &testPlan, &dive, 60, stoptable, &cache, 1, 0);
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
free(displayed_dive.notes);
|
free(dive.notes);
|
||||||
displayed_dive.notes = NULL;
|
dive.notes = NULL;
|
||||||
save_dive(stdout, &displayed_dive, false);
|
save_dive(stdout, &dive, false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// check minimum gas result
|
// check minimum gas result
|
||||||
|
@ -673,15 +674,15 @@ void TestPlan::testVpmbMetric60m30minTx()
|
||||||
dp = dp->next;
|
dp = dp->next;
|
||||||
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 159l);
|
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 159l);
|
||||||
// print first ceiling
|
// print first ceiling
|
||||||
printf("First ceiling %.1f m\n", (mbar_to_depth(test_deco_state.first_ceiling_pressure.mbar, &displayed_dive) * 0.001));
|
printf("First ceiling %.1f m\n", (mbar_to_depth(test_deco_state.first_ceiling_pressure.mbar, &dive) * 0.001));
|
||||||
// check first gas change to EAN50 at 21m
|
// check first gas change to EAN50 at 21m
|
||||||
struct event *ev = displayed_dive.dc.events;
|
struct event *ev = dive.dc.events;
|
||||||
QVERIFY(ev != NULL);
|
QVERIFY(ev != NULL);
|
||||||
QCOMPARE(ev->gas.index, 1);
|
QCOMPARE(ev->gas.index, 1);
|
||||||
QCOMPARE(ev->value, 50);
|
QCOMPARE(ev->value, 50);
|
||||||
QCOMPARE(get_depth_at_time(&displayed_dive.dc, ev->time.seconds), 21000);
|
QCOMPARE(get_depth_at_time(&dive.dc, ev->time.seconds), 21000);
|
||||||
// check benchmark run time of 89 minutes, and known Subsurface runtime of 89 minutes
|
// check benchmark run time of 89 minutes, and known Subsurface runtime of 89 minutes
|
||||||
QVERIFY(compareDecoTime(displayed_dive.dc.duration.seconds, 89u * 60u + 20u, 89u * 60u + 20u));
|
QVERIFY(compareDecoTime(dive.dc.duration.seconds, 89u * 60u + 20u, 89u * 60u + 20u));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestPlan::testVpmbMetric100m60min()
|
void TestPlan::testVpmbMetric100m60min()
|
||||||
|
@ -695,12 +696,12 @@ void TestPlan::testVpmbMetric100m60min()
|
||||||
struct diveplan testPlan = {};
|
struct diveplan testPlan = {};
|
||||||
setupPlanVpmb100m60min(&testPlan);
|
setupPlanVpmb100m60min(&testPlan);
|
||||||
|
|
||||||
plan(&test_deco_state, &testPlan, &displayed_dive, 60, stoptable, &cache, 1, 0);
|
plan(&test_deco_state, &testPlan, &dive, 60, stoptable, &cache, 1, 0);
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
free(displayed_dive.notes);
|
free(dive.notes);
|
||||||
displayed_dive.notes = NULL;
|
dive.notes = NULL;
|
||||||
save_dive(stdout, &displayed_dive, false);
|
save_dive(stdout, &dive, false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// check minimum gas result
|
// check minimum gas result
|
||||||
|
@ -709,21 +710,21 @@ void TestPlan::testVpmbMetric100m60min()
|
||||||
dp = dp->next;
|
dp = dp->next;
|
||||||
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 157l);
|
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 157l);
|
||||||
// print first ceiling
|
// print first ceiling
|
||||||
printf("First ceiling %.1f m\n", (mbar_to_depth(test_deco_state.first_ceiling_pressure.mbar, &displayed_dive) * 0.001));
|
printf("First ceiling %.1f m\n", (mbar_to_depth(test_deco_state.first_ceiling_pressure.mbar, &dive) * 0.001));
|
||||||
// check first gas change to EAN50 at 21m
|
// check first gas change to EAN50 at 21m
|
||||||
struct event *ev = displayed_dive.dc.events;
|
struct event *ev = dive.dc.events;
|
||||||
QVERIFY(ev != NULL);
|
QVERIFY(ev != NULL);
|
||||||
QCOMPARE(ev->gas.index, 1);
|
QCOMPARE(ev->gas.index, 1);
|
||||||
QCOMPARE(ev->value, 50);
|
QCOMPARE(ev->value, 50);
|
||||||
QCOMPARE(get_depth_at_time(&displayed_dive.dc, ev->time.seconds), 21000);
|
QCOMPARE(get_depth_at_time(&dive.dc, ev->time.seconds), 21000);
|
||||||
// check second gas change to Oxygen at 6m
|
// check second gas change to Oxygen at 6m
|
||||||
ev = ev->next;
|
ev = ev->next;
|
||||||
QVERIFY(ev != NULL);
|
QVERIFY(ev != NULL);
|
||||||
QCOMPARE(ev->gas.index, 2);
|
QCOMPARE(ev->gas.index, 2);
|
||||||
QCOMPARE(ev->value, 100);
|
QCOMPARE(ev->value, 100);
|
||||||
QCOMPARE(get_depth_at_time(&displayed_dive.dc, ev->time.seconds), 6000);
|
QCOMPARE(get_depth_at_time(&dive.dc, ev->time.seconds), 6000);
|
||||||
// check benchmark run time of 311 minutes, and known Subsurface runtime of 314 minutes
|
// check benchmark run time of 311 minutes, and known Subsurface runtime of 314 minutes
|
||||||
QVERIFY(compareDecoTime(displayed_dive.dc.duration.seconds, 311u * 60u + 20u, 315u * 60u + 20u));
|
QVERIFY(compareDecoTime(dive.dc.duration.seconds, 311u * 60u + 20u, 315u * 60u + 20u));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestPlan::testMultipleGases()
|
void TestPlan::testMultipleGases()
|
||||||
|
@ -738,18 +739,18 @@ void TestPlan::testMultipleGases()
|
||||||
|
|
||||||
setupPlanSeveralGases(&testPlan);
|
setupPlanSeveralGases(&testPlan);
|
||||||
|
|
||||||
plan(&test_deco_state, &testPlan, &displayed_dive, 60, stoptable, &cache, 1, 0);
|
plan(&test_deco_state, &testPlan, &dive, 60, stoptable, &cache, 1, 0);
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
free(displayed_dive.notes);
|
free(dive.notes);
|
||||||
displayed_dive.notes = NULL;
|
dive.notes = NULL;
|
||||||
save_dive(stdout, &displayed_dive, false);
|
save_dive(stdout, &dive, false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gasmix gas;
|
gasmix gas;
|
||||||
gas = get_gasmix_at_time(&displayed_dive, &displayed_dive.dc, {20 * 60 + 1});
|
gas = get_gasmix_at_time(&dive, &dive.dc, {20 * 60 + 1});
|
||||||
QCOMPARE(get_o2(gas), 110);
|
QCOMPARE(get_o2(gas), 110);
|
||||||
QVERIFY(compareDecoTime(displayed_dive.dc.duration.seconds, 2480u, 2480u));
|
QVERIFY(compareDecoTime(dive.dc.duration.seconds, 2480u, 2480u));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestPlan::testVpmbMetricMultiLevelAir()
|
void TestPlan::testVpmbMetricMultiLevelAir()
|
||||||
|
@ -763,12 +764,12 @@ void TestPlan::testVpmbMetricMultiLevelAir()
|
||||||
struct diveplan testPlan = {};
|
struct diveplan testPlan = {};
|
||||||
setupPlanVpmbMultiLevelAir(&testPlan);
|
setupPlanVpmbMultiLevelAir(&testPlan);
|
||||||
|
|
||||||
plan(&test_deco_state, &testPlan, &displayed_dive, 60, stoptable, &cache, 1, 0);
|
plan(&test_deco_state, &testPlan, &dive, 60, stoptable, &cache, 1, 0);
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
free(displayed_dive.notes);
|
free(dive.notes);
|
||||||
displayed_dive.notes = NULL;
|
dive.notes = NULL;
|
||||||
save_dive(stdout, &displayed_dive, false);
|
save_dive(stdout, &dive, false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// check minimum gas result
|
// check minimum gas result
|
||||||
|
@ -777,9 +778,9 @@ void TestPlan::testVpmbMetricMultiLevelAir()
|
||||||
dp = dp->next;
|
dp = dp->next;
|
||||||
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 101l);
|
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 101l);
|
||||||
// print first ceiling
|
// print first ceiling
|
||||||
printf("First ceiling %.1f m\n", (mbar_to_depth(test_deco_state.first_ceiling_pressure.mbar, &displayed_dive) * 0.001));
|
printf("First ceiling %.1f m\n", (mbar_to_depth(test_deco_state.first_ceiling_pressure.mbar, &dive) * 0.001));
|
||||||
// check benchmark run time of 167 minutes, and known Subsurface runtime of 169 minutes
|
// check benchmark run time of 167 minutes, and known Subsurface runtime of 169 minutes
|
||||||
QVERIFY(compareDecoTime(displayed_dive.dc.duration.seconds, 167u * 60u + 20u, 169u * 60u + 20u));
|
QVERIFY(compareDecoTime(dive.dc.duration.seconds, 167u * 60u + 20u, 169u * 60u + 20u));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestPlan::testVpmbMetric100m10min()
|
void TestPlan::testVpmbMetric100m10min()
|
||||||
|
@ -793,12 +794,12 @@ void TestPlan::testVpmbMetric100m10min()
|
||||||
struct diveplan testPlan = {};
|
struct diveplan testPlan = {};
|
||||||
setupPlanVpmb100m10min(&testPlan);
|
setupPlanVpmb100m10min(&testPlan);
|
||||||
|
|
||||||
plan(&test_deco_state, &testPlan, &displayed_dive, 60, stoptable, &cache, 1, 0);
|
plan(&test_deco_state, &testPlan, &dive, 60, stoptable, &cache, 1, 0);
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
free(displayed_dive.notes);
|
free(dive.notes);
|
||||||
displayed_dive.notes = NULL;
|
dive.notes = NULL;
|
||||||
save_dive(stdout, &displayed_dive, false);
|
save_dive(stdout, &dive, false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// check minimum gas result
|
// check minimum gas result
|
||||||
|
@ -807,21 +808,21 @@ void TestPlan::testVpmbMetric100m10min()
|
||||||
dp = dp->next;
|
dp = dp->next;
|
||||||
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 175l);
|
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 175l);
|
||||||
// print first ceiling
|
// print first ceiling
|
||||||
printf("First ceiling %.1f m\n", (mbar_to_depth(test_deco_state.first_ceiling_pressure.mbar, &displayed_dive) * 0.001));
|
printf("First ceiling %.1f m\n", (mbar_to_depth(test_deco_state.first_ceiling_pressure.mbar, &dive) * 0.001));
|
||||||
// check first gas change to EAN50 at 21m
|
// check first gas change to EAN50 at 21m
|
||||||
struct event *ev = displayed_dive.dc.events;
|
struct event *ev = dive.dc.events;
|
||||||
QVERIFY(ev != NULL);
|
QVERIFY(ev != NULL);
|
||||||
QCOMPARE(ev->gas.index, 1);
|
QCOMPARE(ev->gas.index, 1);
|
||||||
QCOMPARE(ev->value, 50);
|
QCOMPARE(ev->value, 50);
|
||||||
QCOMPARE(get_depth_at_time(&displayed_dive.dc, ev->time.seconds), 21000);
|
QCOMPARE(get_depth_at_time(&dive.dc, ev->time.seconds), 21000);
|
||||||
// check second gas change to Oxygen at 6m
|
// check second gas change to Oxygen at 6m
|
||||||
ev = ev->next;
|
ev = ev->next;
|
||||||
QVERIFY(ev != NULL);
|
QVERIFY(ev != NULL);
|
||||||
QCOMPARE(ev->gas.index, 2);
|
QCOMPARE(ev->gas.index, 2);
|
||||||
QCOMPARE(ev->value, 100);
|
QCOMPARE(ev->value, 100);
|
||||||
QCOMPARE(get_depth_at_time(&displayed_dive.dc, ev->time.seconds), 6000);
|
QCOMPARE(get_depth_at_time(&dive.dc, ev->time.seconds), 6000);
|
||||||
// check benchmark run time of 58 minutes, and known Subsurface runtime of 57 minutes
|
// check benchmark run time of 58 minutes, and known Subsurface runtime of 57 minutes
|
||||||
QVERIFY(compareDecoTime(displayed_dive.dc.duration.seconds, 58u * 60u + 20u, 57u * 60u + 20u));
|
QVERIFY(compareDecoTime(dive.dc.duration.seconds, 58u * 60u + 20u, 57u * 60u + 20u));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This tests that a previously calculated plan isn't affecting the calculations of the next plan.
|
/* This tests that a previously calculated plan isn't affecting the calculations of the next plan.
|
||||||
|
@ -839,12 +840,12 @@ void TestPlan::testVpmbMetricRepeat()
|
||||||
struct diveplan testPlan = {};
|
struct diveplan testPlan = {};
|
||||||
setupPlanVpmb30m20min(&testPlan);
|
setupPlanVpmb30m20min(&testPlan);
|
||||||
|
|
||||||
plan(&test_deco_state, &testPlan, &displayed_dive, 60, stoptable, &cache, 1, 0);
|
plan(&test_deco_state, &testPlan, &dive, 60, stoptable, &cache, 1, 0);
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
free(displayed_dive.notes);
|
free(dive.notes);
|
||||||
displayed_dive.notes = NULL;
|
dive.notes = NULL;
|
||||||
save_dive(stdout, &displayed_dive, false);
|
save_dive(stdout, &dive, false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// check minimum gas result
|
// check minimum gas result
|
||||||
|
@ -853,19 +854,19 @@ void TestPlan::testVpmbMetricRepeat()
|
||||||
dp = dp->next;
|
dp = dp->next;
|
||||||
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 61l);
|
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 61l);
|
||||||
// print first ceiling
|
// print first ceiling
|
||||||
printf("First ceiling %.1f m\n", (mbar_to_depth(test_deco_state.first_ceiling_pressure.mbar, &displayed_dive) * 0.001));
|
printf("First ceiling %.1f m\n", (mbar_to_depth(test_deco_state.first_ceiling_pressure.mbar, &dive) * 0.001));
|
||||||
// check benchmark run time of 27 minutes, and known Subsurface runtime of 28 minutes
|
// check benchmark run time of 27 minutes, and known Subsurface runtime of 28 minutes
|
||||||
QVERIFY(compareDecoTime(displayed_dive.dc.duration.seconds, 27u * 60u + 20u, 27u * 60u + 20u));
|
QVERIFY(compareDecoTime(dive.dc.duration.seconds, 27u * 60u + 20u, 27u * 60u + 20u));
|
||||||
|
|
||||||
int firstDiveRunTimeSeconds = displayed_dive.dc.duration.seconds;
|
int firstDiveRunTimeSeconds = dive.dc.duration.seconds;
|
||||||
|
|
||||||
setupPlanVpmb100mTo70m30min(&testPlan);
|
setupPlanVpmb100mTo70m30min(&testPlan);
|
||||||
plan(&test_deco_state, &testPlan, &displayed_dive, 60, stoptable, &cache, 1, 0);
|
plan(&test_deco_state, &testPlan, &dive, 60, stoptable, &cache, 1, 0);
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
free(displayed_dive.notes);
|
free(dive.notes);
|
||||||
displayed_dive.notes = NULL;
|
dive.notes = NULL;
|
||||||
save_dive(stdout, &displayed_dive, false);
|
save_dive(stdout, &dive, false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// check minimum gas result
|
// check minimum gas result
|
||||||
|
@ -874,35 +875,35 @@ void TestPlan::testVpmbMetricRepeat()
|
||||||
dp = dp->next;
|
dp = dp->next;
|
||||||
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 80l);
|
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 80l);
|
||||||
// print first ceiling
|
// print first ceiling
|
||||||
printf("First ceiling %.1f m\n", (mbar_to_depth(test_deco_state.first_ceiling_pressure.mbar, &displayed_dive) * 0.001));
|
printf("First ceiling %.1f m\n", (mbar_to_depth(test_deco_state.first_ceiling_pressure.mbar, &dive) * 0.001));
|
||||||
// check first gas change to 21/35 at 66m
|
// check first gas change to 21/35 at 66m
|
||||||
struct event *ev = displayed_dive.dc.events;
|
struct event *ev = dive.dc.events;
|
||||||
QVERIFY(ev != NULL);
|
QVERIFY(ev != NULL);
|
||||||
QCOMPARE(ev->gas.index, 1);
|
QCOMPARE(ev->gas.index, 1);
|
||||||
QCOMPARE(ev->gas.mix.o2.permille, 210);
|
QCOMPARE(ev->gas.mix.o2.permille, 210);
|
||||||
QCOMPARE(ev->gas.mix.he.permille, 350);
|
QCOMPARE(ev->gas.mix.he.permille, 350);
|
||||||
QCOMPARE(get_depth_at_time(&displayed_dive.dc, ev->time.seconds), 66000);
|
QCOMPARE(get_depth_at_time(&dive.dc, ev->time.seconds), 66000);
|
||||||
// check second gas change to EAN50 at 21m
|
// check second gas change to EAN50 at 21m
|
||||||
ev = ev->next;
|
ev = ev->next;
|
||||||
QCOMPARE(ev->gas.index, 2);
|
QCOMPARE(ev->gas.index, 2);
|
||||||
QCOMPARE(ev->value, 50);
|
QCOMPARE(ev->value, 50);
|
||||||
QCOMPARE(get_depth_at_time(&displayed_dive.dc, ev->time.seconds), 21000);
|
QCOMPARE(get_depth_at_time(&dive.dc, ev->time.seconds), 21000);
|
||||||
// check third gas change to Oxygen at 6m
|
// check third gas change to Oxygen at 6m
|
||||||
ev = ev->next;
|
ev = ev->next;
|
||||||
QVERIFY(ev != NULL);
|
QVERIFY(ev != NULL);
|
||||||
QCOMPARE(ev->gas.index, 3);
|
QCOMPARE(ev->gas.index, 3);
|
||||||
QCOMPARE(ev->value, 100);
|
QCOMPARE(ev->value, 100);
|
||||||
QCOMPARE(get_depth_at_time(&displayed_dive.dc, ev->time.seconds), 6000);
|
QCOMPARE(get_depth_at_time(&dive.dc, ev->time.seconds), 6000);
|
||||||
// we don't have a benchmark, known Subsurface runtime is 126 minutes
|
// we don't have a benchmark, known Subsurface runtime is 126 minutes
|
||||||
QVERIFY(compareDecoTime(displayed_dive.dc.duration.seconds, 127u * 60u + 20u, 127u * 60u + 20u));
|
QVERIFY(compareDecoTime(dive.dc.duration.seconds, 127u * 60u + 20u, 127u * 60u + 20u));
|
||||||
|
|
||||||
setupPlanVpmb30m20min(&testPlan);
|
setupPlanVpmb30m20min(&testPlan);
|
||||||
plan(&test_deco_state, &testPlan, &displayed_dive, 60, stoptable, &cache, 1, 0);
|
plan(&test_deco_state, &testPlan, &dive, 60, stoptable, &cache, 1, 0);
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
free(displayed_dive.notes);
|
free(dive.notes);
|
||||||
displayed_dive.notes = NULL;
|
dive.notes = NULL;
|
||||||
save_dive(stdout, &displayed_dive, false);
|
save_dive(stdout, &dive, false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// check minimum gas result
|
// check minimum gas result
|
||||||
|
@ -911,10 +912,10 @@ void TestPlan::testVpmbMetricRepeat()
|
||||||
dp = dp->next;
|
dp = dp->next;
|
||||||
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 61l);
|
QCOMPARE(lrint(dp->minimum_gas.mbar / 1000.0), 61l);
|
||||||
// print first ceiling
|
// print first ceiling
|
||||||
printf("First ceiling %.1f m\n", (mbar_to_depth(test_deco_state.first_ceiling_pressure.mbar, &displayed_dive) * 0.001));
|
printf("First ceiling %.1f m\n", (mbar_to_depth(test_deco_state.first_ceiling_pressure.mbar, &dive) * 0.001));
|
||||||
|
|
||||||
// check runtime is exactly the same as the first time
|
// check runtime is exactly the same as the first time
|
||||||
int finalDiveRunTimeSeconds = displayed_dive.dc.duration.seconds;
|
int finalDiveRunTimeSeconds = dive.dc.duration.seconds;
|
||||||
QCOMPARE(finalDiveRunTimeSeconds, firstDiveRunTimeSeconds);
|
QCOMPARE(finalDiveRunTimeSeconds, firstDiveRunTimeSeconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -930,37 +931,37 @@ void TestPlan::testCcrBailoutGasSelection()
|
||||||
prefs.unit_system = METRIC;
|
prefs.unit_system = METRIC;
|
||||||
prefs.units.length = units::METERS;
|
prefs.units.length = units::METERS;
|
||||||
prefs.planner_deco_mode = BUEHLMANN;
|
prefs.planner_deco_mode = BUEHLMANN;
|
||||||
displayed_dive.dc.divemode = CCR;
|
dive.dc.divemode = CCR;
|
||||||
prefs.dobailout = true;
|
prefs.dobailout = true;
|
||||||
|
|
||||||
struct diveplan testPlan = {};
|
struct diveplan testPlan = {};
|
||||||
setupPlanCcr(&testPlan);
|
setupPlanCcr(&testPlan);
|
||||||
|
|
||||||
plan(&test_deco_state, &testPlan, &displayed_dive, 60, stoptable, &cache, true, false);
|
plan(&test_deco_state, &testPlan, &dive, 60, stoptable, &cache, true, false);
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
free(displayed_dive.notes);
|
free(dive.notes);
|
||||||
displayed_dive.notes = NULL;
|
dive.notes = NULL;
|
||||||
save_dive(stdout, &displayed_dive, false);
|
save_dive(stdout, &dive, false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// check diluent used
|
// check diluent used
|
||||||
cylinder_t *cylinder = get_cylinder(&displayed_dive, get_cylinderid_at_time(&displayed_dive, &displayed_dive.dc, { 20 * 60 - 1 }));
|
cylinder_t *cylinder = get_cylinder(&dive, get_cylinderid_at_time(&dive, &dive.dc, { 20 * 60 - 1 }));
|
||||||
QCOMPARE(cylinder->cylinder_use, DILUENT);
|
QCOMPARE(cylinder->cylinder_use, DILUENT);
|
||||||
QCOMPARE(get_o2(cylinder->gasmix), 200);
|
QCOMPARE(get_o2(cylinder->gasmix), 200);
|
||||||
|
|
||||||
// check deep bailout used
|
// check deep bailout used
|
||||||
cylinder = get_cylinder(&displayed_dive, get_cylinderid_at_time(&displayed_dive, &displayed_dive.dc, { 20 * 60 + 1 }));
|
cylinder = get_cylinder(&dive, get_cylinderid_at_time(&dive, &dive.dc, { 20 * 60 + 1 }));
|
||||||
QCOMPARE(cylinder->cylinder_use, OC_GAS);
|
QCOMPARE(cylinder->cylinder_use, OC_GAS);
|
||||||
QCOMPARE(get_o2(cylinder->gasmix), 190);
|
QCOMPARE(get_o2(cylinder->gasmix), 190);
|
||||||
|
|
||||||
// check shallow bailout used
|
// check shallow bailout used
|
||||||
cylinder = get_cylinder(&displayed_dive, get_cylinderid_at_time(&displayed_dive, &displayed_dive.dc, { 30 * 60 }));
|
cylinder = get_cylinder(&dive, get_cylinderid_at_time(&dive, &dive.dc, { 30 * 60 }));
|
||||||
QCOMPARE(cylinder->cylinder_use, OC_GAS);
|
QCOMPARE(cylinder->cylinder_use, OC_GAS);
|
||||||
QCOMPARE(get_o2(cylinder->gasmix), 530);
|
QCOMPARE(get_o2(cylinder->gasmix), 530);
|
||||||
|
|
||||||
// check expected run time of 51 minutes
|
// check expected run time of 51 minutes
|
||||||
QVERIFY(compareDecoTime(displayed_dive.dc.duration.seconds, 51 * 60, 51 * 60));
|
QVERIFY(compareDecoTime(dive.dc.duration.seconds, 51 * 60, 51 * 60));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue