Commit 2270a932ea2b1efa606fe12fef9eeaa4311e3f80

Kano 2013-09-26T12:24:13

klondike correct cvtKlnToC() temperature calculation

diff --git a/driver-klondike.c b/driver-klondike.c
index b9189c6..797ee37 100644
--- a/driver-klondike.c
+++ b/driver-klondike.c
@@ -118,7 +118,17 @@ IDENTITY KlondikeID;
 
 static double cvtKlnToC(uint8_t temp)
 {
-	return (double)1/((double)1/(25+273.15) + log((double)temp*1000/(256-temp)/2200)/3987) - 273.15;
+	double Rt, stein, celsius;
+
+	Rt = 1000.0 * 255.0 / (double)temp - 1000.0;
+
+	stein = log(Rt / 2200.0) / 3987.0;
+
+	stein += 1.0 / (double)(25.0 + 273.15);
+
+	celsius = (1.0 / stein) - 273.15;
+
+	return celsius;
 }
 
 static int cvtCToKln(double deg)