summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Paul Buxton <paulbuxton.mail@googlemail.com>2020-05-22 11:10:13 +0100
committerGravatar bstoeger <32835590+bstoeger@users.noreply.github.com>2020-05-22 19:19:58 +0200
commit2ba2ea934aac45c6d8b3c6db920776fb2b29cc66 (patch)
tree2f9cf7e47f0d43558450f29e2fe0750725c3fabd
parent00ff63f186f65df809610d70ca9b132197b6e72d (diff)
downloadsubsurface-2ba2ea934aac45c6d8b3c6db920776fb2b29cc66.tar.gz
Fix incorrect Farenheit to Kelvin formula.
Use defined function instead. Signed-off-by: Paul Buxton <paulbuxton.mail@googlemail.com>
-rw-r--r--core/cochran.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/cochran.c b/core/cochran.c
index 7292d425a..547d053b5 100644
--- a/core/cochran.c
+++ b/core/cochran.c
@@ -586,7 +586,7 @@ static void cochran_parse_samples(struct dive *dive, const unsigned char *log,
sample->in_deco = in_deco;
sample->stoptime.seconds = deco_time;
sample->stopdepth.mm = lrint(deco_ceiling * FEET * 1000);
- sample->temperature.mkelvin = C_to_mkelvin((temp - 32) / 1.8);
+ sample->temperature.mkelvin = F_to_mkelvin(temp);
sample->sensor[0] = 0;
sample->pressure[0].mbar = lrint(psi * PSI / 100);
@@ -713,7 +713,7 @@ static void cochran_parse_dive(const unsigned char *decode, unsigned mod,
log[CMD_MAX_DEPTH + 1] * 256) / 4 * FEET * 1000);
dc->meandepth.mm = lrint((log[CMD_AVG_DEPTH] +
log[CMD_AVG_DEPTH + 1] * 256) / 4 * FEET * 1000);
- dc->watertemp.mkelvin = C_to_mkelvin((log[CMD_MIN_TEMP] / 32) - 1.8);
+ dc->watertemp.mkelvin = F_to_mkelvin(log[CMD_MIN_TEMP]);
dc->surface_pressure.mbar = lrint(ATM / BAR * pow(1 - 0.0000225577
* (double) log[CMD_ALTITUDE] * 250 * FEET, 5.25588) * 1000);
dc->salinity = 10000 + 150 * log[CMD_WATER_CONDUCTIVITY];
@@ -759,7 +759,7 @@ static void cochran_parse_dive(const unsigned char *decode, unsigned mod,
log[EMC_MAX_DEPTH + 1] * 256) / 4 * FEET * 1000);
dc->meandepth.mm = lrint((log[EMC_AVG_DEPTH] +
log[EMC_AVG_DEPTH + 1] * 256) / 4 * FEET * 1000);
- dc->watertemp.mkelvin = C_to_mkelvin((log[EMC_MIN_TEMP] - 32) / 1.8);
+ dc->watertemp.mkelvin = F_to_mkelvin(log[EMC_MIN_TEMP]);
dc->surface_pressure.mbar = lrint(ATM / BAR * pow(1 - 0.0000225577
* (double) log[EMC_ALTITUDE] * 250 * FEET, 5.25588) * 1000);
dc->salinity = 10000 + 150 * (log[EMC_WATER_CONDUCTIVITY] & 0x3);
@@ -789,7 +789,7 @@ static void cochran_parse_dive(const unsigned char *decode, unsigned mod,
if (corrupt_dive) {
dc->maxdepth.mm = lrint(max_depth * FEET * 1000);
dc->meandepth.mm = lrint(avg_depth * FEET * 1000);
- dc->watertemp.mkelvin = C_to_mkelvin((min_temp - 32) / 1.8);
+ dc->watertemp.mkelvin = F_to_mkelvin(min_temp);
dc->duration.seconds = duration;
}