mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-01 00:23:23 +00:00
Only show libdivecomputer "unlikely gas" warning once
Fixes #696 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
b0ead31934
commit
9d801c663f
1 changed files with 9 additions and 2 deletions
|
@ -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,
|
static int parse_gasmixes(device_data_t *devdata, struct dive *dive, dc_parser_t *parser, int ngases,
|
||||||
const unsigned char *data)
|
const unsigned char *data)
|
||||||
{
|
{
|
||||||
|
static bool shown_warning = false;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < ngases; 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 */
|
/* Ignore bogus data - libdivecomputer does some crazy stuff */
|
||||||
if (o2 + he <= O2_IN_AIR || o2 > 1000) {
|
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;
|
o2 = 0;
|
||||||
}
|
}
|
||||||
if (he < 0 || o2 + he > 1000) {
|
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;
|
he = 0;
|
||||||
}
|
}
|
||||||
dive->cylinder[i].gasmix.o2.permille = o2;
|
dive->cylinder[i].gasmix.o2.permille = o2;
|
||||||
|
|
Loading…
Add table
Reference in a new issue