From b5c00c89e6a7115c308c9f1a45fb0554100e272d Mon Sep 17 00:00:00 2001 From: Miika Turkia Date: Thu, 10 Sep 2020 16:46:52 +0300 Subject: 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 --- core/import-shearwater.c | 19 +++++++++++++------ 1 file 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; -- cgit v1.2.3-70-g09d2