summaryrefslogtreecommitdiffstats
path: root/libdivecomputer.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2014-08-06 06:19:31 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-08-06 06:19:31 -0700
commit9d801c663f41589b37b386920cff0a823653e898 (patch)
treec235676ff1c49d38d4c2d5f33589e51b356e97ce /libdivecomputer.c
parentb0ead31934704a01521f80c81b8c360bf04df568 (diff)
downloadsubsurface-9d801c663f41589b37b386920cff0a823653e898.tar.gz
Only show libdivecomputer "unlikely gas" warning once
Fixes #696 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'libdivecomputer.c')
-rw-r--r--libdivecomputer.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/libdivecomputer.c b/libdivecomputer.c
index b599b3d14..0011a201d 100644
--- a/libdivecomputer.c
+++ b/libdivecomputer.c
@@ -98,6 +98,7 @@ static bool get_tanksize(device_data_t *devdata, const unsigned char *data, cyli
static int parse_gasmixes(device_data_t *devdata, struct dive *dive, dc_parser_t *parser, int ngases,
const unsigned char *data)
{
+ static bool shown_warning = false;
int i;
for (i = 0; i < ngases; i++) {
@@ -117,11 +118,17 @@ static int parse_gasmixes(device_data_t *devdata, struct dive *dive, dc_parser_t
/* Ignore bogus data - libdivecomputer does some crazy stuff */
if (o2 + he <= O2_IN_AIR || o2 > 1000) {
- report_error("unlikely dive gas data from libdivecomputer: o2 = %d he = %d", o2, he);
+ if (!shown_warning) {
+ shown_warning = true;
+ report_error("unlikely dive gas data from libdivecomputer: o2 = %d he = %d", o2, he);
+ }
o2 = 0;
}
if (he < 0 || o2 + he > 1000) {
- report_error("unlikely dive gas data from libdivecomputer: o2 = %d he = %d", o2, he);
+ if (!shown_warning) {
+ shown_warning = true;
+ report_error("unlikely dive gas data from libdivecomputer: o2 = %d he = %d", o2, he);
+ }
he = 0;
}
dive->cylinder[i].gasmix.o2.permille = o2;