From: Henrik Brautaset Aronsen <[email protected]> The notion that air is special is a weird one. It clutters our code base with special handling whenever o2 == 0 means AIR. (All my rec dives are with EAN32. Why can't that be special instead? ;)
The only reason I see to treat air special is to leave out o2=21.0 in the dive log xml. So let's do it there instead (not included here). Signed-off-by: Henrik Brautaset Aronsen <[email protected]> --- dive.c | 13 ++++--------- planner.c | 3 --- qt-ui/diveplanner.cpp | 2 +- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/dive.c b/dive.c index 0d8f487..4e7a684 100644 --- a/dive.c +++ b/dive.c @@ -527,15 +527,10 @@ void sanitize_gasmix(struct gasmix *mix) o2 = mix->o2.permille; he = mix->he.permille; - /* Regular air: leave empty */ - if (!he) { - if (!o2) - return; - /* 20.8% to 21% O2 is just air */ - if (is_air(o2, he)) { - mix->o2.permille = 0; - return; - } + /* Regular air: */ + if (!he && !o2) { + mix->o2.permille = O2_IN_AIR; + return; } /* Sane mix? */ diff --git a/planner.c b/planner.c index f062ee6..887a955 100644 --- a/planner.c +++ b/planner.c @@ -93,9 +93,6 @@ int get_gasidx(struct dive *dive, int o2, int he) mix.o2.permille = o2; mix.he.permille = he; - /* we treat air as 0/0 because it is special */ - //if (is_air(o2, he)) - // o2 = 0; while (++gasidx < MAX_CYLINDERS) if (gasmix_distance(&dive->cylinder[gasidx].gasmix, &mix) < 200) return gasidx; diff --git a/qt-ui/diveplanner.cpp b/qt-ui/diveplanner.cpp index 252c0ff..1d454ea 100644 --- a/qt-ui/diveplanner.cpp +++ b/qt-ui/diveplanner.cpp @@ -528,7 +528,7 @@ bool DivePlannerPointsModel::addGas(int o2, int he) sanitize_gasmix(&mix); if (is_air(o2, he)) - o2 = 0; + o2 = O2_IN_AIR; for (int i = 0; i < MAX_CYLINDERS; i++) { cylinder_t *cyl = &stagingDive->cylinder[i]; -- 1.8.5.2 (Apple Git-48) _______________________________________________ subsurface mailing list [email protected] http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface
