Correct the OSTC depth calculation

This now uses the same formula as the OSTC uses internally which will get
the values reported by libdivecomputer to be consistent with what is
displayed on the OSTC.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2012-11-13 11:25:18 -08:00 committed by Jef Driesen
parent 328e929d4b
commit ecb17c6fb6

View File

@ -22,6 +22,7 @@
#include <stdlib.h>
#include <libdivecomputer/hw_ostc.h>
#include "libdivecomputer/units.h"
#include "context-private.h"
#include "parser-private.h"
@ -307,7 +308,7 @@ hw_ostc_parser_samples_foreach (dc_parser_t *abstract, dc_sample_callback_t call
// Depth (mbar).
unsigned int depth = array_uint16_le (data + offset);
sample.depth = depth / 100.0;
sample.depth = (depth * BAR / 1000.0) / (GRAVITY * data[43] * 10.0);
if (callback) callback (DC_SAMPLE_DEPTH, sample, userdata);
offset += 2;