diff options
author | Stefan Fuchs <sfuchs@gmx.de> | 2017-11-27 12:36:20 +0100 |
---|---|---|
committer | Lubomir I. Ivanov <neolit123@gmail.com> | 2017-11-27 22:40:16 +0100 |
commit | 8a92484b0cc1cd2e2f0e026ef1982a56feccd26f (patch) | |
tree | 025c3083c4ee8f4c7aa71081835e9b9eb958666d /core/equipment.c | |
parent | 4e36b2509ce1dc98724282a3e485a20ebacb17e3 (diff) | |
download | subsurface-8a92484b0cc1cd2e2f0e026ef1982a56feccd26f.tar.gz |
Add debug function dump_cylinders
This function can be used to dump print all cylinder data.
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
Diffstat (limited to 'core/equipment.c')
-rw-r--r-- | core/equipment.c | 21 |
1 files changed, 21 insertions, 0 deletions
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 |