Fixed formula to get and set temperature using ad595

This commit is contained in:
Juan Manuel Parrilla 2013-09-02 19:56:10 +01:00
parent de2feb0cac
commit 04d0b538c4

View file

@ -794,7 +794,7 @@ int temp2analog_thermistor(int celsius, const short table[][2], int numtemps)
#if defined (HEATER_USES_AD595) || defined (BED_USES_AD595) #if defined (HEATER_USES_AD595) || defined (BED_USES_AD595)
int temp2analog_ad595(int celsius) int temp2analog_ad595(int celsius)
{ {
return celsius * 1024 / (500); return (celsius * 1024.0) / (500.0);
} }
#endif #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) #if defined (HEATER_USES_AD595) || defined (BED_USES_AD595)
int analog2temp_ad595(int raw) int analog2temp_ad595(int raw)
{ {
return raw * 500 / 1024; return (raw * 500.0) / 1024.0;
} }
#endif #endif