From 04d0b538c4428f5f6b5c36d41b63e6429a0636ff Mon Sep 17 00:00:00 2001 From: Juan Manuel Parrilla Date: Mon, 2 Sep 2013 19:56:10 +0100 Subject: [PATCH] Fixed formula to get and set temperature using ad595 --- Sprinter/heater.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sprinter/heater.cpp b/Sprinter/heater.cpp index 027d057..c8a1776 100644 --- a/Sprinter/heater.cpp +++ b/Sprinter/heater.cpp @@ -794,7 +794,7 @@ int temp2analog_thermistor(int celsius, const short table[][2], int numtemps) #if defined (HEATER_USES_AD595) || defined (BED_USES_AD595) int temp2analog_ad595(int celsius) { - return celsius * 1024 / (500); + return (celsius * 1024.0) / (500.0); } #endif @@ -835,7 +835,7 @@ int analog2temp_thermistor(int raw,const short table[][2], int numtemps) { #if defined (HEATER_USES_AD595) || defined (BED_USES_AD595) int analog2temp_ad595(int raw) { - return raw * 500 / 1024; + return (raw * 500.0) / 1024.0; } #endif