aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/dive.h3
-rw-r--r--core/equipment.c21
-rw-r--r--qt-models/cylindermodel.cpp3
3 files changed, 27 insertions, 0 deletions
diff --git a/core/dive.h b/core/dive.h
index 399feecb5..2b227690b 100644
--- a/core/dive.h
+++ b/core/dive.h
@@ -994,6 +994,9 @@ extern bool weightsystems_equal(weightsystem_t *ws1, weightsystem_t *ws2);
extern void remove_cylinder(struct dive *dive, int idx);
extern void remove_weightsystem(struct dive *dive, int idx);
extern void reset_cylinders(struct dive *dive, bool track_gas);
+#ifdef DEBUG_CYL
+extern void dump_cylinders(struct dive *dive, bool verbose);
+#endif
/*
* String handling.
diff --git a/core/equipment.c b/core/equipment.c
index 3eccfd6b5..8a3b172ef 100644
--- a/core/equipment.c
+++ b/core/equipment.c
@@ -242,3 +242,24 @@ void reset_cylinders(struct dive *dive, bool track_gas)
cyl->deco_gas_used.mliter = 0;
}
}
+
+#ifdef DEBUG_CYL
+void dump_cylinders(struct dive *dive, bool verbose)
+{
+ printf("Cylinder list:\n");
+ for (int i = 0; i < MAX_CYLINDERS; i++) {
+ cylinder_t *cyl = &dive->cylinder[i];
+
+ printf("%02d: Type %s, %3.1fl, %3.0fbar\n", i, cyl->type.description, cyl->type.size.mliter / 1000.0, cyl->type.workingpressure.mbar / 1000.0);
+ printf(" Gasmix O2 %2.0f%% He %2.0f%%\n", cyl->gasmix.o2.permille / 10.0, cyl->gasmix.he.permille / 10.0);
+ printf(" Pressure Start %3.0fbar End %3.0fbar Sample start %3.0fbar Sample end %3.0fbar\n", cyl->start.mbar / 1000.0, cyl->end.mbar / 1000.0, cyl->sample_start.mbar / 1000.0, cyl->sample_end.mbar / 1000.0);
+ if (verbose) {
+ printf(" Depth %3.0fm\n", cyl->depth.mm / 1000.0);
+ printf(" Added %s\n", (cyl->manually_added ? "manually" : ""));
+ printf(" Gas used Bottom %5.0fl Deco %5.0fl\n", cyl->gas_used.mliter / 1000.0, cyl->deco_gas_used.mliter / 1000.0);
+ printf(" Use %d\n", cyl->cylinder_use);
+ printf(" Bestmix %s %s\n", (cyl->bestmix_o2 ? "O2" : " "), (cyl->bestmix_he ? "He" : " "));
+ }
+ }
+}
+#endif
diff --git a/qt-models/cylindermodel.cpp b/qt-models/cylindermodel.cpp
index e61926084..3979b13b6 100644
--- a/qt-models/cylindermodel.cpp
+++ b/qt-models/cylindermodel.cpp
@@ -488,6 +488,9 @@ void CylindersModel::updateDive()
{
clear();
rows = 0;
+#ifdef DEBUG_CYL
+ dump_cylinders(&displayed_dive, true);
+#endif
for (int i = 0; i < MAX_CYLINDERS; i++) {
if (show_cylinder(&displayed_dive, i))
rows = i + 1;