From fa91ef847241f961792d9d367be27ed0aeddf475 Mon Sep 17 00:00:00 2001 From: Vik Olliver Date: Wed, 2 Feb 2011 18:23:10 +1100 Subject: [PATCH] fix thermistor lookup table interpolation code Signed-off-by: Michael Moon --- temp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/temp.c b/temp.c index a6fd659..51412fa 100644 --- a/temp.c +++ b/temp.c @@ -192,7 +192,7 @@ void temp_sensor_tick() { for (j = 1; j < NUMTEMPS; j++) { if (pgm_read_word(&(temptable[j][0])) > temp) { // multiply by 4 because internal temp is stored as 14.2 fixed point - temp = pgm_read_word(&(temptable[j][1])) * 4 + (pgm_read_word(&(temptable[j][0])) - temp) * 4 * (pgm_read_word(&(temptable[j-1][1])) - pgm_read_word(&(temptable[j][1]))) / (pgm_read_word(&(temptable[j][0])) - pgm_read_word(&(temptable[j-1][0]))); + temp = pgm_read_word(&(temptable[j][1])) * 4 + (temp - pgm_read_word(&(temptable[j-1][0]))) * 4 * (pgm_read_word(&(temptable[j][1])) - pgm_read_word(&(temptable[j-1][1]))) / (pgm_read_word(&(temptable[j][0])) - pgm_read_word(&(temptable[j-1][0]))); break; } }