summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--dive.h2
-rw-r--r--divelist.c6
-rw-r--r--equipment.c2
-rw-r--r--libdivecomputer.c2
-rw-r--r--statistics.c2
5 files changed, 8 insertions, 6 deletions
diff --git a/dive.h b/dive.h
index 0549843ab..bdf3aa6e1 100644
--- a/dive.h
+++ b/dive.h
@@ -326,4 +326,6 @@ const char *monthname(int mon);
#define FIVE_STARS UTF8_BLACKSTAR UTF8_BLACKSTAR UTF8_BLACKSTAR UTF8_BLACKSTAR UTF8_BLACKSTAR
extern const char *star_strings[];
+#define AIR_PERMILLE 209
+
#endif /* DIVE_H */
diff --git a/divelist.c b/divelist.c
index 32dc92b99..4ab61997c 100644
--- a/divelist.c
+++ b/divelist.c
@@ -244,7 +244,7 @@ static void get_dive_gas(struct dive *dive, int *o2, int *he, int *o2low)
if (cylinder_none(cyl))
continue;
if (!o2)
- o2 = 209;
+ o2 = AIR_PERMILLE;
if (o2 < mino2)
mino2 = o2;
if (he > maxhe)
@@ -258,7 +258,7 @@ newmax:
maxo2 = o2;
}
/* All air? Show/sort as "air"/zero */
- if (!maxhe && maxo2 == 209 && mino2 == maxo2)
+ if (!maxhe && maxo2 == AIR_PERMILLE && mino2 == maxo2)
maxo2 = mino2 = 0;
*o2 = maxo2;
*he = maxhe;
@@ -394,7 +394,7 @@ static int calculate_otu(struct dive *dive)
t = sample->time.seconds - psample->time.seconds;
int o2 = dive->cylinder[sample->cylinderindex].gasmix.o2.permille;
if (!o2)
- o2 = 209;
+ o2 = AIR_PERMILLE;
po2 = o2 / 1000.0 * (sample->depth.mm + 10000) / 10000.0;
if (po2 >= 0.5)
otu += pow(po2 - 0.5, 0.83) * t / 30.0;
diff --git a/equipment.c b/equipment.c
index 482fb4e1c..d2c7891ae 100644
--- a/equipment.c
+++ b/equipment.c
@@ -285,7 +285,7 @@ static void show_cylinder(cylinder_t *cyl, struct cylinder_widget *cylinder)
o2 = cyl->gasmix.o2.permille / 10.0;
he = cyl->gasmix.he.permille / 10.0;
if (!o2)
- o2 = 21.0;
+ o2 = AIR_PERMILLE / 10.0;
gtk_spin_button_set_value(GTK_SPIN_BUTTON(cylinder->o2), o2);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(cylinder->he), he);
}
diff --git a/libdivecomputer.c b/libdivecomputer.c
index 9d4c1065a..daf724190 100644
--- a/libdivecomputer.c
+++ b/libdivecomputer.c
@@ -109,7 +109,7 @@ static int parse_gasmixes(struct dive *dive, parser_t *parser, int ngases)
he = gasmix.helium * 1000 + 0.5;
/* Ignore bogus data - libdivecomputer does some crazy stuff */
- if (o2 < 210 || o2 >= 1000)
+ if (o2 <= AIR_PERMILLE || o2 >= 1000)
o2 = 0;
if (he < 0 || he >= 800 || o2+he >= 1000)
he = 0;
diff --git a/statistics.c b/statistics.c
index f8f9d0e24..9510030d7 100644
--- a/statistics.c
+++ b/statistics.c
@@ -171,7 +171,7 @@ void show_dive_stats(struct dive *dive)
end = cyl->end.mbar ? : cyl->sample_end.mbar;
if (!cylinder_none(cyl)) {
/* 0% O2 strangely means air, so 21% - I don't like that at all */
- int o2 = cyl->gasmix.o2.permille ? : 209;
+ int o2 = cyl->gasmix.o2.permille ? : AIR_PERMILLE;
if (offset > 0) {
snprintf(buf+offset, 80-offset, ", ");
offset += 2;