summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2020-09-10 16:46:52 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-09-15 08:47:51 -0700
commitb5c00c89e6a7115c308c9f1a45fb0554100e272d (patch)
tree6cbb3a3d3e22f7fc744e9f81935a274156c150ed /core
parentdee2b510bb1dee724d9f533f39e505c5804de1ac (diff)
downloadsubsurface-b5c00c89e6a7115c308c9f1a45fb0554100e272d.tar.gz
Import cylinder pressure correctly
Shearwater apparently stores correct pressures nowadays, so getting rid of a hack to import double pressures. Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Diffstat (limited to 'core')
-rw-r--r--core/import-shearwater.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/core/import-shearwater.c b/core/import-shearwater.c
index 118d4056a..84d9a1b06 100644
--- a/core/import-shearwater.c
+++ b/core/import-shearwater.c
@@ -171,13 +171,20 @@ static int shearwater_ai_profile_sample(void *param, int columns, char **data, c
}
}
- /* Weird unit conversion but seems to produce correct results.
- * Also missing values seems to be reported as a 4092 (564 bar) */
- if (data[7] && atoi(data[7]) != 4092) {
- state->cur_sample->pressure[0].mbar = psi_to_mbar(atoi(data[7])) * 2;
+ /*
+ * I have seen sample log where the sample pressure had to be multiplied by 2. However,
+ * currently this seems to be corrected in ShearWater, so we are no longer taking this into
+ * account.
+ *
+ * Also, missing values might be nowadays 8184, even though an old log I have received has
+ * 8190. Thus discarding values over 8180 here.
+ */
+
+ if (data[7] && atoi(data[7]) < 8180) {
+ state->cur_sample->pressure[0].mbar = psi_to_mbar(atoi(data[7]));
}
- if (data[8] && atoi(data[8]) != 4092)
- state->cur_sample->pressure[1].mbar = psi_to_mbar(atoi(data[8])) * 2;
+ if (data[8] && atoi(data[8]) < 8180)
+ state->cur_sample->pressure[1].mbar = psi_to_mbar(atoi(data[8]));
sample_end(state);
return 0;